mirror of
https://github.com/supabase/supabase.git
synced 2026-05-08 15:57:47 +08:00
This PR migrates the whole monorepo to use Tailwind v4: - Removed `@tailwindcss/container-queries` plugin since it's included by default in v4, - Bump all instances of Tailwind to v4. Made minimal changes to the shared config to remove non-supported features (`alpha` mentions), - Migrate all apps to be compatible with v4 configs, - Fix the `typography.css` import in 3 apps, - Add missing rules which were included by default in v3, - Run `pnpm dlx @tailwindcss/upgrade` on all apps, which renames a lot of classes - Rename all misnamed classes according to https://tailwindcss.com/docs/upgrade-guide#renamed-utilities in all apps. --------- Co-authored-by: Jordi Enric <jordi.err@gmail.com>
53 lines
1.5 KiB
TypeScript
53 lines
1.5 KiB
TypeScript
'use client'
|
|
|
|
import * as React from 'react'
|
|
import {
|
|
Button,
|
|
cn,
|
|
Collapsible_Shadcn_ as Collapsible,
|
|
CollapsibleContent_Shadcn_ as CollapsibleContent,
|
|
CollapsibleTrigger_Shadcn_ as CollapsibleTrigger,
|
|
} from 'ui'
|
|
|
|
interface CodeBlockProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
expandButtonTitle?: string
|
|
}
|
|
|
|
export function CodeBlockWrapper({
|
|
expandButtonTitle = 'View Code',
|
|
className,
|
|
children,
|
|
...props
|
|
}: CodeBlockProps) {
|
|
const [isOpened, setIsOpened] = React.useState(false)
|
|
|
|
return (
|
|
<Collapsible open={isOpened} onOpenChange={setIsOpened}>
|
|
<div className={cn('relative overflow-hidden', className)} {...props}>
|
|
<CollapsibleContent forceMount className={cn('overflow-hidden', !isOpened && 'max-h-32')}>
|
|
<div
|
|
className={cn(
|
|
'[&_pre]:my-0 [&_pre]:max-h-[650px] [&_pre]:pb-[100px]',
|
|
!isOpened ? '[&_pre]:overflow-hidden' : '[&_pre]:overflow-auto]'
|
|
)}
|
|
>
|
|
{children}
|
|
</div>
|
|
</CollapsibleContent>
|
|
<div
|
|
className={cn(
|
|
'absolute flex items-center justify-center bg-linear-to-b from-zinc-700/30 to-zinc-950/90 p-2',
|
|
isOpened ? 'inset-x-0 bottom-0 h-12' : 'inset-0'
|
|
)}
|
|
>
|
|
<CollapsibleTrigger asChild>
|
|
<Button type="secondary" className="h-8 text-xs">
|
|
{isOpened ? 'Collapse' : expandButtonTitle}
|
|
</Button>
|
|
</CollapsibleTrigger>
|
|
</div>
|
|
</div>
|
|
</Collapsible>
|
|
)
|
|
}
|