mirror of
https://github.com/supabase/supabase.git
synced 2026-10-09 19:35:06 +03:00
This PR migrates the JS config for Tailwind into a CSS config. As such, all variables have been defined as CSS variables and they're using the specialized Tailwind syntax for generating utility classes. Beside the migration, these changes were also added: - Added `tailwind.config.css` to few packages to make the Tailwind Intellisense work. - Migrated away from Radix style color classes to our defined classes, the values will remain the same. - Most of the CSS is generated by scripts, they'll be removed in next PRs. * Removed redundant `border-light` classes from several components since it was undefined. * Removed redundant `text-strong` classes from several components since it was undefined. How to test: - Open all apps, compare the UI (mainly colors) to builds from #45417 and try to find a difference. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Style** * Harmonized color variable usages and updated UI color references (affects palettes, charts, gradients, hero illustrations, and scrollbars). * Tweaked border, tab, and selection visuals across components. * **New Features** * Added a suite of theme animations and refined typography presets used by site prose and docs. * **Refactor** * Overhauled Tailwind/theme configuration and color token generation for more consistent theming. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
90 lines
2.9 KiB
TypeScript
90 lines
2.9 KiB
TypeScript
import { Check, ChevronRight, Copy } from 'lucide-react'
|
|
import { useState } from 'react'
|
|
import {
|
|
Button,
|
|
cn,
|
|
Collapsible_Shadcn_,
|
|
CollapsibleContent_Shadcn_,
|
|
CollapsibleTrigger_Shadcn_,
|
|
copyToClipboard,
|
|
Separator,
|
|
} from 'ui'
|
|
|
|
interface Parameter {
|
|
key: string
|
|
value: string
|
|
}
|
|
|
|
interface ConnectionParametersProps {
|
|
parameters: Parameter[]
|
|
}
|
|
|
|
export const ConnectionParameters = ({ parameters }: ConnectionParametersProps) => {
|
|
const [isOpen, setIsOpen] = useState(false)
|
|
const [copiedMap, setCopiedMap] = useState<Record<string, boolean>>({})
|
|
|
|
return (
|
|
<Collapsible_Shadcn_ open={isOpen} onOpenChange={setIsOpen} className="group -space-y-px">
|
|
<CollapsibleTrigger_Shadcn_
|
|
asChild
|
|
className="w-full justify-start rounded-t-none !last:rounded-b group-data-open:rounded-b-none px-3"
|
|
>
|
|
<Button
|
|
type="default"
|
|
size="tiny"
|
|
className="text-foreground-lighter bg-dash-sidebar!"
|
|
icon={
|
|
<ChevronRight
|
|
className={cn(
|
|
'text-foreground-muted transition-transform',
|
|
isOpen ? 'rotate-90' : ''
|
|
)}
|
|
/>
|
|
}
|
|
>
|
|
View parameters
|
|
</Button>
|
|
</CollapsibleTrigger_Shadcn_>
|
|
<CollapsibleContent_Shadcn_ className="bg-dash-sidebar rounded-b border font-mono text-sm">
|
|
<div className="px-4 py-2">
|
|
{parameters.map((param) => (
|
|
<div key={param.key} className="py-0.5 group/param">
|
|
<div className="text-xs flex items-center">
|
|
<span className="text-foreground-lighter">{param.key}: </span>
|
|
<span className="ml-1 text-foreground">{param.value}</span>
|
|
<button
|
|
onClick={() => {
|
|
copyToClipboard(param.value, () => {
|
|
setCopiedMap((prev) => ({ ...prev, [param.key]: true }))
|
|
setTimeout(() => {
|
|
setCopiedMap((prev) => ({ ...prev, [param.key]: false }))
|
|
}, 1000)
|
|
})
|
|
}}
|
|
className={cn(
|
|
'text-foreground-lighter',
|
|
'ml-2 opacity-0 group-hover/param:opacity-100',
|
|
'hover:text-foreground rounded-xs p-1',
|
|
copiedMap[param.key] && 'opacity-100',
|
|
'transition-all'
|
|
)}
|
|
>
|
|
{copiedMap[param.key] ? (
|
|
<Check size={12} strokeWidth={1.5} />
|
|
) : (
|
|
<Copy size={12} strokeWidth={1.5} />
|
|
)}
|
|
</button>
|
|
</div>
|
|
</div>
|
|
))}
|
|
</div>
|
|
<Separator />
|
|
<div className="text-foreground-muted text-xs px-4 py-1 font-sans">
|
|
For security reasons, your database password is never shown.
|
|
</div>
|
|
</CollapsibleContent_Shadcn_>
|
|
</Collapsible_Shadcn_>
|
|
)
|
|
}
|