🎨 style: adjust modal theme and add wavy border on the header

This commit is contained in:
Wahyu Kurniawan 2024-03-14 21:49:13 +07:00
parent 56e9be59ad
commit 102c861617
No known key found for this signature in database
GPG Key ID: 040A1549143A8E33
2 changed files with 59 additions and 49 deletions

View File

@ -7,30 +7,40 @@ export const modalTheme = tv({
'z-modal', 'z-modal',
'fixed', 'fixed',
'inset-0', 'inset-0',
'bg-bg-base/90', 'bg-black/80',
'backdrop-blur-sm', 'backdrop-blur-sm',
'overflow-y-auto', 'overflow-y-auto',
'flex', 'flex',
'justify-center', 'justify-center',
'items-center', 'items-end',
'p-6', 'sm:items-center',
'p-0',
'sm:p-10', 'sm:p-10',
'data-[state=closed]:animate-[dialog-overlay-hide_200ms]', 'data-[state=closed]:animate-[dialog-overlay-hide_200ms]',
'data-[state=open]:animate-[dialog-overlay-show_200ms]', 'data-[state=open]:animate-[dialog-overlay-show_200ms]',
'data-[state=closed]:hidden', // Fix overlay not close when modal is closed 'data-[state=closed]:hidden', // Fix overlay not close when modal is closed
], ],
close: [ close: ['absolute', 'right-4', 'top-2', 'sm:right-6', 'sm:top-3', 'z-[1]'],
'absolute', header: [
'right-6', 'flex',
'top-5', 'flex-col',
'sm:right-10', 'gap-4',
'sm:top-[38px]', 'items-start',
'z-[1]', 'px-4',
'py-4',
'sm:px-6',
'sm:py-5',
'bg-base-bg-alternate',
], ],
header: ['flex', 'flex-col', 'gap-2', 'items-start', 'px-6', 'sm:px-10'], headerTitle: [
headerTitle: ['text-lg', 'sm:text-xl', 'text-text-em-high'], 'text-base',
headerDescription: ['text-sm', 'text-text-em-low'], 'sm:text-lg',
footer: ['flex', 'justify-end', 'gap-3', 'sm:gap-4', 'px-6', 'sm:px-10'], 'tracking-[0.011em]',
'sm:tracking-normal',
'text-elements-high-em',
],
headerDescription: ['text-sm', 'text-elements-low-em'],
footer: ['flex', 'gap-3', 'px-4', 'pb-4', 'pt-7', 'sm:pb-6', 'sm:px-6'],
content: [ content: [
'h-fit', 'h-fit',
'sm:min-h-0', 'sm:min-h-0',
@ -38,19 +48,15 @@ export const modalTheme = tv({
'relative', 'relative',
'flex', 'flex',
'flex-col', 'flex-col',
'gap-y-8',
'py-6',
'sm:py-10',
'overflow-hidden', 'overflow-hidden',
'w-full', 'w-full',
'max-w-[560px]', 'sm:max-w-[562px]',
'rounded-xl', 'rounded-2xl',
'bg-surface-base', 'bg-base-bg',
'border', 'shadow-card',
'border-border-base', 'text-elements-high-em',
'text-text-em-high',
], ],
body: ['flex-1', 'px-6', 'sm:px-10'], body: ['flex-1', 'px-4', 'pt-4', 'sm:pt-6', 'sm:px-6'],
}, },
variants: { variants: {
fullPage: { fullPage: {

View File

@ -4,6 +4,7 @@ import { Description, Title } from '@radix-ui/react-dialog';
import type { ComponentPropsWithoutRef, PropsWithChildren } from 'react'; import type { ComponentPropsWithoutRef, PropsWithChildren } from 'react';
import { Heading } from 'components/shared/Heading'; import { Heading } from 'components/shared/Heading';
import { modalTheme } from 'components/shared/Modal/Modal.theme'; import { modalTheme } from 'components/shared/Modal/Modal.theme';
import { WavyBorder } from 'components/shared/WavyBorder';
type ModalHeaderProps = ComponentPropsWithoutRef<'div'> & { type ModalHeaderProps = ComponentPropsWithoutRef<'div'> & {
className?: string; className?: string;
@ -23,6 +24,7 @@ export const ModalHeader = ({
const { header, headerDescription, headerTitle } = modalTheme(); const { header, headerDescription, headerTitle } = modalTheme();
return ( return (
<>
<div <div
className={header({ className={header({
className, className,
@ -48,5 +50,7 @@ export const ModalHeader = ({
</Description> </Description>
)} )}
</div> </div>
<WavyBorder className="-mt-0.5" variant="stroke" />
</>
); );
}; };