From 89a95ea36b522e050169492e441f5a35a70834ce Mon Sep 17 00:00:00 2001 From: Melnyk Mykhailo <91133955+dEdmishka@users.noreply.github.com> Date: Mon, 5 Feb 2024 15:18:25 +0200 Subject: [PATCH] Auth responsive layout (#104) * extend small screen width classes tailwind * add messages icon * fix reduce pr for two points * fix prettier code refactor in content comp * add new styles to auth-content * fix styles for otp-control comp * add new styles for profile-form comp * fix styles for auth-form comp * complete adaptive layout for main auth pages * add cspell auto-fill command * fix verysmall screen size from 320 to 360px * fix adaptive styles * remove danger style property aka star code * fix auth page margins * fix remove z-5 from input * fix margins and paddings to fit design for auth pages * fix pointer event set to none for input span and absolute error position for form label * remove unused auth classes * fix auth padding and margins with style mistakes * remove usused cn import in auth-from * move themetoggler to auth-content * remove usused themetoggler from auth forms * tiny fixes about usused auth classes and dark bg for content comp --- package.json | 3 ++- src/app/auth/page.tsx | 22 ++++++++-------- src/app/profile/page.tsx | 25 ++++++++++--------- src/app/verification/page.tsx | 25 +++++++++++-------- src/components/pages/auth-content.tsx | 10 +++++--- src/components/pages/auth/auth-form.tsx | 18 +++++++------ src/components/pages/profile/profile-form.tsx | 11 +++++--- .../pages/verification/otp-control.tsx | 10 ++++---- .../pages/verification/otp-input.tsx | 2 +- src/components/ui/content.tsx | 6 ++++- src/components/ui/form.tsx | 3 ++- src/components/ui/icons.tsx | 21 ++++++++++++++++ src/components/ui/image-card.tsx | 2 +- src/components/ui/input.tsx | 6 ++--- tailwind.config.ts | 7 ++++++ 15 files changed, 108 insertions(+), 63 deletions(-) diff --git a/package.json b/package.json index b0556e6..c0ccf97 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,8 @@ "typescript:check": "tsc -p tsconfig.json", "env:local": "cp .env.local.dist .env.local", "prepare": "husky install", - "cspell": "cspell --show-suggestions --show-context --gitignore ." + "cspell": "cspell --show-suggestions --show-context --gitignore .", + "cspell:apply": "cspell --words-only --unique --gitignore . >> project-words.txt" }, "dependencies": { "@hookform/resolvers": "^3.3.4", diff --git a/src/app/auth/page.tsx b/src/app/auth/page.tsx index 9b5bab0..a40b23b 100644 --- a/src/app/auth/page.tsx +++ b/src/app/auth/page.tsx @@ -2,21 +2,21 @@ import AuthForm from '@/components/pages/auth/auth-form' import AuthContent from '@/components/pages/auth-content' import { Icons } from '@/components/ui/icons' import ImageCard from '@/components/ui/image-card' -import { ThemeToggler } from '@/components/ui/theme-toggler' export default function Auth() { return ( - - - - - - Authentication - - - - + + + + + + + Authentication + + + + ) } diff --git a/src/app/profile/page.tsx b/src/app/profile/page.tsx index 519400c..71525c1 100644 --- a/src/app/profile/page.tsx +++ b/src/app/profile/page.tsx @@ -2,21 +2,22 @@ import AuthContent from '@/components/pages/auth-content' import FileInput from '@/components/pages/profile/file-input' import ProfileForm from '@/components/pages/profile/profile-form' import ImageCard from '@/components/ui/image-card' -import { ThemeToggler } from '@/components/ui/theme-toggler' export default function Profile() { return ( - - - - - - - Profile - - - - + + + Profile + + + + + + Profile + + + + ) } diff --git a/src/app/verification/page.tsx b/src/app/verification/page.tsx index 595f501..ef44c65 100644 --- a/src/app/verification/page.tsx +++ b/src/app/verification/page.tsx @@ -2,21 +2,24 @@ import AuthContent from '@/components/pages/auth-content' import OtpControl from '@/components/pages/verification/otp-control' import { Icons } from '@/components/ui/icons' import ImageCard from '@/components/ui/image-card' -import { ThemeToggler } from '@/components/ui/theme-toggler' export default function Verification() { return ( - - - - - - Check your Email - - - - + + + + + + + + + + Check your Email + + + + ) } diff --git a/src/components/pages/auth-content.tsx b/src/components/pages/auth-content.tsx index be7b665..a8495af 100644 --- a/src/components/pages/auth-content.tsx +++ b/src/components/pages/auth-content.tsx @@ -1,4 +1,5 @@ import Content from '@/components/ui/content' +import { ThemeToggler } from '@/components/ui/theme-toggler' import { cn } from '@/lib/utils' import { FC, ReactNode } from 'react' @@ -10,10 +11,11 @@ type AuthContentProps = { const AuthContent: FC = ({ children, className }) => { return ( - - - {children} - + + {children} + + + ) diff --git a/src/components/pages/auth/auth-form.tsx b/src/components/pages/auth/auth-form.tsx index 57fee4d..8ad8780 100644 --- a/src/components/pages/auth/auth-form.tsx +++ b/src/components/pages/auth/auth-form.tsx @@ -11,7 +11,6 @@ import { FormMessage, } from '@/components/ui/form' import { Input } from '@/components/ui/input' -import { cn } from '@/lib/utils' import { zodResolver } from '@hookform/resolvers/zod' import { FC } from 'react' import { useForm } from 'react-hook-form' @@ -40,10 +39,7 @@ const AuthForm: FC = ({ className }) => { return ( - + = ({ className }) => { Confirm your email and get dynamically generated code - + @@ -63,7 +65,7 @@ const AuthForm: FC = ({ className }) => { control={form.control} name="agreement" render={({ field }) => ( - + = ({ className }) => { )} /> - + Submit diff --git a/src/components/pages/profile/profile-form.tsx b/src/components/pages/profile/profile-form.tsx index 899b6a8..35896e1 100644 --- a/src/components/pages/profile/profile-form.tsx +++ b/src/components/pages/profile/profile-form.tsx @@ -40,7 +40,10 @@ const ProfileForm: FC = ({ className }) => { return ( = ({ className }) => { = ({ className }) => { )} /> - - Submit + + Done diff --git a/src/components/pages/verification/otp-control.tsx b/src/components/pages/verification/otp-control.tsx index b7a40a9..294b849 100644 --- a/src/components/pages/verification/otp-control.tsx +++ b/src/components/pages/verification/otp-control.tsx @@ -33,10 +33,10 @@ const OtpControl: FC = ({ className }) => { } return ( - + @@ -45,17 +45,17 @@ const OtpControl: FC = ({ className }) => { : 'Paste dynamically generated code'} - + Didn't get anything? Resend me code. = ({ = ({ children, className }) => { - return {children} + return ( + + {children} + + ) } export default Content diff --git a/src/components/ui/form.tsx b/src/components/ui/form.tsx index 80a1249..5a50cd4 100644 --- a/src/components/ui/form.tsx +++ b/src/components/ui/form.tsx @@ -114,6 +114,7 @@ const FormControl = React.forwardRef< : `${formDescriptionId} ${formMessageId}` } aria-invalid={!!error} + className="relative" id={formItemId} ref={ref} {...props} @@ -152,7 +153,7 @@ const FormMessage = React.forwardRef< return ( ), + messages: (props: IconProps) => { + return ( + + + + + ) + }, mingcute_camera: (props: IconProps) => ( = ({ children, className }) => { return ( diff --git a/src/components/ui/input.tsx b/src/components/ui/input.tsx index 17e3977..cd7d191 100644 --- a/src/components/ui/input.tsx +++ b/src/components/ui/input.tsx @@ -12,7 +12,7 @@ const Input = React.forwardRef( ( type={type} {...props} /> - + {placeholder} ) : (
@@ -45,17 +45,17 @@ const OtpControl: FC = ({ className }) => { : 'Paste dynamically generated code'}