Files
supabase/apps/studio/components/interfaces/Database/Tables/ConstraintToken.tsx
Ivan Vasilov 308cd791a2 chore: Prep work for migrating to Tailwind v4 (#45285)
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.
2026-04-28 11:33:53 +02:00

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>
)
}