mirror of
https://github.com/supabase/supabase.git
synced 2026-10-08 10:55:06 +03:00
This PR preps the monorepo for a migration to Tailwind v4: - Bump all Tailwind dependencies and libraries to the latest possible version, while still compatible with Tailwind 3. - Cleans up obsolete Tailwind 3 specific options and configs. - Cleans up unused CSS files and fixes the CSS imports. - Migrates all `important` uses in `@apply` lines to using the `!` prefix. - Move `typography.css` to the `config` package and import it from the apps. - Migrated all occurrences of `flex-grow`, `flex-shrink`, `overflow-clip` and `overflow-ellipsis` since they're deprecated and will be removed in Tailwind 4. - Make the default theme object typesafe in the `ui` package. - Migrate all `bg-opacity`, `border-opacity`, `ring-opacity` and `divider-opacity` to the new format where they're declared as part of the property color. - Bump and unify all imports of `postcss` dependency.
66 lines
1.9 KiB
TypeScript
66 lines
1.9 KiB
TypeScript
type Color = 'black' | 'gray' | 'green' | 'alt'
|
|
|
|
interface ProductIcon {
|
|
icon: string
|
|
color?: Color
|
|
}
|
|
|
|
function ProductIcon({ icon, color }: ProductIcon) {
|
|
const handleColor = (color: Color) => {
|
|
switch (color) {
|
|
case 'green':
|
|
return {
|
|
container: 'bg-brand-600 text-brand-100',
|
|
svg: 'stroke-brand',
|
|
}
|
|
case 'alt':
|
|
return {
|
|
container: 'bg-brand-200 text-brand',
|
|
svg: 'stroke-brand',
|
|
}
|
|
case 'gray':
|
|
return {
|
|
container: 'bg- text-brand',
|
|
svg: 'stroke-brand',
|
|
}
|
|
case 'black':
|
|
default:
|
|
return {
|
|
container: 'bg-foreground text-background-alternative',
|
|
svg: 'stroke-background',
|
|
}
|
|
}
|
|
}
|
|
|
|
return (
|
|
<div
|
|
className={[
|
|
'inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-md',
|
|
!color || color === 'black' ? 'bg-foreground text-background-alternative' : '',
|
|
color && color === 'gray' ? 'bg-border-strong text-foreground-light' : '',
|
|
color && color === 'green' ? 'bg-brand text-brand-100' : '',
|
|
color && color === 'alt' ? 'bg-alternative text-brand' : '',
|
|
// color && color === 'alt' ? 'bg-surface-300 text-brand' : '',
|
|
].join(' ')}
|
|
>
|
|
<svg
|
|
className={[
|
|
'h-5 w-5',
|
|
!color || color === 'black' ? 'stroke-background' : '',
|
|
color && color === 'gray' ? 'stroke-foreground-light' : '',
|
|
color && color === 'green' ? 'stroke-brand-200' : '',
|
|
color && color === 'alt' ? 'stroke-brand' : '',
|
|
].join(' ')}
|
|
xmlns="http://www.w3.org/2000/svg"
|
|
fill="none"
|
|
viewBox="0 0 24 24"
|
|
aria-hidden="true"
|
|
>
|
|
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth="1.5" d={icon} />
|
|
</svg>
|
|
</div>
|
|
)
|
|
}
|
|
|
|
export default ProductIcon
|