Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

chore: add collapsible

Jonathan Summers-Muir868a6d0676a2
diff --git a/apps/www/_blog/2023-08-08-supabase-local-dev.mdx b/apps/www/_blog/2023-08-08-supabase-local-dev.mdx
index dd0585cac07..22f5622f7d6 100644
--- a/apps/www/_blog/2023-08-08-supabase-local-dev.mdx
+++ b/apps/www/_blog/2023-08-08-supabase-local-dev.mdx
@@ -38,9 +38,7 @@ A lot of the credit for this belongs to [Heroku’s pg-extras](https://github.co
This is just a starting point for the Supabase inspector. We’ll grow this feature to become an essential part of your Postgres toolkit.
-<details>
-<summary>See full command</summary>
- <div>
+<BlogCollapsible title="See full command">
{/* prettier-ignore */}
```markdown
@@ -72,12 +70,11 @@ This is just a starting point for the Supabase inspector. We’ll grow this feat
vacuum-stats Show statistics related to vacuum operations per table
```
- </div>
-</details>
+</BlogCollapsible>
-<details>
- <summary>Read the docs</summary>
- {/* prettier-ignore */}
+<BlogCollapsible title="Read the docs">
+
+{/* prettier-ignore */}
<div>
- [Show most frequently run queries](https://supabase.com/docs/reference/cli/supabase-inspect-db-calls)
- [Show long running queries](https://supabase.com/docs/reference/cli/supabase-inspect-db-long-running-queries)
@@ -99,7 +96,8 @@ This is just a starting point for the Supabase inspector. We’ll grow this feat
- [Show estimated database bloat](https://supabase.com/docs/reference/cli/supabase-inspect-db-bloat)
- [Show statistics related to vacuum operations](https://supabase.com/docs/reference/cli/supabase-inspect-db-vacuum-stats)
</div>
-</details>
+
+</BlogCollapsible>
## Easier backups
@@ -107,12 +105,11 @@ This is just a starting point for the Supabase inspector. We’ll grow this feat
We’ve made it even easer to backup and migrate your database, using `supabase db dump`. Under the hood, this simply uses [pg_dump](https://www.postgresql.org/docs/current/app-pgdump.html) (it's just Postgres, after all). However we also handle a few of the hairy issues that you might need to navigate on your own, like object permissions.
-<details>
- <summary>See full command</summary>
+<BlogCollapsible title="See full command">
<div>
-
+
{/* prettier-ignore */}
- ```markdown
+ ```markdown
supabase db dump --help
Dumps data or schemas from the remote database
@@ -128,7 +125,7 @@ We’ve made it even easer to backup and migrate your database, using `supabase
```
</div>
-</details>
+</BlogCollapsible>
## Improved Database Migrations
@@ -140,12 +137,12 @@ With the new Postgres Language Server, we hope to make it as easy to write Postg
Finally, we’ve added a Migrations view [in the dashboard](https://app.supabase.com/project/_/database/migrations) to track your migration history to improve the discoverability of migrations.
-<details>
- <summary>See full command</summary>
+<BlogCollapsible title="See full command">
<div>
+
{/* prettier-ignore */}
```markdown
- supabase migration
+ supabase migration
Manage database migration scripts
Usage:
@@ -160,7 +157,7 @@ Finally, we’ve added a Migrations view [in the dashboard](https://app.supabase
```
</div>
-</details>
+</BlogCollapsible>
## Test and lint your database
@@ -172,8 +169,7 @@ To make life even easier, our friends at [Basejump](https://usebasejump.com/) ha
Finally, while you wait for us to make progress on the Language Server, we’ve added [support for linting](https://supabase.com/docs/guides/cli/testing-and-linting#linting-your-database) through the excellent [plpgsql_check](https://github.com/okbob/plpgsql_check) extension.
-<details>
- <summary>See full command</summary>
+<BlogCollapsible title="See full command">
<div>
{/* prettier-ignore */}
@@ -205,7 +201,7 @@ Finally, while you wait for us to make progress on the Language Server, we’ve
```
</div>
-</details>
+</BlogCollapsible>
## Database seeding
@@ -237,8 +233,7 @@ let movie: Database['public']['Tables']['movies']['Row'] = // ...
let movie: Tables<'movies'> = // ...
```
-<details>
- <summary>See full command</summary>
+<BlogCollapsible title="See full command">
<div>
{/* prettier-ignore */}
@@ -254,7 +249,7 @@ let movie: Tables<'movies'> = // ...
```
</div>
-</details>
+</BlogCollapsible>
## Official GitHub Action
diff --git a/apps/www/lib/mdx/mdxComponents.tsx b/apps/www/lib/mdx/mdxComponents.tsx
index 55ffb97b991..36493cb99c3 100644
--- a/apps/www/lib/mdx/mdxComponents.tsx
+++ b/apps/www/lib/mdx/mdxComponents.tsx
@@ -6,7 +6,13 @@ import ImageGrid from '~/components/ImageGrid'
import Quote from '~/components/Quote'
import Chart from '~/components/Charts/PGCharts'
import InlineCodeTag from '~/components/InlineCode'
-import { Badge } from 'ui'
+import {
+ Badge,
+ Collapsible_Shadcn_,
+ CollapsibleTrigger_Shadcn_,
+ CollapsibleContent_Shadcn_,
+ IconTriangle,
+} from 'ui'
import ImageFadeStack from '~/components/ImageFadeStack'
// import all components used in blog articles here
@@ -26,6 +32,29 @@ const getCaptionAlign = (align?: 'left' | 'center' | 'right') => {
}
}
+const BlogCollapsible = ({ title, ...props }: { title: string }) => {
+ return (
+ <Collapsible_Shadcn_>
+ <CollapsibleTrigger_Shadcn_
+ className="
+ data-[state=open]:text
+ hover:text-light
+ flex items-center gap-3
+ [&>svg]:fill-current
+ [&>svg]:rotate-90
+ [&>svg]:transition-transform
+ [&>svg]:data-[state='open']:rotate-180
+ [&>svg]:data-[state='open']:text
+ "
+ >
+ <IconTriangle size={10} />
+ <span>{title}</span>
+ </CollapsibleTrigger_Shadcn_>
+ <CollapsibleContent_Shadcn_ {...props} />
+ </Collapsible_Shadcn_>
+ )
+}
+
export default function mdxComponents(type?: 'blog' | 'lp' | undefined) {
const components = {
CodeBlock,
@@ -81,6 +110,7 @@ export default function mdxComponents(type?: 'blog' | 'lp' | undefined) {
</a>
),
code: (props: any) => <InlineCodeTag>{props.children}</InlineCodeTag>,
+ BlogCollapsible: (props: any) => <BlogCollapsible {...props} />,
}
return components
diff --git a/apps/www/tailwind.config.js b/apps/www/tailwind.config.js
index 7170ea7a8be..3b57ed14514 100644
--- a/apps/www/tailwind.config.js
+++ b/apps/www/tailwind.config.js
@@ -4,6 +4,7 @@ module.exports = config({
content: [
'../../packages/ui/src/**/*.{tsx,ts,js}',
'./pages/**/*.{tsx,mdx}',
+ './lib/mdx/mdxComponents.tsx',
'./components/**/*.tsx',
'./layouts/**/*.tsx',
'./src/**/*.{ts,tsx,mdx}',
diff --git a/packages/ui/index.tsx b/packages/ui/index.tsx
index ecd99dc70dc..c5ae0392250 100644
--- a/packages/ui/index.tsx
+++ b/packages/ui/index.tsx
@@ -146,6 +146,12 @@ export {
AccordionContent as AccordionContent_Shadcn_,
} from './src/components/shadcn/ui/accordion'
+export {
+ Collapsible as Collapsible_Shadcn_,
+ CollapsibleTrigger as CollapsibleTrigger_Shadcn_,
+ CollapsibleContent as CollapsibleContent_Shadcn_,
+} from './src/components/shadcn/ui/collapsible'
+
export { ScrollArea, ScrollBar } from './src/components/shadcn/ui/scroll-area'
// links