Responsived Login and Verify Page

master
YasamanKahdooei 2024-04-24 17:08:50 +03:30
parent 5c26efd928
commit 79ad4f8406
15 changed files with 259 additions and 231 deletions

View File

@ -11,7 +11,7 @@ export default function RequestLayout({
{/* Include shared UI here e.g. a header or sidebar */}
<SideMenu />
<UserHeader />
<div className=" w-[calc(100%-208px)] bg-rose-200 mt-8">{children}</div>
<div className=" w-[calc(100%-208px)] bg-rose-100 flex flex-1 p-10 flex-col overflow-hidden overflow-y-auto fixed top-[60px] left-0 transition-all ">{children}</div>
</section>
);
}

View File

@ -80,7 +80,7 @@
padding: 0;
box-sizing: border-box;
/* direction: rtl; */
font-family: iranyekan;
font-family: "iranyekan";
-webkit-tap-highlight-color: transparent;
--d-header-height: 70px;
--d-sideMenu-width-open: 200px;
@ -103,7 +103,7 @@
button,
input {
font-family: iranyekan;
font-family: 'iranyekan';
}
@layer utilities {
@ -112,102 +112,10 @@
}
}
@font-face {
font-family: "iranyekan";
font-style: normal;
font-weight: bold;
src: url(../assets/fonts/eot/iranyekanwebboldfanum.eot);
src: url(../assets/fonts/eot/iranyekanwebboldfanum.eot?#iefix)
format("embedded-opentype"),
/* IE6-8 */ url(../assets/fonts/woff/iranyekanwebboldfanum.woff) format("woff"),
/* FF3.6+, IE9, Chrome6+, Saf5.1+*/
url(../assets/fonts/ttf/iranyekanwebboldfanum.ttf) format("truetype");
}
@font-face {
font-family: "iranyekan";
font-style: normal;
font-weight: 100;
src: url(../assets/fonts/eot/iranyekanwebthinfanum.eot);
src: url(../assets/fonts/eot/iranyekanwebthinfanum.eot?#iefix)
format("embedded-opentype"),
/* IE6-8 */ url(../assets/fonts/woff/iranyekanwebthinfanum.woff) format("woff"),
/* FF3.6+, IE9, Chrome6+, Saf5.1+*/
url(../assets/fonts/ttf/iranyekanwebthinfanum.ttf) format("truetype");
}
@font-face {
font-family: "iranyekan";
font-style: normal;
font-weight: 300;
src: url(../assets/fonts/eot/iranyekanweblightfanum.eot);
src: url(../assets/fonts/eot/iranyekanweblightfanum.eot?#iefix)
format("embedded-opentype"),
/* IE6-8 */ url(../assets/fonts/woff/iranyekanweblightfanum.woff) format("woff"),
/* FF3.6+, IE9, Chrome6+, Saf5.1+*/
url(../assets/fonts/ttf/iranyekanweblightfanum.ttf) format("truetype");
}
@font-face {
font-family: "iranyekan";
font-style: normal;
font-weight: normal;
src: url(/fonts/eot/iranyekanwebregularfanum.eot);
src: url(/fonts/eot/iranyekanwebregularfanum.eot?#iefix)
format("embedded-opentype"),
/* IE6-8 */ url(/fonts/woff/iranyekanwebregularfanum.woff)
format("woff"),
/* FF3.6+, IE9, Chrome6+, Saf5.1+*/
url(/fonts/ttf/iranyekanwebregularfanum.ttf) format("truetype");
}
@font-face {
font-family: "iranyekan";
font-style: normal;
font-weight: 500;
src: url(/fonts/eot/iranyekanwebmediumfanum.eot);
src: url(/fonts/eot/iranyekanwebmediumfanum.eot?#iefix)
format("embedded-opentype"),
/* IE6-8 */ url(/fonts/woff/iranyekanwebmediumfanum.woff) format("woff"),
/* FF3.6+, IE9, Chrome6+, Saf5.1+*/
url(/fonts/ttf/iranyekanwebmediumfanum.ttf) format("truetype");
}
@font-face {
font-family: "iranyekan";
font-style: normal;
font-weight: 800;
src: url(../assets/fonts/eot/iranyekanwebextraboldfanum.eot);
src: url(../assets/fonts/eot/iranyekanwebextraboldfanum.eot?#iefix)
format("embedded-opentype"),
/* IE6-8 */ url(../assets/fonts/woff/iranyekanwebextraboldfanum.woff)
format("woff"),
/* FF3.6+, IE9, Chrome6+, Saf5.1+*/
url(../assets/fonts/ttf/iranyekanwebextraboldfanum.ttf) format("truetype");
}
@font-face {
font-family: "iranyekan";
font-style: normal;
font-weight: 850;
src: url(../assets/fonts/eot/iranyekanwebblackfanum.eot);
src: url(../assets/fonts/eot/iranyekanwebblackfanum.eot?#iefix)
format("embedded-opentype"),
/* IE6-8 */ url(../assets/fonts/woff/iranyekanwebblackfanum.woff) format("woff"),
/* FF3.6+, IE9, Chrome6+, Saf5.1+*/
url(../assets/fonts/ttf/iranyekanwebblackfanum.ttf) format("truetype");
}
@font-face {
font-family: "iranyekan";
font-style: normal;
font-weight: 900;
src: url(../assets/fonts/eot/iranyekanwebextrablackfanum.eot);
src: url(../assets/fonts/eot/iranyekanwebextrablackfanum.eot?#iefix)
format("embedded-opentype"),
/* IE6-8 */ url(../assets/fonts/woff/iranyekanwebextrablackfanum.woff)
format("woff"),
/* FF3.6+, IE9, Chrome6+, Saf5.1+*/
url(../assets/fonts/ttf/iranyekanwebextrablackfanum.ttf) format("truetype");
src: url(../assets/fonts/ttf/iranyekanwebregularfanum.ttf);
}

View File

@ -4,19 +4,21 @@ import { GoArrowLeft } from "react-icons/go";
import { menuItems } from "@/constants";
import Link from "next/link";
import { cn } from "@/lib/utils";
import { usePathname } from "next/navigation";
const SideMenu = () => {
const [open, setOpen] = useState(false);
const pathname = usePathname();
return (
<div
className={` flex flex-col items-start justify-start bg-gradient-to-b from-yellow to-orange-400 h-screen rounded-l-[30px] fixed right-0 top-0 transition-all duration-700 ease-in-out
${open === true ? "w-[200px]" : "w-[70px]"} `}
${open === true ? "w-[70px]" : "w-[200px]"} `}
>
<div
onClick={() => setOpen(!open)}
className={`flex items-center aspect-square bg-white rounded-full shadow-[0_0_4px_1px_rgba(0,0,0,0.1)] text-yellow cursor-pointer h-8 w-8 justify-center -left-3 absolute top-5 transition-all duration-700 ease-in-out z-[400]
${open === true ? "rotate-180" : "rotate-0"} `}
${open === true ? "rotate-0" : "rotate-180"} `}
>
<GoArrowLeft className="text-yellow" />
</div>
@ -31,7 +33,7 @@ const SideMenu = () => {
<div
className={cn(
"w-10 h-10 aspect-square rounded-md flex items-center justify-center transition-all duration-[0.3s]",
menuItem.id == 1 && "bg-black/30"
pathname == menuItem.href && "bg-black/30"
)}
>
<span className="w-1/2 h-1/2 aspect-square flex items-center justify-center text-white transition-all duration-[0.3s] text-lg">
@ -40,10 +42,10 @@ const SideMenu = () => {
</div>
<span
className={cn(
`text-xs text-white mr-1 transition-all overflow-hidden font-bold`,
menuItem.id == 1 && "text-black/70 text-[13px]",
`text-xs text-white mr-1 overflow-hidden font-bold transition-all duration-1000 ease-in-out`,
pathname == menuItem.href && "text-black/70 text-[13px]",
menuItem.id == 2 && "font-extrabold",
open === true ? "w-auto opacity-100 " : "w-0 opacity-0"
open === true ? "w-0 opacity-0" : "w-auto opacity-100 "
)}
>
{menuItem.title}

View File

@ -2,22 +2,31 @@ import React from "react";
import OnMapRequests from "./OnMapRequests";
import AllRequests from "./AllRequests";
import NearestRequests from "./NearestRequests";
import UserContainer from "../User/UserContainer";
// import UserContainer from "../User/UserContainer";
function RecentRequests() {
return (
<>
<UserContainer />
<section className="w-full flex flex-1 flex-row overflow-hidden bg-white p-[10px]">
{/* Left */}
<div className="">
<div id="map" aria-label="نقشه">
<OnMapRequests />
</div>
</div>
{/* Right */}
<div className="">
<div id="all" aria-label="همه">
<AllRequests />
</div>
<div id="nearest" aria-label="نزدیکترین‌ها">
<NearestRequests />
</div>
<div id="map" aria-label="نقشه">
<OnMapRequests />
</div>
</>
</section>
);
}

View File

@ -56,7 +56,7 @@ function LoginForm() {
} = useQuery({
queryKey: ["Captcha"],
queryFn: () => getCaptcha(),
refetchOnWindowFocus: false,
// refetchOnWindowFocus: false,
});
const loginMutation = useMutation({
@ -112,7 +112,7 @@ function LoginForm() {
return (
<>
<Form {...form}>
<form onSubmit={form.handleSubmit(onSubmit)} className="w-1/2">
<form onSubmit={form.handleSubmit(onSubmit)} className=" w-3/4 md:w-1/2">
{/* Phone Number */}
<FormField
control={form.control}
@ -175,14 +175,14 @@ function LoginForm() {
height={20}
quality={100}
/>
</div>
)}
<RefreshCcw
className="cursor-pointer "
className="cursor-pointer h-10 mr-2"
onClick={() => refetch()}
color="#fcc52d"
/>
</div>
)}
</div>
<Button
type="submit"
@ -207,7 +207,7 @@ function LoginForm() {
</form>
</Form>
<Link href={"#"} className="mt-6 underline text-[16px]">
<Link href={"#"} className="mt-6 underline text-xs md:text-[16px]">
ورود با یزد من{" "}
</Link>
</>

View File

@ -1,18 +1,40 @@
"use client";
import React from "react";
import LoginForm from "./LoginForm";
import { YellowSection } from "./YellowSection";
import { FaChevronLeft } from "react-icons/fa";
import { useRouter } from "next/navigation";
import { motion } from "framer-motion";
function SignIn() {
const router = useRouter();
return (
<section className="bg-yellow flex h-screen w-full items-stretch justify-center overflow-y-hidden">
<section className="bg-white md:bg-yellow flex flex-col-reverse md:flex-row h-screen w-full items-stretch justify-center overflow-y-hidden">
<FaChevronLeft
className="cursor-pointer z-10 flex md:hidden absolute top-2 left-2"
onClick={() => router.refresh()}
/>
{/* Right Section */}
<div className="flex flex-1 items-center justify-center flex-col bg-white rounded-tl-[50px]">
<div className="flex flex-1 items-center justify-center flex-col bg-white md:rounded-tl-[50px]">
<LoginForm />
</div>
{/* Left Section */}
<div className="max-md:flex max-md:flex-col md:hidden">
<motion.div
initial={{ y: 100, visibility: "hidden", opacity: 0 }} // Initial position above the viewport
animate={{ y: 0, visibility: "visible", opacity: 1 }} // Animate to the default position
transition={{ type: "spring", damping: 10, stiffness: 100 }} // Define transition animation
>
<YellowSection />
</motion.div>
</div>
<div className="md:flex w-[30%] hidden">
<YellowSection />
</div>
</section>
);
}

View File

@ -1,5 +1,5 @@
import Image from 'next/image'
import React from 'react'
import Image from "next/image";
import React from "react";
import img1 from "@/assets/images/auth_image_1.png";
import img2 from "@/assets/images/auth_image_6.png";
import img3 from "@/assets/images/auth_image_4.png";
@ -7,12 +7,10 @@ import pishgaman from "@/assets/images/goroh-pishgaman-logo.png";
import shetab from "@/assets/images/shetab-logo.png";
import ostandari from "@/assets/images/ostandari2.png";
export const YellowSection = () => {
return (
<div className="w-[30%] flex flex-col relative pt-10 z-0 h-screen items-center">
<div className="flex flex-1 flex-col items-center justify-start w-full">
<div className="w-full flex flex-col justify-end relative md:pt-10 z-0 h-52 md:h-screen items-center max-sm:[clip-path:ellipse(60%_80%_at_50%_7%)] max-md:[clip-path:ellipse(55%_80%_at_50%_10%)] max-md:bg-yellow ">
<div className="hidden md:flex flex-1 flex-col items-center justify-start w-full">
<Image
src={img1}
width={500}
@ -63,8 +61,8 @@ export const YellowSection = () => {
height={500}
quality={100}
alt="img6"
className="w-full m-0 max-h-[200px]"
className="w-full 2sm:w-5/6 sm:w-2/3 md:w-full m-0 max-h-[200px] max-md:h-fit max-sm:[clip-path:ellipse(60%_80%_at_50%_10%)] max-md:[clip-path:ellipse(70%_80%_at_50%_10%)] mb-4 2sm:-mb-0 md:mb-0"
/>
</div>
)
}
);
};

View File

@ -5,8 +5,7 @@ import SideMenu from '../Menu/SideMenu'
const UserContainerDesktop = () => {
return (
<div>
{/* <UserHeader /> */}
<SideMenu />
UseContainer
</div>
)
}

View File

@ -1,12 +1,52 @@
import React from 'react'
"use client";
import React, { useState } from "react";
import { usePathname } from "next/navigation";
import { menuItems } from "@/constants";
import { FaRegBell } from "react-icons/fa";
import { FaRegUser } from "react-icons/fa";
// w-[calc(100%-208px)]
const UserHeader = () => {
return (
<div className='bg-lime-400 flex flex-row justify-between items-center w-[calc(100%-208px)] fixed top-0 left-0'>
<div className=''>Section 1</div>
<div className=''>Section 2</div>
</div>
)
}
const pathname = usePathname();
const [isMenupage, setIsMenuPage] = useState();
export default UserHeader
// {menuItems.map((menuItem) => (
// pathname === menuItem.href
// // setIsMenuPage(menuItem.title)
// ))}
return (
<div className="flex flex-row justify-between items-center fixed top-0 left-0 z-[200] transition-all p-[10px] w-[calc(100%-208px)]">
<div className="flex items-center">
<p className="cursor-pointer text-sm font-bold shadow-[0_0_3px_rgba(0,0,0,0.1)] m-0 flex items-center">
{pathname}
</p>
</div>
<div className="flex items-center">
{/* Card 1 */}
<div className="h-10 mx-1 cursor-pointer bg-gray-200 rounded-3xl px-3 pt-0 flex items-center justify-center relative">
<FaRegBell className="text-lg" />
</div>
{/* Card 2 */}
<div className="h-10 mx-1 cursor-pointer bg-gray-200 rounded-3xl px-3 pt-0 flex items-center justify-center relative">
<span className="flex items-center justify-center">
<div className="flex items-center justify-center relative bg-gray-100 rounded-full w-6 h-6">
<FaRegUser className="text-gray-200 w-1/2 h-1/2 " />
</div>
<span className="text-xs font-bold opacity-100 transition-all mr-[5px]">Yasaman</span>
</span>
</div>
</div>
</div>
);
};
export default UserHeader;

View File

@ -1,26 +1,47 @@
"use client"
import React from 'react'
import { YellowSection } from '../SignIn/YellowSection'
import { VerifyInput } from './VerifyInput'
import { Phone } from 'lucide-react';
import useData from "@/store/useData";
"use client";
import React from "react";
import { YellowSection } from "../SignIn/YellowSection";
import { VerifyInput } from "./VerifyInput";
import { FaChevronLeft } from "react-icons/fa";
import { useRouter } from "next/navigation";
import { motion } from "framer-motion";
// import { Phone } from 'lucide-react';
// import useData from "@/store/useData";
const Verify = () => {
const data = useData((state) => state.data);
console.log(data);
const router = useRouter();
// const data = useData((state) => state.data);
// console.log(data);
return (
<section className="bg-yellow flex h-screen w-full items-stretch justify-center overflow-y-hidden">
<section className="bg-white md:bg-yellow flex flex-col-reverse md:flex-row h-screen w-full items-stretch justify-center overflow-y-hidden">
<FaChevronLeft
className="z-10 flex md:hidden absolute top-2 left-2 cursor-pointer"
onClick={() => router.back()}
/>
{/* Right Section */}
<div className="flex flex-1 items-center justify-center flex-col bg-white rounded-tl-[50px]">
<div className="flex flex-1 items-center justify-start md:justify-center flex-col bg-white rounded-tl-[50px]">
<VerifyInput />
</div>
{/* Left Section */}
<div className="max-md:flex max-md:flex-col md:hidden">
<motion.div
initial={{ y: 100, visibility: "hidden", opacity: 0 }} // Initial position above the viewport
animate={{ y: 0, visibility: "visible", opacity: 1 }} // Animate to the default position
transition={{ type: "spring", damping: 10, stiffness: 100 }} // Define transition animation
>
<YellowSection />
</section>
)
}
</motion.div>
</div>
export default Verify
<div className="md:flex w-[30%] hidden">
<YellowSection />
</div>
</section>
);
};
export default Verify;

View File

@ -196,7 +196,7 @@ export const VerifyInput = () => {
</div>
)}
<p className="text-lg color-black text-center font-bold">
<p className="text-sm md:text-lg color-black text-center font-bold">
کد تایید ارسالی به تلفن خود را وارد نمایید.
</p>
@ -210,7 +210,7 @@ export const VerifyInput = () => {
<input autoFocus={idx == 0} pattern="[0-9]*" {...props} />
)}
containerStyle=" flex justify-center gap-1"
inputStyle=" !w-12 rounded-full h-12 bg-[#F5F5F5] border border-blue/30 text-black"
inputStyle="!w-10 h-10 md:!w-12 md:h-12 rounded-full bg-[#F5F5F5] border border-blue/30 text-black"
/>
</div>
@ -224,7 +224,7 @@ export const VerifyInput = () => {
{!isShow && (
<p
onClick={handelResendOtp}
className=" text-blue text-sm font-semibold cursor-pointer"
className=" text-blue text-xs md:text-sm font-semibold cursor-pointer"
>
ارسال مجدد کد تایید
</p>

View File

@ -6,7 +6,7 @@ import { TbWorld } from "react-icons/tb";
import { FaCogs } from "react-icons/fa";
export const menuItems = [
{ id: 1, title: "صفحه اصلی", href: "/", icon: <FaList/>},
{ id: 1, title: "صفحه اصلی", href: "/RecentRequest", icon: <FaList/>},
{ id: 2, title: "ثبت درخواست", href: "/", icon: <FaPlus /> },
{ id: 3, title: "درخواست های من", href: "/", icon: <PiSquaresFourFill /> },
{ id: 4, title: "نظرسنجی ها ", href: "/", icon: <FaChartBar /> },

25
package-lock.json generated
View File

@ -18,6 +18,7 @@
"class-variance-authority": "^0.7.0",
"clsx": "^2.1.0",
"cookies-next": "^4.1.1",
"framer-motion": "^11.1.7",
"jwt-decode": "^4.0.0",
"lucide-react": "^0.365.0",
"next": "14.1.4",
@ -2704,6 +2705,30 @@
"url": "https://github.com/sponsors/rawify"
}
},
"node_modules/framer-motion": {
"version": "11.1.7",
"resolved": "https://registry.npmjs.org/framer-motion/-/framer-motion-11.1.7.tgz",
"integrity": "sha512-cW11Pu53eDAXUEhv5hEiWuIXWhfkbV32PlgVISn7jRdcAiVrJ1S03YQQ0/DzoswGYYwKi4qYmHHjCzAH52eSdQ==",
"dependencies": {
"tslib": "^2.4.0"
},
"peerDependencies": {
"@emotion/is-prop-valid": "*",
"react": "^18.0.0",
"react-dom": "^18.0.0"
},
"peerDependenciesMeta": {
"@emotion/is-prop-valid": {
"optional": true
},
"react": {
"optional": true
},
"react-dom": {
"optional": true
}
}
},
"node_modules/fs.realpath": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",

View File

@ -19,6 +19,7 @@
"class-variance-authority": "^0.7.0",
"clsx": "^2.1.0",
"cookies-next": "^4.1.1",
"framer-motion": "^11.1.7",
"jwt-decode": "^4.0.0",
"lucide-react": "^0.365.0",
"next": "14.1.4",

View File

@ -1,12 +1,12 @@
import type { Config } from "tailwindcss"
import type { Config } from "tailwindcss";
const config = {
darkMode: ["class"],
content: [
'./pages/**/*.{ts,tsx}',
'./components/**/*.{ts,tsx}',
'./app/**/*.{ts,tsx}',
'./src/**/*.{ts,tsx}',
"./pages/**/*.{ts,tsx}",
"./components/**/*.{ts,tsx}",
"./app/**/*.{ts,tsx}",
"./src/**/*.{ts,tsx}",
"./pages/**/*.{js,ts,jsx,tsx,mdx}",
"./components/**/*.{js,ts,jsx,tsx,mdx}",
@ -23,6 +23,9 @@ const config = {
// },
// },
extend: {
screens: {
"2sm": "426px",
},
colors: {
gradient1: "#E44D26",
yellow: "#fcc52d",
@ -86,6 +89,6 @@ const config = {
},
},
plugins: [require("tailwindcss-animate")],
} satisfies Config
} satisfies Config;
export default config
export default config;