Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auth responsive layout #104

Merged
merged 23 commits into from
Feb 5, 2024
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
9a87d63
extend small screen width classes tailwind
dEdmishka Feb 2, 2024
9950dd8
add messages icon
dEdmishka Feb 2, 2024
ad3e7a4
fix reduce pr for two points
dEdmishka Feb 2, 2024
019ee09
fix prettier code refactor in content comp
dEdmishka Feb 2, 2024
4b4665a
add new styles to auth-content
dEdmishka Feb 2, 2024
241324d
fix styles for otp-control comp
dEdmishka Feb 2, 2024
baae021
add new styles for profile-form comp
dEdmishka Feb 2, 2024
43901ca
fix styles for auth-form comp
dEdmishka Feb 2, 2024
aedd02c
complete adaptive layout for main auth pages
dEdmishka Feb 2, 2024
2e18533
add cspell auto-fill command
dEdmishka Feb 2, 2024
1dff0f0
fix verysmall screen size from 320 to 360px
dEdmishka Feb 3, 2024
1c4855b
fix adaptive styles
dEdmishka Feb 3, 2024
4b79bca
remove danger style property aka star code
dEdmishka Feb 3, 2024
bca60a2
fix auth page margins
dEdmishka Feb 3, 2024
1d8c592
fix remove z-5 from input
dEdmishka Feb 3, 2024
1b2f77a
fix margins and paddings to fit design for auth pages
dEdmishka Feb 3, 2024
efe00ff
fix pointer event set to none for input span and absolute error posit…
dEdmishka Feb 4, 2024
1a1f832
remove unused auth classes
dEdmishka Feb 4, 2024
5153821
fix auth padding and margins with style mistakes
dEdmishka Feb 4, 2024
ed186ab
remove usused cn import in auth-from
dEdmishka Feb 4, 2024
159969d
move themetoggler to auth-content
dEdmishka Feb 5, 2024
71aa3e0
remove usused themetoggler from auth forms
dEdmishka Feb 5, 2024
b9355ab
tiny fixes about usused auth classes and dark bg for content comp
dEdmishka Feb 5, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
12 changes: 7 additions & 5 deletions src/app/auth/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,18 @@ import { ThemeToggler } from '@/components/ui/theme-toggler'

export default function Auth() {
return (
<AuthContent>
<ImageCard className="-my-[4.375rem] hidden sm:flex">
<AuthContent className="auth-page">
dEdmishka marked this conversation as resolved.
Show resolved Hide resolved
dEdmishka marked this conversation as resolved.
Show resolved Hide resolved
<ImageCard className="-my-[4.375rem] hidden md:flex">
<Icons.golub />
</ImageCard>
<article>
<header className="flex justify-between pb-2">
<header className="flex justify-between">
<h1 className="title-lg">Authentication</h1>
<ThemeToggler />
<div className="hidden md:block">
<ThemeToggler />
</div>
</header>
<AuthForm className="mt-5" />
<AuthForm className="mt-8 md:mt-5" />
</article>
</AuthContent>
)
Expand Down
34 changes: 34 additions & 0 deletions src/app/globals.css
dEdmishka marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -95,3 +95,37 @@
@apply text-xs uppercase;
}
}

.auth-page section {
padding-top: 9rem;
padding-bottom: 9rem;
}

@media (min-width: theme('screens.md')) {
.auth-page section {
padding-top: 2.5rem;
padding-bottom: 2.5rem;
}
}

.profile-page section {
flex-direction: column;
flex-grow: 1;
}

@media (min-width: theme('screens.md')) {
.profile-page section {
flex-direction: row;
flex-grow: 0;
}
}

.verification-page section {
flex-direction: column;
}

@media (min-width: theme('screens.md')) {
.verification-page section {
flex-direction: row;
}
}
17 changes: 11 additions & 6 deletions src/app/profile/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,21 @@ import { ThemeToggler } from '@/components/ui/theme-toggler'

