Refine og hover behavior

This commit is contained in:
Sam Becker 2025-06-19 22:26:36 -05:00
parent 624357b74f
commit 9a3b60bcd9
4 changed files with 42 additions and 30 deletions

View File

@ -26,7 +26,7 @@ export default function OGTooltip({
{...props} {...props}
className={clsx( className={clsx(
'overflow-hidden rounded-[0.25rem]', 'overflow-hidden rounded-[0.25rem]',
'outline-medium bg-dim', 'outline-medium bg-extra-dim',
)} )}
/> />
{caption && <div className={clsx( {caption && <div className={clsx(

View File

@ -13,28 +13,36 @@ export default function TooltipPrimitive({
children, children,
className, className,
classNameTrigger: classNameTriggerProp, classNameTrigger: classNameTriggerProp,
sideOffset = 10,
delayDuration = 100,
skipDelayDuration = 300,
supportMobile,
color, color,
keyCommand, keyCommand,
keyCommandModifier, keyCommandModifier,
supportMobile,
animateLarge,
disableHoverableContent, disableHoverableContent,
delayDuration = 100,
skipDelayDuration = 300,
align,
side,
sideOffset = 10,
debug, debug,
}: { }: {
content?: ReactNode content?: ReactNode
children: ReactNode children: ReactNode
className?: string className?: string
classNameTrigger?: string classNameTrigger?: string
sideOffset?: number
delayDuration?: number
skipDelayDuration?: number
supportMobile?: boolean
color?: ComponentProps<typeof MenuSurface>['color'] color?: ComponentProps<typeof MenuSurface>['color']
keyCommand?: string keyCommand?: string
keyCommandModifier?: ComponentProps<typeof KeyCommand>['modifier'] keyCommandModifier?: ComponentProps<typeof KeyCommand>['modifier']
supportMobile?: boolean
animateLarge?: boolean
disableHoverableContent?: boolean disableHoverableContent?: boolean
// Tooltip.Provider
delayDuration?: number
skipDelayDuration?: number
// Tooltip.Content
align?: ComponentProps<typeof Tooltip.Content>['align']
side?: ComponentProps<typeof Tooltip.Content>['side']
sideOffset?: number
debug?: boolean debug?: boolean
}) { }) {
const refTrigger = useRef<HTMLButtonElement>(null); const refTrigger = useRef<HTMLButtonElement>(null);
@ -104,11 +112,17 @@ export default function TooltipPrimitive({
<Tooltip.Portal> <Tooltip.Portal>
<Tooltip.Content <Tooltip.Content
ref={refContent} ref={refContent}
align={align}
side={side}
sideOffset={sideOffset} sideOffset={sideOffset}
className={clsx( className={clsx(
// Entrance animations // Entrance animations
'data-[side=top]:animate-fade-in-from-bottom', animateLarge
'data-[side=bottom]:animate-fade-in-from-top', ? 'data-[side=top]:animate-fade-in-from-bottom-large'
: 'data-[side=top]:animate-fade-in-from-bottom',
animateLarge
? 'data-[side=bottom]:animate-fade-in-from-top-large'
: 'data-[side=bottom]:animate-fade-in-from-top',
// Extra collision padding // Extra collision padding
'mx-2', 'mx-2',
// Z-index above // Z-index above

View File

@ -124,7 +124,7 @@ export default function PhotoRecipeOverlay({
recipe={title} recipe={title}
className={clsx( className={clsx(
'text-[15px]', 'text-[15px]',
'[&>*>*>*]:text-black', '[&>*>*>*>*]:text-black',
'tracking-wide', 'tracking-wide',
)} )}
/> />

View File

@ -47,28 +47,26 @@ html {
100% { opacity: 1; } 100% { opacity: 1; }
} }
--animate-fade-in-from-top: fade-in-from-top 0.25s ease-in-out; --animate-fade-in-from-top: fade-in-from-top 0.2s ease-out;
--animate-fade-in-from-top-large: fade-in-from-top-large 0.2s ease-out;
@keyframes fade-in-from-top { @keyframes fade-in-from-top {
0% { 0% { opacity: 0; transform: translateY(-10px); }
opacity: 0; 100% { opacity: 1; transform: translateY(0); }
transform: translateY(-10px);
}
100% {
opacity: 1;
transform: translateY(0);
} }
@keyframes fade-in-from-top-large {
0% { opacity: 0; transform: translateY(-20px); }
100% { opacity: 1; transform: translateY(0); }
} }
--animate-fade-in-from-bottom: fade-in-from-bottom 0.25s ease-in-out; --animate-fade-in-from-bottom: fade-in-from-bottom 0.2s ease-out;
--animate-fade-in-from-bottom-large: fade-in-from-bottom-large 0.2s ease-out;
@keyframes fade-in-from-bottom { @keyframes fade-in-from-bottom {
0% { 0% { opacity: 0; transform: translateY(10px); }
opacity: 0; 100% { opacity: 1; transform: translateY(0); }
transform: translateY(10px);
}
100% {
opacity: 1;
transform: translateY(0);
} }
@keyframes fade-in-from-bottom-large {
0% { opacity: 0; transform: translateY(20px); }
100% { opacity: 1; transform: translateY(0); }
} }
--animate-rotate-pulse: rotate-pulse 0.75s linear infinite normal both running; --animate-rotate-pulse: rotate-pulse 0.75s linear infinite normal both running;