Skip to content

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

formatting of first intro docs for supabase v2

Jonathan Summers-Muir18aed465b99a
diff --git a/apps/docs/components/index.tsx b/apps/docs/components/index.tsx
index 983528f477d..9055f17d764 100644
--- a/apps/docs/components/index.tsx
+++ b/apps/docs/components/index.tsx
@@ -20,7 +20,7 @@ import ProjectSetup from './MDX/project_setup.mdx'
import { Mermaid } from 'mdx-mermaid/lib/Mermaid'
import InlineCodeTag from './CustomHTMLElements/InlineCode'
import React from 'react'
-// import RefSubLayout from '~/layout/ref/RefSubLayout'
+import RefSubLayout from '~/layouts/ref/RefSubLayout'
import { CH } from '@code-hike/mdx/components'
const components = {
@@ -60,7 +60,7 @@ const components = {
// },
// mono: (props: any) => <code className="text-sm">{props.children}</code>,
// inlineCode: (props: { children: string }) => <InlineCodeTag {...props} />,
- // RefSubLayout:
+ RefSubLayout,
CH,
// code: (props: any) => <CodeBlock {...props} />,
}
diff --git a/apps/docs/docs/ref/js/release-notes.mdx b/apps/docs/docs/ref/js/release-notes.mdx
index 5204c4517b7..55247713e01 100644
--- a/apps/docs/docs/ref/js/release-notes.mdx
+++ b/apps/docs/docs/ref/js/release-notes.mdx
@@ -1,152 +1,259 @@
---
id: release-notes
-title: Release Notes
+title: Release Notes 2.0.0
---
Supabase.js v2 release notes.
-## 2.0.0
+<RefSubLayout.EducationRow>
+ <RefSubLayout.Details>
-Install the latest with `npm install @supabase/supabase-js`.
+ Install the latest version of @supabase/supabase-js
+
+ </RefSubLayout.Details>
+ <RefSubLayout.Examples>
+
+ ```bash Terminal
+ npm install @supabase/supabase-js
+ ```
+
+ </RefSubLayout.Examples>
+</RefSubLayout.EducationRow>
### Explicit constructor options
-All client specific options within the constructor are keyed to the library: [PR](https://github.com/supabase/supabase-js/pull/458):
-
-```jsx
-const supabase = createClient(apiURL, apiKey, {
- db: {
- schema: 'public',
- },
- auth: {
- storage: AsyncStorage,
- autoRefreshToken: true,
- persistSession: true,
- detectSessionInUrl: true,
- },
- realtime: {
- channels,
- endpoint,
- },
- global: {
- fetch: customFetch,
- headers: DEFAULT_HEADERS,
- },
-})
-```
+<RefSubLayout.EducationRow>
+ <RefSubLayout.Details>
+
+ All client specific options within the constructor are keyed to the library.
+
+ See [PR](https://github.com/supabase/supabase-js/pull/458):
+
+ </RefSubLayout.Details>
+ <RefSubLayout.Examples>
+
+ ```jsx
+ const supabase = createClient(apiURL, apiKey, {
+ db: {
+ schema: 'public',
+ },
+ auth: {
+ storage: AsyncStorage,
+ autoRefreshToken: true,
+ persistSession: true,
+ detectSessionInUrl: true,
+ },
+ realtime: {
+ channels,
+ endpoint,
+ },
+ global: {
+ fetch: customFetch,
+ headers: DEFAULT_HEADERS,
+ },
+ })
+ ```
+
+ </RefSubLayout.Examples>
+</RefSubLayout.EducationRow>
### Typescript support
-The libraries now support typescript.
+<RefSubLayout.EducationRow>
+ <RefSubLayout.Details>
+
+ The libraries now support typescript.
+
+ </RefSubLayout.Details>
+ <RefSubLayout.Examples>
+
+ <CH.Code>
+
+ ```ts v1.0
+ // previously definitions were injected in the `from()` method
+ supabase.from<Definitions['Message']>('messages').select('\*')
+ ```
+
+ ---
+
+ ```ts v2.0
+ import type { Database } from './DatabaseDefinitions'
+
+ // definitions are injected in `createClient()`
+ const supabase = createClient<Database>(SUPABASE_URL, ANON_KEY)
-```ts
-// v2 - definitions are injected in `createClient()`
-import type { Database } from './DatabaseDefinitions'
-const supabase = createClient<Database>(SUPABASE_URL, ANON_KEY)
-const { data } = await supabase.from('messages').select().match({ id: 1 })
+ const { data } = await supabase.from('messages').select().match({ id: 1 })
+ ```
-// v1 -- previously definitions were injected in the `from()` method
-supabase.from<Definitions['Message']>('messages').select('*')
-```
+ </CH.Code>
-Types can be generated via the CLI:
+ </RefSubLayout.Examples>
+ <RefSubLayout.Details>
-```bash
-supabase start
-supabase gen types typescript --local > DatabaseDefinitions.ts
-```
+ Types can be generated via the CLI:
+
+ </RefSubLayout.Details>
+ <RefSubLayout.Examples>
+
+ ```bash Terminal
+ supabase start
+ supabase gen types typescript --local > DatabaseDefinitions.ts
+ ```
+
+ </RefSubLayout.Examples>
+</RefSubLayout.EducationRow>
### Data operations return minimal
-`.insert()` / `.upsert()` / `.update()` / `.delete()` don't return rows by default: [PR](https://github.com/supabase/postgrest-js/pull/276).
+<RefSubLayout.EducationRow>
+ <RefSubLayout.Details>
+
+ `.insert()` / `.upsert()` / `.update()` / `.delete()` don't return rows by default: [PR](https://github.com/supabase/postgrest-js/pull/276).
-Previously, these methods return inserted/updated/deleted rows by default (which caused [some confusion](https://github.com/supabase/supabase/discussions/1548)), and you can opt to not return it by specifying `returning: 'minimal'`. Now the default behavior is to not return rows. To return inserted/updated/deleted rows, add a `.select()` call at the end, e.g.:
+ Previously, these methods return inserted/updated/deleted rows by default (which caused [some confusion](https://github.com/supabase/supabase/discussions/1548)), and you can opt to not return it by specifying `returning: 'minimal'`. Now the default behavior is to not return rows. To return inserted/updated/deleted rows, add a `.select()` call at the end, e.g.:
-```sql
-const { data, error } = await supabase
- .from('my_table')
- .delete()
- .eq('id', 1)
- .select()
-```
+ </RefSubLayout.Details>
+ <RefSubLayout.Examples>
+
+ ```sql
+ const { data, error } = await supabase
+ .from('my_table')
+ .delete()
+ .eq('id', 1)
+ .select()
+ ```
+
+ </RefSubLayout.Examples>
+</RefSubLayout.EducationRow>
### New ordering defaults
-`.order()` now defaults to Postgres’s default: [PR](https://github.com/supabase/postgrest-js/pull/283).
+<RefSubLayout.EducationRow>
+ <RefSubLayout.Details>
+
+ `.order()` now defaults to Postgres’s default: [PR](https://github.com/supabase/postgrest-js/pull/283).
+
+ Previously `nullsFirst` defaults to `false` , meaning `null`s are ordered last. This is bad for performance if e.g. the column uses an index with `NULLS FIRST` (which is the default direction for indexes).
-Previously `nullsFirst` defaults to `false` , meaning `null`s are ordered last. This is bad for performance if e.g. the column uses an index with `NULLS FIRST` (which is the default direction for indexes).
+ </RefSubLayout.Details>
+ <RefSubLayout.Examples>
+
+ </RefSubLayout.Examples>
+</RefSubLayout.EducationRow>
### Cookies and localstorage namespace
-Storage key name in the Auth library has changed to include project reference which means that existing websites that had their JWT expiry set to a longer time could find their users logged out with this upgrade.
+<RefSubLayout.EducationRow>
+ <RefSubLayout.Details>
+
+ Storage key name in the Auth library has changed to include project reference which means that existing websites that had their JWT expiry set to a longer time could find their users logged out with this upgrade.
+
+ </RefSubLayout.Details>
+ <RefSubLayout.Examples>
-```jsx
-const defaultStorageKey = `sb-${new URL(this.authUrl).hostname.split('.')[0]}-auth-token`
-```
+ ```jsx
+ const defaultStorageKey = `sb-${new URL(this.authUrl).hostname.split('.')[0]}-auth-token`
+ ```
+
+ </RefSubLayout.Examples>
+</RefSubLayout.EducationRow>
### New Auth Types
-Typescript typings have been reworked. `Session` interface now guarantees that it will always have an `access_token`, `refresh_token` and `user`
+<RefSubLayout.EducationRow>
+ <RefSubLayout.Details>
+
+ Typescript typings have been reworked. `Session` interface now guarantees that it will always have an `access_token`, `refresh_token` and `user`
-```jsx
-interface Session {
- provider_token?: string | null
- access_token: string
- expires_in?: number
- expires_at?: number
- refresh_token: string
- token_type: string
- user: User
-}
-```
+ </RefSubLayout.Details>
+ <RefSubLayout.Examples>
+
+ ```jsx ./types.ts
+ interface Session {
+ provider_token?: string | null
+ access_token: string
+ expires_in?: number
+ expires_at?: number
+ refresh_token: string
+ token_type: string
+ user: User
+ }
+ ```
+
+ </RefSubLayout.Examples>
+</RefSubLayout.EducationRow>
### New Auth methods
-We're removing the `signIn()` method in favor of more explicit function signatures:
-`signInWithPassword()`, `signInWithOtp()`, and `signInWithOtp()`.
-
-```ts
-// v2
-const { data } = await supabase.auth.signInWithPassword({
- email: 'hello@example',
- password: 'pass',
-})
-// v1
-const { data } = await supabase.auth.signIn({
- email: 'hello@example',
- password: 'pass',
-})
-```
+<RefSubLayout.EducationRow>
+ <RefSubLayout.Details>
-### New Realtime methods
+ We're removing the `signIn()` method in favor of more explicit function signatures:
+ `signInWithPassword()`, `signInWithOtp()`, and `signInWithOtp()`.
-There is a new `channel()` method in the Realtime library, which will be used for our Multiplayer updates.
-
-```ts
-supabase
- .channel('any_string_you_want')
- .on('presence', { event: 'track' }, (payload) => {
- console.log(payload)
- })
- .subscribe()
-
-supabase
- .channel('any_string_you_want')
- .on(
- 'postgres_changes',
- {
- event: 'INSERT',
- schema: 'public',
- table: 'movies',
- },
- (payload) => {
- console.log(payload)
- }
- )
- .subscribe()
-```
+ </RefSubLayout.Details>
+ <RefSubLayout.Examples>
+
+ <CH.Code>
+
+ ```ts v1.0
+ const { data } = await supabase.auth.signIn({
+ email: 'hello@example',
+ password: 'pass',
+ })
+ ```
+ ---
+
+ ```ts v2.0
+ const { data } = await supabase.auth.signInWithPassword({
+ email: 'hello@example',
+ password: 'pass',
+ })
+ ```
+
+ </CH.Code>
+
+ </RefSubLayout.Examples>
+</RefSubLayout.EducationRow>
+
+### New Realtime methods
-We will deprecate the `.from().on().subscribe()` method previosuly used for listening to postgres changes.
+<RefSubLayout.EducationRow>
+ <RefSubLayout.Details>
+
+ There is a new `channel()` method in the Realtime library, which will be used for our Multiplayer updates.
+
+ We will deprecate the `.from().on().subscribe()` method previosuly used for listening to postgres changes.
+
+ </RefSubLayout.Details>
+ <RefSubLayout.Examples>
+
+ ```ts
+ supabase
+ .channel('any_string_you_want')
+ .on('presence', { event: 'track' }, (payload) => {
+ console.log(payload)
+ })
+ .subscribe()
+
+ supabase
+ .channel('any_string_you_want')
+ .on(
+ 'postgres_changes',
+ {
+ event: 'INSERT',
+ schema: 'public',
+ table: 'movies',
+ },
+ (payload) => {
+ console.log(payload)
+ }
+ )
+ .subscribe()
+ ```
+
+ </RefSubLayout.Examples>
+</RefSubLayout.EducationRow>
### Deprecated setAuth()
diff --git a/apps/docs/docs/ref/js/typescript-support.mdx b/apps/docs/docs/ref/js/typescript-support.mdx
index fc1c765f752..51162da7b93 100644
--- a/apps/docs/docs/ref/js/typescript-support.mdx
+++ b/apps/docs/docs/ref/js/typescript-support.mdx
@@ -7,74 +7,122 @@ title: Typescript Support
## Generating types
-You can use our CLI to generate types:
-
-```bash
-supabase start
-supabase gen types typescript --local > lib/database.types.ts
-```
-
-These types are generated directly from your database. Given a table `public.movies`, the definition will provide the following data:
-
-```ts
-interface Database {
- public: {
- Tables: {
- movies: {
- Row: {} // The data expected to be returned from a "select" statement.
- Insert: {} // The data expected passed to an "insert" statement.
- Update: {} // The data expected passed to an "update" statement.
+<RefSubLayout.EducationRow>
+ <RefSubLayout.Details>
+
+ You can use our CLI to generate types:
+
+ </RefSubLayout.Details>
+ <RefSubLayout.Examples>
+
+ ```bash Terminal
+ supabase start
+ supabase gen types typescript --local > lib/database.types.ts
+ ```
+
+ </RefSubLayout.Examples>
+</RefSubLayout.EducationRow>
+
+<RefSubLayout.EducationRow>
+ <RefSubLayout.Details>
+
+ These types are generated directly from your database.
+
+ There is a difference between `selects`, `inserts`, and `updates`, because often you will set default values in your database for specific columns.
+ With default values you do not need to send any data over the network, even if that column is a "required" field. Our type system is granular
+ enough to handle these situations.
+
+ </RefSubLayout.Details>
+ <RefSubLayout.Examples>
+
+ Given a table `public.movies`, the definition will provide the following data:
+
+ ```ts /types.ts
+ interface Database {
+ public: {
+ Tables: {
+ movies: {
+ Row: {} // The data expected to be returned from a "select" statement.
+ Insert: {} // The data expected passed to an "insert" statement.
+ Update: {} // The data expected passed to an "update" statement.
+ }
+ }
}
}
- }
-}
-```
+ ```
-There is a difference between `selects`, `inserts`, and `updates`, because often you will set default values in your database for specific columns.
-With default values you do not need to send any data over the network, even if that column is a "required" field. Our type system is granular
-enough to handle these situations.
+ </RefSubLayout.Examples>
+</RefSubLayout.EducationRow>
## Injecting type definitions
-You can enrich the supabase client with the types you generated with Supabase.
+<RefSubLayout.EducationRow>
+ <RefSubLayout.Details>
-```ts
-import { createClient } from '@supabase/supabase-js'
-import { Database } from 'lib/database.types'
+ You can enrich the supabase client with the types you generated with Supabase.
-const supabase = createClient<Database>(process.env.SUPABASE_URL, process.env.SUPABASE_ANON_KEY)
-```
+ </RefSubLayout.Details>
+ <RefSubLayout.Examples>
+ ```ts ./index.tsx
+ import { createClient } from '@supabase/supabase-js'
+ import { Database } from 'lib/database.types'
+
+ const supabase = createClient<Database>(
+ process.env.SUPABASE_URL,
+ process.env.SUPABASE_ANON_KEY
+ )
+ ```
+
+ </RefSubLayout.Examples>
+</RefSubLayout.EducationRow>
## Type hints
-`supabase-js` always returns a `data` object (for success), and an `error` response (for unsuccessful requests).
-This provides a simple interface to get the relevant types returned from any function:
+<RefSubLayout.EducationRow>
+ <RefSubLayout.Details>
+
+ `supabase-js` always returns a `data` object (for success), and an `error` response (for unsuccessful requests).
-```ts
-export async function getMovies() {
- return await supabase.from('movies').select(`id, title`)
-}
+ This provides a simple interface to get the relevant types returned from any function:
+
+ </RefSubLayout.Details>
+ <RefSubLayout.Examples>
+ ```ts
+ export async function getMovies() {
+ return await supabase.from('movies').select(`id, title`)
+ }
-type MoviesResponse = Awaited<ReturnType<typeof getMovies>>
-export type MoviesResponseSuccess = MoviesResponse['data']
-export type MoviesResponseError = MoviesResponse['error']
-```
+ type MoviesResponse = Awaited<ReturnType<typeof getMovies>>
+ export type MoviesResponseSuccess = MoviesResponse['data']
+ export type MoviesResponseError = MoviesResponse['error']
+
+ ````
+
+ </RefSubLayout.Examples>
+</RefSubLayout.EducationRow>
## Nested tables
-For advanced queries such as nested tables, you may want to construct your own types.
+<RefSubLayout.EducationRow>
+ <RefSubLayout.Details>
+ For advanced queries such as nested tables, you may want to construct your own types.
+ </RefSubLayout.Details>
+ <RefSubLayout.Examples>
+ ```ts ./index.ts
+ import supabase from '~/lib/supabase'
+ import type { Database } from '~/lib/database.types'
+
+ async function getMovies() {
+ return await supabase.from('movies').select('id, title, actors(\*)')
+ }
-```ts
-import supabase from '~/lib/supabase'
-import type { Database } from '~/lib/database.types'
+ type Actors = Database['public']['tables']['actors']['row']
+ type MoviesResponse = Awaited<ReturnType<typeof getMovies>>
+ type MoviesResponseSuccess = MoviesResponse['data'] & {
+ actors: Actors[]
+ }
-async function getMovies() {
- return await supabase.from('movies').select('id, title, actors(*)')
-}
+ ```
-type Actors = Database['public']['Tables']['actors']['Row']
-type MoviesResponse = Awaited<ReturnType<typeof getMovies>>
-type MoviesResponseSuccess = MoviesResponse['data'] & {
- actors: Actors[]
-}
-```
+ </RefSubLayout.Examples>
+</RefSubLayout.EducationRow>
diff --git a/apps/docs/docs/reference/javascript/typescript-support.mdx b/apps/docs/docs/reference/javascript/typescript-support.mdx
index ca747ef105b..b26151cac0c 100644
--- a/apps/docs/docs/reference/javascript/typescript-support.mdx
+++ b/apps/docs/docs/reference/javascript/typescript-support.mdx
@@ -5,15 +5,25 @@ title: Typescript Support
`supabase-js` supports Typescript.
+<RefSubLayout.Details>
+
## Generating types
+hello world
+
You can use our CLI to generate types:
+</RefSubLayout.Details>
+
+<RefSubLayout.Examples>
+
```bash
supabase start
supabase gen types typescript --local > lib/database.types.ts
```
+</RefSubLayout.Examples>
+
These types are generated directly from your database. Given a table `public.movies`, the definition will provide the following data:
```tsx hello.ts
diff --git a/apps/docs/layouts/ref/RefSubLayout.tsx b/apps/docs/layouts/ref/RefSubLayout.tsx
index a1d43c069d7..6960152aa61 100644
--- a/apps/docs/layouts/ref/RefSubLayout.tsx
+++ b/apps/docs/layouts/ref/RefSubLayout.tsx
@@ -17,6 +17,8 @@ interface ISectionContainer {
type RefSubLayoutSubComponents = {
Section: FC<ISectionContainer>
+ EducationSection: FC<IEducationSection>
+ EducationRow: FC<IEducationRow>
Details: FC<ISectionDetails>
Examples: FC<ISectionExamples>
}
@@ -31,6 +33,17 @@ type StickyHeader = {
type RefSubLayoutType = {}
+interface IEducationRow {}
+interface IEducationSection {
+ id: string
+ title?: string
+ monoFont?: boolean
+ slug: string
+ scrollSpyHeader?: boolean
+}
+interface ISectionDetails {}
+interface ISectionExamples {}
+
const RefSubLayout: FC<RefSubLayoutType> & RefSubLayoutSubComponents = (props) => {
return <div className="flex flex-col w-full divide-y">{props.children}</div>
}
@@ -82,7 +95,7 @@ const StickyHeader: FC<StickyHeader> = (props) => {
id={props.slug}
data-ref-id={props.id}
className={[
- 'text-xl font-medium text-scale-1200 mb-8 scroll-mt-24',
+ 'text-x2l font-medium text-scale-1200 mb-8 scroll-mt-24',
props.monoFont && 'font-mono',
].join(' ')}
>
@@ -91,14 +104,10 @@ const StickyHeader: FC<StickyHeader> = (props) => {
)
}
-interface ISectionDetails {}
-
const Details: FC<ISectionDetails> = (props) => {
return <div>{props.children}</div>
}
-interface ISectionExamples {}
-
const Examples: FC<ISectionExamples> = (props) => {
return (
<div className="w-full">
@@ -107,7 +116,27 @@ const Examples: FC<ISectionExamples> = (props) => {
)
}
+const EducationRow: FC<IEducationRow> = (props) => {
+ return <div className="grid lg:grid-cols-2 gap-8 lg:gap-16">{props.children}</div>
+}
+
+const EducationSection: FC<IEducationSection> = (props) => {
+ // console.log({ props })
+ return (
+ <article key={props.id} className={`${'prose dark:prose-dark max-w-none py-16 lg:py-32'}`}>
+ <StickyHeader {...props} />
+
+ {props.children}
+ </article>
+ )
+}
+
+// function based layout
RefSubLayout.Section = Section
+// education based layout
+RefSubLayout.EducationSection = EducationSection
+RefSubLayout.EducationRow = EducationRow
+// common columns
RefSubLayout.Details = Details
RefSubLayout.Examples = Examples
export default RefSubLayout
diff --git a/apps/docs/layouts/ref/RefSubLayoutNonFunc.tsx b/apps/docs/layouts/ref/RefSubLayoutNonFunc.tsx
new file mode 100644
index 00000000000..af601568288
--- /dev/null
+++ b/apps/docs/layouts/ref/RefSubLayoutNonFunc.tsx
@@ -0,0 +1,115 @@
+import { useInView } from 'react-intersection-observer'
+import { FC } from 'react'
+import { highlightSelectedNavItem } from '~/components/CustomHTMLElements/CustomHTMLElements.utils'
+import { useRouter } from 'next/router'
+import { useNavigationMenuContext } from '~/components/Navigation/NavigationMenu/NavigationMenu.Context'
+import { route } from 'next/dist/server/router'
+import { menuState } from '~/hooks/useMenuState'
+
+interface ISectionContainer {
+ id: string
+ title?: string
+ monoFont?: boolean
+ slug: string
+ scrollSpyHeader?: boolean
+ singleColumn?: boolean
+}
+
+type RefSubLayoutNonFuncSubComponents = {
+ Section: FC<ISectionContainer>
+ Details: FC<ISectionDetails>
+ Examples: FC<ISectionExamples>
+}
+
+type StickyHeader = {
+ id: string
+ slug?: string
+ title?: string
+ monoFont?: boolean
+ scrollSpyHeader?: boolean // whether or not the header updates the url on scroll
+}
+
+type RefSubLayoutNonFuncType = {}
+
+const RefSubLayoutNonFunc: FC<RefSubLayoutNonFuncType> & RefSubLayoutNonFuncSubComponents = (
+ props
+) => {
+ return <div className="flex flex-col w-full divide-y">{props.children}</div>
+}
+
+const Section: FC<ISectionContainer> = (props) => {
+ // console.log({ props })
+ return (
+ <article
+ key={props.id}
+ className={`${
+ props.singleColumn ? 'prose dark:prose-dark py-16 lg:py-32 ' : 'py-16 lg:py-32'
+ }`}
+ >
+ <StickyHeader {...props} />
+ <div
+ className={`ref-container gap-16 ${
+ !props.singleColumn ? 'grid lg:grid-cols-2' : 'ref-container--full-width lg:max-w-3xl'
+ }`}
+ >
+ {props.children}
+ </div>
+ </article>
+ )
+}
+
+const StickyHeader: FC<StickyHeader> = (props) => {
+ const router = useRouter()
+ const { setActiveRefItem } = useNavigationMenuContext()
+
+ const { ref } = useInView({
+ threshold: 1,
+ rootMargin: '30% 0% -35% 0px',
+ onChange: (inView, entry) => {
+ if (inView && window) highlightSelectedNavItem(entry.target.attributes['data-ref-id'].value)
+ if (inView && props.scrollSpyHeader) {
+ window.history.replaceState(null, '', entry.target.id)
+ // if (setActiveRefItem) setActiveRefItem(entry.target.attributes['data-ref-id'].value)
+ menuState.setMenuActiveRefId(entry.target.attributes['data-ref-id'].value)
+ // router.push(`/reference/javascript/${entry.target.attributes['data-ref-id'].value}`, null, {
+ // shallow: true,
+ // })
+ }
+ },
+ })
+
+ return (
+ <h2
+ ref={ref}
+ id={props.slug}
+ data-ref-id={props.id}
+ className={[
+ 'text-xl font-medium text-scale-1200 mb-8 scroll-mt-24',
+ props.monoFont && 'font-mono',
+ ].join(' ')}
+ >
+ {props.title && <span className="max-w-xl">{props.title}</span>}
+ </h2>
+ )
+}
+
+interface ISectionDetails {}
+
+const Details: FC<ISectionDetails> = (props) => {
+ return <div>{props.children}</div>
+}
+
+interface ISectionExamples {}
+
+const Examples: FC<ISectionExamples> = (props) => {
+ return (
+ <div className="w-full">
+ <div className="sticky top-24">{props.children}</div>
+ </div>
+ )
+}
+
+RefSubLayoutNonFunc.Section = Section
+RefSubLayoutNonFunc.Details = Details
+RefSubLayoutNonFunc.Examples = Examples
+export default RefSubLayoutNonFunc
diff --git a/apps/docs/pages/reference/javascript/[...slug].tsx b/apps/docs/pages/reference/javascript/[...slug].tsx
index ce3c4379b33..e7ca1e2d665 100644
--- a/apps/docs/pages/reference/javascript/[...slug].tsx
+++ b/apps/docs/pages/reference/javascript/[...slug].tsx
@@ -270,16 +270,15 @@ export default function JSReference(props) {
{props.docs
.filter((doc) => doc.introPage)
.map((item) => (
- <RefSubLayout.Section
+ <RefSubLayout.EducationSection
key={item.id}
title={item.meta.title}
id={item.id}
slug={item.id}
scrollSpyHeader={true}
- singleColumn={true}
>
<MDXRemote {...item.content} components={components} />
- </RefSubLayout.Section>
+ </RefSubLayout.EducationSection>
))}
{/* jsSpec.functions.map((item, itemIndex) => { */}
{props.docs