Skip to content

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

Adding highlighting on Sidebar

Paul Copplestoned70bd589582f
diff --git a/packages/web/components/Loading.js b/packages/web/components/Loading.js
index 52d7c37f1d0..ec4ee91dbe1 100644
--- a/packages/web/components/Loading.js
+++ b/packages/web/components/Loading.js
@@ -1,5 +1,9 @@
import React, { useState, useEffect } from 'react'
export default () => {
- return <div>We haven't come up with a cool loading component yet. So all you get is is text.</div>
+ return (
+ <div style={{ textAlign: 'center', width: 800, padding: 100, margin: 'auto' }}>
+ We haven't come up with a cool loading component yet. Consider this this shittiest easter egg you've ever found.
+ </div>
+ )
}
diff --git a/packages/web/components/NavbarDocs.js b/packages/web/components/NavbarDocs.js
index 0c2c61d5839..d3ce2c67291 100644
--- a/packages/web/components/NavbarDocs.js
+++ b/packages/web/components/NavbarDocs.js
@@ -1,7 +1,10 @@
import React, { useState, useEffect } from 'react'
import Link from 'next/link'
+import { useRouter } from 'next/router'
-export default function Navbar({activeCategory}) {
+export default function Navbar({}) {
+ const router = useRouter()
+ let { category } = router.query
return (
<nav className="tabs m-none">
<ul>
@@ -12,32 +15,32 @@ export default function Navbar({activeCategory}) {
</span>
</a>
</li>
- <li className={activeCategory == 'packaged' ? 'is-active' : ''}>
+ <li className={category == 'packaged' ? 'is-active' : ''}>
<Link href={`/docs/[category]/[slug]`} as={`/docs/packaged/getting-started`}>
<a className="">Packaged</a>
</Link>
</li>
- <li className={activeCategory == 'admin-api' ? 'is-active' : ''}>
+ <li className={category == 'admin-api' ? 'is-active' : ''}>
<Link href={`/docs/[category]/[slug]`} as={`/docs/admin-api/getting-started`}>
<a className="">Admin API</a>
</Link>
</li>
- <li className={activeCategory == 'realtime' ? 'is-active' : ''}>
+ <li className={category == 'realtime' ? 'is-active' : ''}>
<Link href={`/docs/[category]/[slug]`} as={`/docs/realtime/getting-started`}>
<a className="">Realtime</a>
</Link>
</li>
- <li className={activeCategory == 'rest' ? 'is-active' : ''}>
+ <li className={category == 'rest' ? 'is-active' : ''}>
<Link href={`/docs/[category]/[slug]`} as={`/docs/restful/getting-started`}>
<a className="">Restful</a>
</Link>
</li>
- <li className={activeCategory == 'graphql' ? 'is-active' : ''}>
+ <li className={category == 'graphql' ? 'is-active' : ''}>
<Link href={`/docs/[category]/[slug]`} as={`/docs/graphql/getting-started`}>
<a className="">GraphQL</a>
</Link>
</li>
- <li className={activeCategory == 'baseless' ? 'is-active' : ''}>
+ <li className={category == 'baseless' ? 'is-active' : ''}>
<Link href={`/docs/[category]/[slug]`} as={`/docs/baseless/getting-started`}>
<a className="">Baseless</a>
</Link>
diff --git a/packages/web/components/layouts/DocsLayout.js b/packages/web/components/layouts/DocsLayout.js
index d0525842cab..e7bd914d9ac 100644
--- a/packages/web/components/layouts/DocsLayout.js
+++ b/packages/web/components/layouts/DocsLayout.js
@@ -3,9 +3,11 @@ import Navbar from '../Navbar'
import NavbarDocs from '../NavbarDocs'
import Footer from '../Footer'
import Head from 'next/head'
+import Link from 'next/link'
+import { useRouter } from 'next/router'
export default function DocsLayout(props) {
- const { sidebar, activeCategory } = props
+ const { sidebar } = props
return (
<>
<Head>
@@ -13,7 +15,7 @@ export default function DocsLayout(props) {
</Head>
<div className="">
<Navbar isFullwidth={true} />
- <NavbarDocs activeCategory={activeCategory}/>
+ <NavbarDocs />
<div className="columns m-none is-gapless">
<div className="DocsMenuColumn column is-narrow is-hidden-mobile" style={{ width: 250 }}>
{Sidebar(sidebar)}
@@ -38,8 +40,14 @@ const Sidebar = sidebar => {
})
}
-const SidebarLink = page => (
- <li key={page.slug}>
- <a className="">{page.title}</a>
- </li>
-)
+const SidebarLink = page => {
+ const router = useRouter()
+ let { category, slug } = router.query
+ return (
+ <li key={page.slug}>
+ <Link href={`/docs/[category]/[slug]`} as={`/docs/${category}/${page.slug}`}>
+ <a className={slug == page.slug ? 'is-active' : ''}>{page.title}</a>
+ </Link>
+ </li>
+ )
+}
diff --git a/packages/web/content/docs/admin-api/getting-started.mdx b/packages/web/content/docs/admin-api/getting-started.mdx
index aa3537f2679..04321ad6df2 100644
--- a/packages/web/content/docs/admin-api/getting-started.mdx
+++ b/packages/web/content/docs/admin-api/getting-started.mdx
@@ -1,16 +1,11 @@
export const metadata = {
title: 'Admin API',
- description: 'SQL is awesome, but sometimes you just want to use a technology you\'re familiar with. Why not REST?'
+ description: 'SQL is awesome, but sometimes you just want to use a technology you\'re familiar with. Why not REST?',
+ sidebarLabel: 'Getting Started'
}
-### Somthing else
+## Why?
-
-
-lorem ipsum
-lorem ipsum
-
-lorem ipsum
-lorem ipsum
\ No newline at end of file
+SQL is a bit foreign for a lot of developers. We are hoping to bridge the gap.
\ No newline at end of file
diff --git a/packages/web/content/docs/admin-api/index.js b/packages/web/content/docs/admin-api/index.js
deleted file mode 100644
index 6f79c39a9d0..00000000000
--- a/packages/web/content/docs/admin-api/index.js
+++ /dev/null
@@ -1,4 +0,0 @@
-import * as gettingStarted from './getting-started.mdx'
-export {
- gettingStarted
-}
\ No newline at end of file
diff --git a/packages/web/content/docs/admin-api/schemas.mdx b/packages/web/content/docs/admin-api/schemas.mdx
new file mode 100644
index 00000000000..2542078e802
--- /dev/null
+++ b/packages/web/content/docs/admin-api/schemas.mdx
@@ -0,0 +1,10 @@
+export const metadata = {
+ title: 'Schemas',
+ description:
+ 'A database contains one or more named schemas, which in turn contain tables. Schemas also contain other kinds of named objects, including data types, functions, and operators.',
+}
+
+## Intro
+
+A database contains one or more named schemas, which in turn contain tables. Schemas also contain other kinds of named objects, including data types, functions, and operators.
+Read more about schemas [here](https://www.postgresql.org/docs/current/ddl-schemas.html).
diff --git a/packages/web/pages/docs/[category]/[slug].js b/packages/web/pages/docs/[category]/[slug].js
index 78d3877ae30..f6e380b5ff3 100644
--- a/packages/web/pages/docs/[category]/[slug].js
+++ b/packages/web/pages/docs/[category]/[slug].js
@@ -27,7 +27,7 @@ Sidebars['packaged'] = {
introduction: ['getting-started'],
}
Sidebars['admin-api'] = {
- introduction: ['getting-started'],
+ introduction: ['getting-started', 'schemas'],
}
Sidebars['realtime'] = {
introduction: ['getting-started'],