export default function Profile() {
return (
<AuthContent>
<ImageCard className="-my-[4.375rem] hidden sm:flex py-32 px-[3.25rem]">
<AuthContent className="profile-page bg-white md:bg-gradient-blue-white">
dEdmishka marked this conversation as resolved.
Show resolved Hide resolved
<h3 className="text-lg font-medium text-center py-[0.4375rem] md:hidden">
Profile
</h3>
dEdmishka marked this conversation as resolved.
Show resolved Hide resolved
<ImageCard className="p-0 bg-none -mt-3 md:mt-0 md:-my-[4.375rem] md:py-32 md:px-[3.25rem] md:bg-gradient-purple-blue">
<FileInput />
</ImageCard>
<article>
<header className="flex justify-between pb-2 mt-8">
<article className="flex justify-center md:block">
<header className="hidden justify-between pb-2 mt-8 md:flex">
dEdmishka marked this conversation as resolved.
Show resolved Hide resolved
<h1 className="title-lg">Profile</h1>
<ThemeToggler />
<div className="hidden md:block">
<ThemeToggler />
</div>
</header>
<ProfileForm className="mt-5" />
<ProfileForm className="grow mt-[2.1875rem] md:mt-5" />
dEdmishka marked this conversation as resolved.
Show resolved Hide resolved
</article>
</AuthContent>
)
Expand Down
15 changes: 10 additions & 5 deletions src/app/verification/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,21 @@ import { ThemeToggler } from '@/components/ui/theme-toggler'

export default function Verification() {
return (
<AuthContent>
<ImageCard className="-my-[4.375rem] hidden sm:flex">
<AuthContent className="verification-page">
dEdmishka marked this conversation as resolved.
Show resolved Hide resolved
dEdmishka marked this conversation as resolved.
Show resolved Hide resolved
<ImageCard className="bg-none px-0 pb-[0.25rem] pt-[2.75rem] md:hidden">
dEdmishka marked this conversation as resolved.
Show resolved Hide resolved
<Icons.messages />
</ImageCard>
<ImageCard className="-my-[4.375rem] hidden md:flex">
<Icons.golub />
</ImageCard>
<article>
<header className="flex justify-between items-center">
<header className="flex justify-center items-center md:justify-between">
<h1 className="title-lg">Check your Email</h1>
<ThemeToggler />
<div className="hidden md:block">
<ThemeToggler />
</div>
</header>
<OtpControl className="mt-5" />
<OtpControl />
</article>
</AuthContent>
)
Expand Down
4 changes: 2 additions & 2 deletions src/components/pages/auth-content.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ type AuthContentProps = {
const AuthContent: FC<AuthContentProps> = ({ children, className }) => {
return (
<div className={cn('h-screen w-screen bg-gradient-blue-white', className)}>
<Content className="flex items-center justify-center dark:bg-none dark:bg-base-gray-8">
<section className="p-7 sm:p-10 flex gap-7 md:gap-[3.75rem] rounded-3xl bg-base-white dark:bg-base-black">
<Content className="flex items-start justify-center dark:bg-none dark:bg-base-gray-8 md:items-center">
dEdmishka marked this conversation as resolved.
Show resolved Hide resolved
<section className="justify-center pb-7 px-0 pt-11 flex gap-7 rounded-3xl md:dark:bg-base-black md:pt-7 md:px-7 md:bg-base-white md:gap-[1.75rem] lg:gap-16">
{children}
</section>
dEdmishka marked this conversation as resolved.
Show resolved Hide resolved
</Content>
Expand Down
19 changes: 14 additions & 5 deletions src/components/pages/auth/auth-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,20 @@ const AuthForm: FC<FormAuthProps> = ({ className }) => {
name="email"
render={({ field }) => (
<FormItem>
<FormLabel htmlFor="email">
<FormLabel
className="block h-[2.75rem] pb-1 md:pb-0 md:h-auto"
dEdmishka marked this conversation as resolved.
Show resolved Hide resolved
htmlFor="email"
>
Confirm your email and get dynamically generated code
</FormLabel>
<FormControl>
<Input id="email" placeholder="Email" type="text" {...field} />
<Input
className="bg-white md:bg-transparent"
dEdmishka marked this conversation as resolved.
Show resolved Hide resolved
id="email"
placeholder="Email"
type="text"
{...field}
/>
</FormControl>
<FormMessage />
</FormItem>
Expand All @@ -63,15 +72,15 @@ const AuthForm: FC<FormAuthProps> = ({ className }) => {
control={form.control}
name="agreement"
render={({ field }) => (
<FormItem className="flex flex-row items-start space-x-3">
<FormItem className="flex flex-row items-start space-x-3 pt-[1.75rem] md:pt-0">
dEdmishka marked this conversation as resolved.
Show resolved Hide resolved
<FormControl>
<Checkbox
checked={field.value}
id="agreement"
onCheckedChange={field.onChange}
/>
</FormControl>
<div className="!mt-0">
<div className="!mt-0 h-[2.5rem] md:h-auto">
dEdmishka marked this conversation as resolved.
Show resolved Hide resolved
<FormLabel htmlFor="agreement">
I agree to Terms & Conditions and Privacy Policy
</FormLabel>
Expand All @@ -80,7 +89,7 @@ const AuthForm: FC<FormAuthProps> = ({ className }) => {
</FormItem>
)}
/>
<Button className="!mt-3 w-full" type="submit">
<Button className="!mt-8 w-full md:!mt-3" type="submit">
dEdmishka marked this conversation as resolved.
Show resolved Hide resolved
Submit
</Button>
</form>
Expand Down
11 changes: 7 additions & 4 deletions src/components/pages/profile/profile-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,10 @@ const ProfileForm: FC<FormProfileProps> = ({ className }) => {
return (
<Form {...form}>
<form
className={cn('space-y-8 pr-[9.75rem]', className)}
className={cn(
'space-y-8 xs:max-w-[343px] md:max-w-none md:pr-16 lg:pr-[9.75rem]',
dEdmishka marked this conversation as resolved.
Show resolved Hide resolved
className
)}
onSubmit={form.handleSubmit(onSubmit)}
>
<FormField
Expand All @@ -50,7 +53,7 @@ const ProfileForm: FC<FormProfileProps> = ({ className }) => {
<FormItem>
<FormControl>
<Input
className="sm:min-w-[343px]"
className="md:min-w-[343px] bg-base-gray-2 md:bg-transparent"
id="profile_name"
placeholder="Profile Name"
type="text"
Expand All @@ -61,8 +64,8 @@ const ProfileForm: FC<FormProfileProps> = ({ className }) => {
</FormItem>
)}
/>
<Button className="!mt-8 w-full" type="submit">
Submit
<Button className="!mt-[5.75rem] w-full md:!mt-8" type="submit">
dEdmishka marked this conversation as resolved.
Show resolved Hide resolved
Done
</Button>
</form>
</Form>
Expand Down
10 changes: 5 additions & 5 deletions src/components/pages/verification/otp-control.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ const OtpControl: FC<OtpControlProps> = ({ className }) => {
}

return (
<div className={cn('lg:pr-28', className)}>
<div className={cn('mt-3 md:mt-5 md:pr-14 lg:pr-28', className)}>
<p
className={cn(
'cursor-default text-base-gray-6',
'cursor-default text-base-gray-6 text-center md:text-left',
otpIsInvalid && 'text-bright-red'
)}
>
Expand All @@ -45,17 +45,17 @@ const OtpControl: FC<OtpControlProps> = ({ className }) => {
: 'Paste dynamically generated code'}
</p>
<OtpInput
className="mt-3"
className="mt-10 md:mt-3"
isError={otpIsInvalid}
length={LENGTH_OTP}
onChange={otpChange}
otpValue={otp}
/>
<button className="block mt-4 text-bright-orange">
<button className="block mt-[1.75rem] text-bright-orange w-full text-center md:text-left md:mt-4">
dEdmishka marked this conversation as resolved.
Show resolved Hide resolved
Didn&apos;t get anything? Resend me code.
</button>
<Button
className="w-full mt-3"
className="w-full mt-[2.3125rem] md:mt-3"
dEdmishka marked this conversation as resolved.
Show resolved Hide resolved
disabled={otpIncomplete}
onClick={validateOtp}
variant={otpIncomplete ? 'disabled' : 'default'}
Expand Down
2 changes: 1 addition & 1 deletion src/components/pages/verification/otp-input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ const OtpInput: FC<OtpInputProps> = ({
<Input
autoComplete="one-time-code"
className={cn(
'flex-shrink-0 max-w-[3.5rem] text-center font-title py-5 text-[1.75rem] leading-[2.125rem] focus:border-bright-blue font-medium tracking-[0.0225rem]',
'flex-shrink-0 max-w-[3.125rem] text-center font-title py-5 text-[1.75rem] leading-[2.125rem] focus:border-bright-blue font-medium tracking-[0.0225rem] vs:max-w-[3.75rem]',
isError && 'text-bright-red'
)}
inputMode="numeric"
Expand Down
6 changes: 5 additions & 1 deletion src/components/ui/content.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@ type ContentProps = {
}

const Content: FC<ContentProps> = ({ children, className }) => {
return <div className={cn('px-5 w-full h-full', className)}>{children}</div>
return (
<div className={cn('px-4 w-full h-full sm:px-5', className)}>
{children}
</div>
)
}

export default Content
21 changes: 21 additions & 0 deletions src/components/ui/icons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,27 @@ export const Icons = {
/>
</svg>
),
messages: (props: IconProps) => {
return (
<svg
fill="none"
height="66"
viewBox="0 0 66 66"
width="66"
xmlns="http://www.w3.org/2000/svg"
{...props}
>
<path
d="M0 20.7647C0 9.84896 8.83164 1 19.726 1H40.274C51.1684 1 60 9.84896 60 20.7647V23.2353C60 34.151 51.1684 43 40.274 43H19.726C8.83164 43 0 34.151 0 23.2353V20.7647Z"
fill="#7F92DC"
/>
<path
d="M33.9452 64.1149V51.7067L46.274 51.6268C57.1684 51.6268 66 42.6811 66 31.646V29.9809C66 18.9457 57.1684 10 46.274 10H25.726C14.8316 10 6 18.9457 6 29.9809V31.646C6 39.3053 10.0997 44.5851 12.1495 46.2677C17.492 51.7254 28.6849 63.0881 30.6575 65.0862C32.6301 67.0843 33.9452 65.3637 33.9452 64.1149Z"
fill="#3571CF"
/>
</svg>
)
},
mingcute_camera: (props: IconProps) => (
<svg
fill="none"
Expand Down
2 changes: 1 addition & 1 deletion src/components/ui/image-card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const ImageCard: FC<ImageCardProps> = ({ children, className }) => {
return (
<div
className={cn(
'flex-shrink-0 flex items-center justify-center rounded-3xl bg-gradient-purple-blue pt-24 pr-8 pb-36 pl-5',
'flex-shrink-0 flex items-center justify-center rounded-3xl bg-gradient-purple-blue pt-24 pr-6 pb-36 pl-5',
className
)}
>
Expand Down
4 changes: 2 additions & 2 deletions src/components/ui/input.tsx
dEdmishka marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const Input = React.forwardRef<HTMLInputElement, InputProps>(
<div className="relative">
<input
className={cn(
'relative z-[5] peer pt-5 px-4 pb-2.5 w-full outline-none rounded-2xl border border-base-gray-3 focus:border-base-gray-5 dark:border-base-gray-7 bg-transparent placeholder:opacity-0 transition-colors',
'relative peer pt-5 px-4 pb-2.5 w-full outline-none rounded-2xl border border-base-gray-3 focus:border-base-gray-5 dark:border-base-gray-7 bg-transparent placeholder:opacity-0 transition-colors',
className
)}
placeholder={placeholder}
Expand All @@ -27,7 +27,7 @@ const Input = React.forwardRef<HTMLInputElement, InputProps>(
) : (
<input
className={cn(
'relative z-[5] peer pt-5 px-4 pb-2.5 w-full outline-none rounded-2xl border border-base-gray-3 focus:border-base-gray-5 dark:border-base-gray-7 bg-transparent placeholder:opacity-0 transition-colors',
'relative peer pt-5 px-4 pb-2.5 w-full outline-none rounded-2xl border border-base-gray-3 focus:border-base-gray-5 dark:border-base-gray-7 bg-transparent placeholder:opacity-0 transition-colors',
className
)}
ref={ref}
Expand Down
7 changes: 7 additions & 0 deletions tailwind.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import type { Config } from 'tailwindcss'

import defaultTheme from 'tailwindcss/defaultTheme'

const config: Config = {
content: [
'./src/pages/**/*.{js,ts,jsx,tsx,mdx}',
Expand Down Expand Up @@ -109,6 +111,11 @@ const config: Config = {
},
},
},
screens: {
vs: '360px',
dEdmishka marked this conversation as resolved.
Show resolved Hide resolved
xs: '475px',
...defaultTheme.screens,
},
},
}
export default config
Loading