Files
supabase/apps/studio/components/interfaces/Database/Functions/CreateFunction/FunctionEditor.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

57 lines
1.6 KiB
TypeScript

import { Maximize2, Minimize2 } from 'lucide-react'
import { Button, cn, FormControl, Tooltip, TooltipContent, TooltipTrigger } from 'ui'
import CodeEditor from '@/components/ui/CodeEditor/CodeEditor'
export const FunctionEditor = ({
field,
language,
focused,
setFocused,
}: {
field: any
language: string
focused: boolean
setFocused: (b: boolean) => void
}) => {
return (
<div className={cn('rounded-md relative group grow')}>
<FormControl>
{language !== undefined && (
<CodeEditor
id="database-functions-editor"
language="pgsql"
placeholder={language === 'plpgsql' ? `BEGIN\n\nEND;` : undefined}
value={field.value}
onInputChange={field.onChange}
/>
)}
</FormControl>
<div
className={cn(
'absolute top-0 right-2 bg-surface-300 border border-strong rounded h-[28px]',
'opacity-0 group-hover:opacity-100 group-hover:top-2 transition-all'
)}
>
<Tooltip>
<TooltipTrigger asChild>
<Button
type="text"
size="tiny"
className={cn(
'px-1.5 text-foreground-lighter hover:text-foreground',
'transition z-50'
)}
onClick={() => setFocused(!focused)}
icon={focused ? <Minimize2 /> : <Maximize2 />}
/>
</TooltipTrigger>
<TooltipContent side="bottom">
{focused ? 'Minimize editor' : 'Maximize editor'}
</TooltipContent>
</Tooltip>
</div>
</div>
)
}