Skip to content

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

Merge branch 'master' into feat/ref-docs-styling

Copple7007ca75884a
diff --cc apps/reference/src/css/main.scss
index fd056e50db5,d256774a480..7614cf60dc4
--- a/apps/reference/src/css/main.scss
+++ b/apps/reference/src/css/main.scss
@@@ -345,3 -419,67 +348,68 @@@ html[data-theme='dark'] .navbar-item-di
background-repeat: no-repeat;
background-position: center;
}
+
++
+ /* PRISM */
+
+ .prism-code {
+ background-color: none;
+ word-break: break-word;
+ font-size: 0.8rem;
+ outline: none !important;
+ }
+ .prism-code div,
+ .prism-code div:focus,
+ .prism-code div:active {
+ outline: none !important;
+ }
+ .token.keyword.module,
+ .token.property-access,
+ .token.function {
+ font-style: normal !important;
+ color: #ccc !important;
+ }
+ .token.plain,
+ .token.parameter,
+ .token.punctuation,
+ .token.operator,
+ .token.console.class-name,
+ .token.doc-comment.parameter,
+ .token.doc-comment.optional-parameter,
+ .token.doc-comment.parameter.punctuation,
+ .token.doc-comment.optional-parameter.punctuation {
+ font-style: normal !important;
+ color: #ccc !important;
+ }
+ .token.keyword,
+ .token.doc-comment.keyword {
+ font-style: normal !important;
+ color: #569cd6 !important;
+ }
+ .token.string {
+ font-style: normal !important;
+ color: #24b47e !important;
+ }
+ .token.console {
+ font-style: normal !important;
+ color: #49c1ad !important;
+ }
+ .token.constant {
+ font-style: normal !important;
+ color: #569cd6 !important;
+ }
+ .token.comment {
+ font-style: normal !important;
+ color: #666 !important;
+ }
+ .token.number {
+ color: #b5cea8 !important;
+ }
+ .token.boolean,
+ .token.doc-comment.class-name {
+ @apply text-green-500;
+ }
+
+ .theme-doc-markdown h3 {
+ scroll-margin-top: 80px;
-}
++}
diff --cc apps/reference/src/theme/DocSidebar/Desktop/Content/index.js
index 1d5d55a6093,2dc910c3c82..44ab26cce0d
--- a/apps/reference/src/theme/DocSidebar/Desktop/Content/index.js
+++ b/apps/reference/src/theme/DocSidebar/Desktop/Content/index.js
@@@ -3,76 -3,19 +3,74 @@@ import Content from '@theme-original/Do
import { useLocation } from '@docusaurus/router'
import Link from '@docusaurus/Link'
+ const baseUrl = `new-docs`
const subNavRoutes = [
// Add any routes which should have a subnav
- '/docs/reference/api',
- '/docs/reference/cli',
- '/docs/reference/auth-helpers',
- '/docs/reference/auth',
- '/docs/reference/storage',
- '/docs/reference/javascript',
- '/docs/reference/dart',
+ `/${baseUrl}/reference/api`,
+ `/${baseUrl}/reference/cli`,
+ `/${baseUrl}/reference/auth`,
+ `/${baseUrl}/reference/storage`,
+ `/${baseUrl}/reference/javascript`,
+ `/${baseUrl}/reference/dart`,
]
+const headerNames = {
+ api: {
+ name: 'API',
+ icon: 'api-icon',
+ },
+ cli: {
+ name: 'CLI',
+ icon: 'cli-icon',
+ },
+ auth: {
+ name: 'Auth',
+ icon: 'javascript-icon',
+ },
+ storage: {
+ name: 'Storage',
+ icon: 'javascript-icon',
+ },
+ javascript: {
+ name: 'supabase-js',
+ icon: 'javascript-icon',
+ },
+ dart: {
+ name: 'Dart',
+ icon: 'dart-icon',
+ },
+ 'auth-helpers': {
+ name: 'Auth Helpers',
+ // icon: 'javascript-icon',
+ },
+}
+
const requiresSubNav = (pathname, routes) => {
- return routes.some((route) => pathname.indexOf(route) == 0)
+ // if (pathname.includes('reference/auth-helpers')) return false
+ const found = routes.find((route) => pathname.indexOf(route) == 0)
- console.log('found sub nav', found)
+ return found
+}
+
+const RefHeader = (props) => {
+ const paths = Object.keys(headerNames)
+ const split = props.pathname.split('/')[3]
+ const found = paths.find((p) => {
+ return split === p
+ })
- // return <p>hello world</p>
- console.log('found path', found)
++
+ return (
+ <div className="custom--main-menu-header-container">
+ {headerNames[found].icon && (
+ <div className="custom--main-menu-header__icon">
+ <img
+ src={`/docs/img/icons/${headerNames[found].icon}.svg`}
+ alt="supabase-logo"
+ />
+ </div>
+ )}
+ <h4 className="custom--main-menu-header">{headerNames[found].name}</h4>
+ </div>
+ )
}
export default function ContentWrapper(props) {
@@@ -80,29 -23,24 +78,29 @@@
return (
<>
- {pathname && requiresSubNav(pathname, subNavRoutes) && (
- <Link to={`/${baseUrl}/reference`} id="custom--main-menu-button">
- <svg
- width="24"
- height="24"
- viewBox="0 0 24 24"
- fill="none"
- xmlns="http://www.w3.org/2000/svg"
- >
- <path
- d="M20.3284 11.0001V13.0001L7.50011 13.0001L10.7426 16.2426L9.32842 17.6568L3.67157 12L9.32842 6.34314L10.7426 7.75735L7.49988 11.0001L20.3284 11.0001Z"
- fill="currentColor"
- />
- </svg>
- <span>All Reference Docs</span>
- </Link>
- )}
- <Content {...props} />
+ <div className="theme-doc-sidebar-menu-custom-container">
+ {pathname && requiresSubNav(pathname, subNavRoutes) && (
+ <>
- <Link to="/docs/reference" className="custom--main-menu-button">
++ <Link to={`/${baseUrl}/reference`} id="custom--main-menu-button">
+ <svg
+ width="24"
+ height="24"
+ viewBox="0 0 24 24"
+ fill="none"
+ xmlns="http://www.w3.org/2000/svg"
+ >
+ <path
+ d="M20.3284 11.0001V13.0001L7.50011 13.0001L10.7426 16.2426L9.32842 17.6568L3.67157 12L9.32842 6.34314L10.7426 7.75735L7.49988 11.0001L20.3284 11.0001Z"
+ fill="currentColor"
+ />
+ </svg>
+ <span>All Reference Docs</span>
+ </Link>
+ <RefHeader pathname={pathname} />
+ </>
+ )}
+ <Content {...props} />
+ </div>
</>
)
}