mirror of
https://github.com/supabase/supabase.git
synced 2026-05-12 13:19:37 +08: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.
45 lines
1.2 KiB
TypeScript
45 lines
1.2 KiB
TypeScript
import { ReactNode } from 'react'
|
|
import { cn } from 'ui'
|
|
|
|
interface ConstraintTokenProps {
|
|
icon?: ReactNode
|
|
label: string
|
|
variant?: 'default' | 'secondary' | 'primary'
|
|
}
|
|
|
|
const constraintTokenClassName = cn(
|
|
'inline-flex items-center justify-center rounded-md text-center font-mono uppercase whitespace-nowrap font-medium',
|
|
'tracking-[0.06em] text-[11px] leading-[1.1] px-[5.5px] h-[21px]',
|
|
'transition-all border'
|
|
)
|
|
|
|
export const ConstraintToken = ({ icon, label, variant = 'default' }: ConstraintTokenProps) => {
|
|
const tokenToneClassName =
|
|
variant === 'primary'
|
|
? 'bg-brand/10 text-brand-600 border-brand-500'
|
|
: variant === 'default'
|
|
? 'bg-surface-75 text-foreground-light border-strong'
|
|
: 'bg-surface-75/50 text-foreground-light border-strong'
|
|
|
|
return (
|
|
<div className="inline-flex items-center whitespace-nowrap">
|
|
{icon && (
|
|
<span
|
|
className={cn(constraintTokenClassName, tokenToneClassName, 'rounded-r-none border-r-0')}
|
|
>
|
|
{icon}
|
|
</span>
|
|
)}
|
|
<span
|
|
className={cn(
|
|
constraintTokenClassName,
|
|
tokenToneClassName,
|
|
icon ? 'rounded-l-none' : 'rounded-md'
|
|
)}
|
|
>
|
|
{label}
|
|
</span>
|
|
</div>
|
|
)
|
|
}
|