Skip to content

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

updated layouts to use components

Jonathan Summers-Muirbdaf8e6889b7
diff --git a/apps/docs/layouts/ref/RefSubLayout.tsx b/apps/docs/layouts/ref/RefSubLayout.tsx
index 74b06e92576..023a71bfb2f 100644
--- a/apps/docs/layouts/ref/RefSubLayout.tsx
+++ b/apps/docs/layouts/ref/RefSubLayout.tsx
@@ -2,17 +2,19 @@ import { FC } from 'react'
interface ISectionContainer extends FC {
id: string
+ title?: string
+ monoFont?: boolean
}
type RefSubLayoutSubComponents = {
Section: ISectionContainer
+ Details: ISectionDetails
+ Examples: ISectionExamples
}
type RefSubLayoutType = {}
-const RefSubLayout: React.FunctionComponent<RefSubLayoutType> & RefSubLayoutSubComponents = (
- props
-) => {
+const RefSubLayout: FC<RefSubLayoutType> & RefSubLayoutSubComponents = (props) => {
return (
<div className="flex my-16">
<div className="w-full">
@@ -24,13 +26,39 @@ const RefSubLayout: React.FunctionComponent<RefSubLayoutType> & RefSubLayoutSubC
const Section: FC<ISectionContainer> = (props) => {
return (
- <div className="grid grid-cols-2 ref-container gap-10" key={props.id} id={props.id}>
- {props.children}
+ <article key={props.id} id={props.id}>
+ <header className="not-prose mb-12">
+ <h1
+ className={['text-xl font-medium text-scale-1200', props.monoFont && 'font-mono'].join(
+ ' '
+ )}
+ >
+ {props.title}
+ </h1>
+ </header>
+ <div className="grid grid-cols-2 ref-container gap-16">{props.children}</div>
+ </article>
+ )
+}
+
+interface ISectionDetails extends FC {}
+
+const Details: FC<ISectionDetails> = (props) => {
+ return <div className="">{props.children}</div>
+}
+
+interface ISectionExamples extends FC {}
+
+const Examples: FC<ISectionExamples> = (props) => {
+ return (
+ <div className="w-full">
+ <div className="sticky top-24">{props.children}</div>
</div>
)
}
// @ts-ignore // needs typing with FC type
RefSubLayout.Section = Section
-
+RefSubLayout.Details = Details
+RefSubLayout.Examples = Examples
export default RefSubLayout
diff --git a/apps/docs/pages/new/reference/cli/[...slug].tsx b/apps/docs/pages/new/reference/cli/[...slug].tsx
index 86953e9853c..be3c615a6b3 100644
--- a/apps/docs/pages/new/reference/cli/[...slug].tsx
+++ b/apps/docs/pages/new/reference/cli/[...slug].tsx
@@ -3,6 +3,7 @@ import cliSpec from '~/../../spec/cli_v1_commands_new_shape.yaml' assert { type:
import CodeBlock from '~/components/CodeBlock/CodeBlock'
import Options from '~/components/Options'
import Param from '~/components/Params'
+import RefSubLayout from '~/layouts/ref/RefSubLayout'
export type AcceptedValue = {
id: string
@@ -33,7 +34,7 @@ export type Command = {
export default function CliUsage() {
return (
- <article>
+ <RefSubLayout>
<div className="flex my-16">
<div className="w-full">
<p className="">{cliSpec.info.description}</p>
@@ -41,75 +42,81 @@ export default function CliUsage() {
<div className="grid gap-32 mx-auto max-w-5xl mt-24">
{cliSpec.commands.map((command: Command, commandIndex) => {
return (
- <div>
- <div className="grid ref-container" id={command.id}>
- <div className="border-b pb-8" key={command.id}>
- <header
- className={[
- // 'border-b sticky top-16 z-10',
- ' mb-16',
- ].join(' ')}
- >
- <h2 className="mb-4 scroll-mt-16 mt-0 font-mono text-scale-1200">
- $ {command.title}
- </h2>
- <p className="capitalize mb-4 scroll-mt-16 mt-0 text-scale-1100 text-base">
- {command.summary}
- </p>
- </header>
+ <RefSubLayout.Section title={'$ ' + command.title} id={command.id} monoFont={true}>
+ <RefSubLayout.Details>
+ <div className="grid ref-container" id={command.id}>
+ <div className="border-b pb-8" key={command.id}>
+ <header
+ className={[
+ // 'border-b sticky top-16 z-10',
+ ' mb-16',
+ ].join(' ')}
+ >
+ <p className="capitalize mb-4 scroll-mt-16 mt-0 text-scale-1100 text-base">
+ {command.summary}
+ </p>
+ </header>
- {command.usage && (
- <CodeBlock language="bash" className="relative">
- {command.usage}
- </CodeBlock>
- )}
+ {/* {command.usage && (
+ <CodeBlock language="bash" className="relative">
+ {command.usage}
+ </CodeBlock>
+ )} */}
- {command.subcommands.length > 0 && (
- <div className="">
- <h3 className="text-sm font-bold text-scale-1200 mb-3">
- Available Commands
- </h3>
- <ul>
- {command.subcommands.map((subcommand) => (
- <li key={subcommand}>
- <a href={`#${subcommand}`}>
- <CodeBlock language="bash">{subcommand}</CodeBlock>
- </a>
- </li>
- ))}
- </ul>
- </div>
- )}
- {command.flags.length > 0 && (
- <>
- <h3 className="text-lg text-scale-1200 mb-3">Flags</h3>
- <ul className="">
- {command.flags.map((flag: Flag) => (
- <>
- <li className="mt-0">
- <Param {...flag}>
- {flag?.accepted_values && (
- <Options>
- {flag?.accepted_values.map((value) => {
- return <Options.Option {...value} />
- })}
- </Options>
- )}
- </Param>
+ {command.subcommands.length > 0 && (
+ <div className="">
+ <h3 className="text-sm font-bold text-scale-1200 mb-3">
+ Available Commands
+ </h3>
+ <ul>
+ {command.subcommands.map((subcommand) => (
+ <li key={subcommand}>
+ <a href={`#${subcommand}`}>
+ <CodeBlock language="bash">{subcommand}</CodeBlock>
+ </a>
</li>
- </>
- ))}
- </ul>
- </>
- )}
+ ))}
+ </ul>
+ </div>
+ )}
+ {command.flags.length > 0 && (
+ <>
+ <h3 className="text-lg text-scale-1200 mb-3">Flags</h3>
+ <ul className="">
+ {command.flags.map((flag: Flag) => (
+ <>
+ <li className="mt-0">
+ <Param {...flag}>
+ {flag?.accepted_values && (
+ <Options>
+ {flag?.accepted_values.map((value) => {
+ return <Options.Option {...value} />
+ })}
+ </Options>
+ )}
+ </Param>
+ </li>
+ </>
+ ))}
+ </ul>
+ </>
+ )}
+ </div>
</div>
- </div>
- </div>
+ </RefSubLayout.Details>
+ <RefSubLayout.Examples>
+ {command.usage && (
+ <CodeBlock language="bash" className="relative">
+ {command.usage}
+ </CodeBlock>
+ )}
+ </RefSubLayout.Examples>
+ </RefSubLayout.Section>
)
})}
</div>
</div>
</div>
- </article>
+ </RefSubLayout>
)
}
diff --git a/apps/docs/pages/new/reference/javascript/[...slug].tsx b/apps/docs/pages/new/reference/javascript/[...slug].tsx
index 22db758768f..2a40f4fb0e1 100644
--- a/apps/docs/pages/new/reference/javascript/[...slug].tsx
+++ b/apps/docs/pages/new/reference/javascript/[...slug].tsx
@@ -86,100 +86,111 @@ export default function JSReference(props) {
const shortText = hasTsRef ? tsDefinition.signatures[0].comment.shortText : ''
return (
- <RefSubLayout.Section>
- <div className="prose" key={item.id}>
- <header className={['mb-16'].join(' ')}>
- <h2
- className="text-2xl text-scale-1200 capitalize mb-4 scroll-mt-16"
- onClick={() => updateUrl(item.id)}
- >
- {examples.functions[itemIndex].title ??
- examples.functions[itemIndex].id ??
- item.name ??
- item.id}
- </h2>
- {shortText && (
- <>
- <p
- className="text-sm text-scale-1100"
- dangerouslySetInnerHTML={{ __html: shortText }}
- ></p>
- {/* <ComesFrom
+ <>
+ <RefSubLayout.Section
+ key={item.id}
+ title={
+ examples.functions[itemIndex].title ??
+ examples.functions[itemIndex].id ??
+ item.name ??
+ item.id
+ }
+ id={item.id}
+ >
+ <RefSubLayout.Details>
+ <>
+ <header className={['mb-16'].join(' ')}>
+ {/* <h2
+ className="text-2xl text-scale-1200 capitalize mb-4 scroll-mt-16"
+ onClick={() => updateUrl(item.id)}
+ >
+ {examples.functions[itemIndex].title ??
+ examples.functions[itemIndex].id ??
+ item.name ??
+ item.id}
+ </h2> */}
+ {shortText && (
+ <>
+ <p
+ className="text-sm text-scale-1100"
+ dangerouslySetInnerHTML={{ __html: shortText }}
+ ></p>
+ {/* <ComesFrom
link="https://raw.githubusercontent.com/supabase/supabase/master/spec/enrichments/tsdoc_v2/combined.json"
text="combined.json"
/> */}
- </>
- )}
- </header>
+ </>
+ )}
+ </header>
- {item.description && (
- <>
- {/* <ComesFrom
+ {item.description && (
+ <div className="prose">
+ {/* <ComesFrom
link="https://raw.githubusercontent.com/supabase/supabase/master/spec/enrichments/tsdoc_v2/combined.json"
text="combined.json"
/> */}
- <p className="text-sm">{item.description}</p>
- </>
- )}
- {functionMarkdownContent && (
- <>
- {/* <ComesFrom
+ <p className="text-sm">{item.description}</p>
+ </div>
+ )}
+ {functionMarkdownContent && (
+ <div className="prose">
+ {/* <ComesFrom
link="https://github.com/supabase/supabase/pull/10095/files#diff-bf42aab7d324c5330e4ae65d94803cd6da686d2241015536b0263e7f76aeca35"
text="auth.signUp().mdx"
/> */}
- <MDXRemote {...functionMarkdownContent} components={components} />
- </>
- )}
- {item.notes && (
- <div>
- {/* <ComesFrom
+ <MDXRemote {...functionMarkdownContent} components={components} />
+ </div>
+ )}
+ {item.notes && (
+ <div className="prose">
+ {/* <ComesFrom
link="https://github.com/supabase/supabase/blob/master/spec/supabase_js_v2.yml#L105"
text="supabase_js_v2"
/> */}
- <ReactMarkdown className="text-sm">{item.notes}</ReactMarkdown>
- </div>
- )}
- {/* // parameters */}
- {parameters && (
- <div className="not-prose mt-12">
- {/* <ComesFrom
+ <ReactMarkdown className="text-sm">{item.notes}</ReactMarkdown>
+ </div>
+ )}
+ {/* // parameters */}
+ {parameters && (
+ <div className="not-prose mt-12">
+ {/* <ComesFrom
link="https://github.com/supabase/supabase/blob/master/spec/enrichments/tsdoc_v2/combined.json"
text="combined.json"
/> */}
- <h5 className="mb-3 text-base">Parameters</h5>
- <ul className="">
- {parameters.map((param) => {
- // grab override params from yaml file
- const overrideParams = item.overrideParams
-
- // params from the yaml file can override the params from parameters if it matches the name
- const overide = overrideParams?.filter((x) => {
- return param.name === x.name
- })
-
- const paramItem = overide?.length > 0 ? overide[0] : param
-
- return (
- <Param {...paramItem}>
- {paramItem.subContent && (
- <div className="mt-3">
- <Options>
- {param.subContent.map((param) => {
- return <Options.Option {...param} />
- })}
- </Options>
- </div>
- )}
- </Param>
- )
- })}
- </ul>
- {/* <div dangerouslySetInnerHTML={{ __html: parameters }}></div> */}
- </div>
- )}
- </div>
- <div className="w-full">
- <div className="sticky top-24">
+ <h5 className="mb-3 text-base">Parameters</h5>
+ <ul className="">
+ {parameters.map((param) => {
+ // grab override params from yaml file
+ const overrideParams = item.overrideParams
+
+ // params from the yaml file can override the params from parameters if it matches the name
+ const overide = overrideParams?.filter((x) => {
+ return param.name === x.name
+ })
+
+ const paramItem = overide?.length > 0 ? overide[0] : param
+
+ return (
+ <Param {...paramItem}>
+ {paramItem.subContent && (
+ <div className="mt-3">
+ <Options>
+ {param.subContent.map((param) => {
+ return <Options.Option {...param} />
+ })}
+ </Options>
+ </div>
+ )}
+ </Param>
+ )
+ })}
+ </ul>
+ {/* <div dangerouslySetInnerHTML={{ __html: parameters }}></div> */}
+ </div>
+ )}
+ </>
+ </RefSubLayout.Details>
+ <RefSubLayout.Examples>
{item.examples && (
<>
{' '}
@@ -293,9 +304,9 @@ const supabase = createClient('https://xyzcompany.supabase.co', 'public-anon-key
</Tabs>
</>
)}
- </div>
- </div>
- </RefSubLayout.Section>
+ </RefSubLayout.Examples>
+ </RefSubLayout.Section>
+ </>
)
})}
</RefSubLayout>
diff --git a/apps/docs/styles/main.scss b/apps/docs/styles/main.scss
index 6cfbe97ceff..a45b0d926ff 100644
--- a/apps/docs/styles/main.scss
+++ b/apps/docs/styles/main.scss
@@ -39,9 +39,9 @@ body {
// }
article h1 {
- margin-bottom: 2rem !important;
- font-size: 3rem !important;
- font-weight: 400 !important;
+ // margin-bottom: 2rem !important;
+ // font-size: 3rem !important;
+ // font-weight: 400 !important;
}
.thin-scrollbar {