Files
supabase/apps/www/components/CrossfadeIcon.tsx
Anthony Lio 6a421fe296 feat(kb): updates glyph lines (#52389)
## Problem

- make kb warp hero consistent with recent `GlyphLines` usage in `www`
for favor over grain mask usage for consistency purpose

## Solution

- replaces the grain lines on the kb heroes and topic covers with lines
that spell the page title and description
- changes all lines to one opaque border color, so overlapping glyphs do
not get brighter
- adds a surface cell behind each glyph, so lines that cross stay
readable
- changes the draw-in animations to start when the glyphs first paint,
so the reader sees them
- changes the canvases to redraw at the pinch zoom resolution, so zoomed
text stays sharp
- removes the grain mask and the animations that nothing uses now

| state | preview |
| -------|------|
| before | <img width="1701" height="670" alt="image"
src="https://github.com/user-attachments/assets/9c8de3d3-c3cb-4d7e-ad8c-aedc36f8f911"
/> |
| after | <img width="1701" height="670" alt="image"
src="https://github.com/user-attachments/assets/0be46a5f-6024-4f76-b600-99a86090cc2c"
/> |

<!--
## Preview links

If relevant, include links to changed pages for easy review access.

Copy the preview base URL from the Vercel bot comment on this PR. Use
the following table as an example template.

| Site | Live | Preview | Search for |
| -------------- |
-------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------------------------
| ----------------------------- |
| WWW | [/blog/your-post](https://supabase.com/blog/your-post) |
[/blog/your-post](https://zone-www-dot-com-git-branch-name-supabase.vercel.app/blog/your-post)
| unique phrase from the change |
| Docs |
[/docs/guides/your-page](https://supabase.com/docs/guides/your-page) |
[/docs/guides/your-page](https://docs-git-branch-name-supabase.vercel.app/docs/guides/your-page)
| unique phrase from the change |
| Studio | [/dashboard](https://supabase.com/dashboard) |
[/dashboard](https://studio-git-branch-name-supabase.vercel.app/dashboard)
| unique phrase from the change |
| Design system | [/design-system](https://supabase.com/design-system) |
[/design-system](https://design-system-git-branch-name-supabase.vercel.app/design-system)
| unique phrase from the change |
| UI library | [/library](https://supabase.com/library) |
[/library](https://ui-library-git-branch-name-supabase.vercel.app/library)
| unique phrase from the change |
| Knowledge base |
[/kb/guides/your-page](https://supabase.com/kb/guides/your-page) |
[/kb/guides/your-page](https://kb-git-branch-name-supabase.vercel.app/kb/guides/your-page)
| unique phrase from the change |
-->

<!-- ## Additional context

Optionally add any other context or screenshots.

-->

## Review instructions

1. run `pnpm dev:kb` and open `/kb`
2. open `/kb/topics/auth` and make sure that the grid, the frame lines
and the shapes draw in after the

## Checklist

Check all before review:

- [x] I have read
[CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md)
- [ ] If I wrote a new docs topic or edited an existing topic, I used
the `/write-the-docs` or `/edit-the-docs` skill, which applies the docs
[style
guide](https://github.com/supabase/supabase/tree/master/apps/docs/style-guide)
2026-10-29 06:46:36 +02:00

50 lines
1.4 KiB
TypeScript

import { useId, type ReactNode } from 'react'
import { cn } from 'ui'
export interface CrossfadeIconProps {
isActive: boolean
activeIcon: ReactNode
inactiveIcon: ReactNode
className?: string
}
const iconClassName = (isShown: boolean) =>
cn(
'absolute inset-0 flex items-center justify-center',
'transition duration-300 ease-crossfade',
'motion-reduce:transition-none',
isShown ? 'scale-100 opacity-100 blur-none' : 'scale-25 opacity-0 blur-xs'
)
export const CrossfadeIcon = ({
isActive,
activeIcon,
inactiveIcon,
className,
}: CrossfadeIconProps) => (
<span aria-hidden className={cn('relative block size-3.5', className)}>
<span className={iconClassName(isActive)}>{activeIcon}</span>
<span className={iconClassName(!isActive)}>{inactiveIcon}</span>
</span>
)
export const CircleCheckFilled = ({ className }: { className?: string }) => {
const maskId = useId()
return (
<svg viewBox="0 0 24 24" fill="none" className={cn('text-foreground', className)}>
<mask id={maskId}>
<rect width="24" height="24" className="fill-white" />
<path
d="m9 12 2 2 4-4"
className="stroke-black"
strokeWidth="2"
strokeLinecap="round"
strokeLinejoin="round"
/>
</mask>
<circle cx="12" cy="12" r="10" fill="currentColor" mask={`url(#${maskId})`} />
</svg>
)
}