Crisp up modals and dropdowns
This commit is contained in:
parent
79bd96ac13
commit
6d2e9ea04c
@ -234,7 +234,7 @@ export default function AdminAppMenu({
|
|||||||
alignOffset={-85}
|
alignOffset={-85}
|
||||||
onOpen={refreshAdminData}
|
onOpen={refreshAdminData}
|
||||||
className={clsx(
|
className={clsx(
|
||||||
'border-medium',
|
'outline-medium',
|
||||||
className,
|
className,
|
||||||
)}
|
)}
|
||||||
classNameButton={clsx(
|
classNameButton={clsx(
|
||||||
|
|||||||
@ -85,6 +85,8 @@ const DIALOG_DESCRIPTION = 'For searching photos, views, and settings';
|
|||||||
const LISTENER_KEYDOWN = 'keydown';
|
const LISTENER_KEYDOWN = 'keydown';
|
||||||
const MINIMUM_QUERY_LENGTH = 2;
|
const MINIMUM_QUERY_LENGTH = 2;
|
||||||
|
|
||||||
|
const MAX_HEIGHT = '20rem';
|
||||||
|
|
||||||
type CommandKItem = {
|
type CommandKItem = {
|
||||||
label: ReactNode
|
label: ReactNode
|
||||||
explicitKey?: string
|
explicitKey?: string
|
||||||
@ -163,12 +165,11 @@ export default function CommandKClient({
|
|||||||
|
|
||||||
const refInput = useRef<HTMLInputElement>(null);
|
const refInput = useRef<HTMLInputElement>(null);
|
||||||
const mobileViewportHeight = useVisualViewportHeight();
|
const mobileViewportHeight = useVisualViewportHeight();
|
||||||
const heightMaximum = '18rem';
|
|
||||||
const maxHeight = useMemo(() => {
|
const maxHeight = useMemo(() => {
|
||||||
const positionY = refInput.current?.getBoundingClientRect().y;
|
const positionY = refInput.current?.getBoundingClientRect().y;
|
||||||
return mobileViewportHeight && positionY
|
return mobileViewportHeight && positionY
|
||||||
? `min(${mobileViewportHeight - positionY - 32}px, ${heightMaximum})`
|
? `min(${mobileViewportHeight - positionY - 32}px, ${MAX_HEIGHT})`
|
||||||
: heightMaximum;
|
: MAX_HEIGHT;
|
||||||
}, [mobileViewportHeight]);
|
}, [mobileViewportHeight]);
|
||||||
|
|
||||||
const refScroll = useRef<HTMLDivElement>(null);
|
const refScroll = useRef<HTMLDivElement>(null);
|
||||||
@ -585,8 +586,8 @@ export default function CommandKClient({
|
|||||||
<DialogDescription>{DIALOG_DESCRIPTION}</DialogDescription>
|
<DialogDescription>{DIALOG_DESCRIPTION}</DialogDescription>
|
||||||
</VisuallyHidden.Root>
|
</VisuallyHidden.Root>
|
||||||
<div className={clsx(
|
<div className={clsx(
|
||||||
'px-3 md:px-4',
|
'px-3 md:px-3.5',
|
||||||
'pt-3 md:pt-4',
|
'pt-3 md:pt-3.5',
|
||||||
)}>
|
)}>
|
||||||
<div className="relative">
|
<div className="relative">
|
||||||
<Command.Input
|
<Command.Input
|
||||||
@ -599,7 +600,7 @@ export default function CommandKClient({
|
|||||||
'w-full min-w-0!',
|
'w-full min-w-0!',
|
||||||
'focus:ring-0',
|
'focus:ring-0',
|
||||||
isPlaceholderVisible || isLoading && 'pr-10!',
|
isPlaceholderVisible || isLoading && 'pr-10!',
|
||||||
'border-gray-200! dark:border-gray-800!',
|
'border-medium',
|
||||||
'focus:border-gray-200 dark:focus:border-gray-800',
|
'focus:border-gray-200 dark:focus:border-gray-800',
|
||||||
'placeholder:text-gray-400/80',
|
'placeholder:text-gray-400/80',
|
||||||
'dark:placeholder:text-gray-700',
|
'dark:placeholder:text-gray-700',
|
||||||
|
|||||||
@ -93,9 +93,11 @@ export default function Modal({
|
|||||||
className={clsx(
|
className={clsx(
|
||||||
container && 'w-[calc(100vw-1.5rem)] sm:w-[min(540px,90vw)]',
|
container && 'w-[calc(100vw-1.5rem)] sm:w-[min(540px,90vw)]',
|
||||||
container && !noPadding && 'p-3 md:p-4',
|
container && !noPadding && 'p-3 md:p-4',
|
||||||
container && 'rounded-lg md:rounded-xl border-medium',
|
container && 'rounded-lg md:rounded-xl',
|
||||||
|
container && 'outline-medium',
|
||||||
container && 'bg-white dark:bg-black',
|
container && 'bg-white dark:bg-black',
|
||||||
container && 'shadow-2xl/20 dark:shadow-2xl/100',
|
container && 'shadow-gray-900 shadow-2xl/15',
|
||||||
|
container && 'dark:shadow-black dark:shadow-2xl/100',
|
||||||
className,
|
className,
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
|
|||||||
@ -83,7 +83,7 @@ export default function MoreMenu({
|
|||||||
'min-w-[8rem]',
|
'min-w-[8rem]',
|
||||||
'component-surface',
|
'component-surface',
|
||||||
'py-1',
|
'py-1',
|
||||||
'shadow-lg',
|
'shadow-lg shadow-gray-900/10 dark:shadow-900',
|
||||||
'data-[side=top]:dark:shadow-[0_0px_40px_rgba(0,0,0,0.6)]',
|
'data-[side=top]:dark:shadow-[0_0px_40px_rgba(0,0,0,0.6)]',
|
||||||
'data-[side=bottom]:dark:shadow-[0_10px_40px_rgba(0,0,0,0.6)]',
|
'data-[side=bottom]:dark:shadow-[0_10px_40px_rgba(0,0,0,0.6)]',
|
||||||
'data-[side=top]:animate-fade-in-from-bottom',
|
'data-[side=top]:animate-fade-in-from-bottom',
|
||||||
|
|||||||
@ -101,7 +101,7 @@ export default function PhotoRecipeOverlay({
|
|||||||
'z-10',
|
'z-10',
|
||||||
'w-[20rem] p-3 space-y-3',
|
'w-[20rem] p-3 space-y-3',
|
||||||
'scroll-mt-8',
|
'scroll-mt-8',
|
||||||
'rounded-lg',
|
'rounded-[10px]',
|
||||||
isOnPhoto
|
isOnPhoto
|
||||||
? 'shadow-2xl'
|
? 'shadow-2xl'
|
||||||
// Soften shadow to mimic <Modal />
|
// Soften shadow to mimic <Modal />
|
||||||
|
|||||||
@ -50,7 +50,7 @@ export default function ShareModal({
|
|||||||
) =>
|
) =>
|
||||||
<div
|
<div
|
||||||
className={clsx(
|
className={clsx(
|
||||||
'py-3 px-3',
|
'py-2.5 px-3',
|
||||||
embedded ? 'border-l' : 'border rounded-md',
|
embedded ? 'border-l' : 'border rounded-md',
|
||||||
'border-gray-200 bg-gray-50 active:bg-gray-100',
|
'border-gray-200 bg-gray-50 active:bg-gray-100',
|
||||||
// eslint-disable-next-line max-len
|
// eslint-disable-next-line max-len
|
||||||
|
|||||||
13
tailwind.css
13
tailwind.css
@ -141,15 +141,19 @@
|
|||||||
}
|
}
|
||||||
@utility divide-main {
|
@utility divide-main {
|
||||||
@apply
|
@apply
|
||||||
divide-gray-200 dark:divide-gray-700
|
divide-gray-400/25 dark:divide-gray-700
|
||||||
}
|
}
|
||||||
@utility border-medium {
|
@utility border-medium {
|
||||||
@apply
|
@apply
|
||||||
border border-gray-200 dark:border-gray-800
|
border border-gray-400/25 dark:border-gray-800
|
||||||
|
}
|
||||||
|
@utility outline-medium {
|
||||||
|
@apply
|
||||||
|
outline outline-gray-400/25 dark:outline-gray-800
|
||||||
}
|
}
|
||||||
@utility divide-medium {
|
@utility divide-medium {
|
||||||
@apply
|
@apply
|
||||||
divide-gray-200 dark:divide-gray-800
|
divide-gray-400/25 dark:divide-gray-800
|
||||||
}
|
}
|
||||||
/* Background */
|
/* Background */
|
||||||
@utility bg-main {
|
@utility bg-main {
|
||||||
@ -170,7 +174,8 @@
|
|||||||
}
|
}
|
||||||
@utility bg-content {
|
@utility bg-content {
|
||||||
@apply
|
@apply
|
||||||
bg-main border-medium
|
/* '!' necessary for radix controls */
|
||||||
|
bg-main outline-medium!
|
||||||
}
|
}
|
||||||
@utility bg-invert {
|
@utility bg-invert {
|
||||||
@apply
|
@apply
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user