Files
supabase/apps/studio/components/interfaces/Home/Connect/ConnectTabs.tsx
cc008ef983 Feat/homepage connect modal combined (#20328)
* First

* Update

* Move connection string panel to its own component

* Add connection strings

* Format button

* Add dummy files to get logic working

* Add mdx packages

* add file handling and change logic

* Support connections

* Fix icons, add direct and graphql

* Remove mdx stuff

* Add pooler toggle

* Fix child logic

* Fix grandchild logic

* Refactor data object

* Move back to dialog ui

* Refactor to shadcn tabs

* Find the files

* Wire up icons

* Loop over connection types

* Reformat file paths

* Remove from project home

* fix tab rendering issue

* Check for unique keys

* Add new libs

* comment

* Add direct connection ui

* Get project connection strings

* Cleanup

* Add project keys

* Add types file

* Undo update

* Add next app files

* Add files

* Add next pages files

* Add nuxt

* Fix env vars

* Add rest of frameworks, graphql and orms

* Add orms

* Fix types

* Add guide links

* Run prettier

* Separate graphql

* Move ui

* Move direct connection to first position

* Move to single files

* Update styling

* Fix locations

* Fix next content

* Fix dialog close button, add proper light mode theme

* Fix dialog style issues

* CleanupA

* Pin to top

* Feat/homepage connect modal combined  styling update (#21079)

* chore: update styling. also moved useStates as it was sort of duplicated

* Cleanup

---------

Co-authored-by: Terry Sutton <saltcod@gmail.com>

* Close pooler modal

* Make the db connection panel blend in

* Allow for DatabaseSelector

* Dont open by default

* Some fixes

* Set min height to loader

* Fix

* Small styling fixes for table editor sort filter popover

* Make connect button stand out

---------

Co-authored-by: Jordi Enric <jordi.err@gmail.com>
Co-authored-by: Jonathan Summers-Muir <MildTomato@users.noreply.github.com>
Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2024-02-15 09:25:17 -03:30

61 lines
1.6 KiB
TypeScript

import { Tabs_Shadcn_ } from 'ui'
import { FileJson2 } from 'lucide-react'
import { TabsList_Shadcn_, TabsTrigger_Shadcn_ } from 'ui'
import { TabsContent_Shadcn_ } from 'ui'
import React, { ReactNode } from 'react'
interface ConnectTabTriggerProps {
value: string
}
interface ConnectTabTriggersProps {
children: ReactNode[]
}
interface ConnectFileTabProps {
children: ReactNode[]
}
interface ConnectTabContentProps {
children: ReactNode
value: string
}
const ConnectTabs = ({ children }: ConnectFileTabProps) => {
const firstChild = children[0]
const defaultValue = React.isValidElement(firstChild)
? (firstChild.props as any)?.children[0]?.props?.value || ''
: null
return <Tabs_Shadcn_ defaultValue={defaultValue}>{children}</Tabs_Shadcn_>
}
const ConnectTabTrigger = ({ value }: ConnectTabTriggerProps) => {
return (
<TabsTrigger_Shadcn_
value={value}
className="flex items-center gap-1 text-xs px-0 data-[state=active]:bg-transparent py-2.5"
>
<FileJson2 size={15} className="text-foreground-muted" />
{value}
</TabsTrigger_Shadcn_>
)
}
const ConnectTabTriggers = ({ children }: ConnectTabTriggersProps) => {
return (
<TabsList_Shadcn_ className="bg-surface-100 px-5 rounded-lg rounded-b-none gap-5">
{children}
</TabsList_Shadcn_>
)
}
export const ConnectTabContent = ({ value, children }: ConnectTabContentProps) => {
return (
<TabsContent_Shadcn_ value={value} className="p-3 mt-1 max-h-72 overflow-scroll">
{children}
</TabsContent_Shadcn_>
)
}
export { ConnectTabTrigger, ConnectTabTriggers, ConnectTabs }