mirror of
https://github.com/supabase/supabase.git
synced 2026-10-05 09:25:06 +03:00
Cleanup and add social icons
This commit is contained in:
1 parent
6be194cf68
commit
73b0c16057
11 files changed
+60
-728
No files matched your search
@@ -1,45 +0,0 @@
|
||||
import { useTheme } from 'common/Providers'
|
||||
import { IconSun, IconMoon } from '@supabase/ui'
|
||||
|
||||
function DarkModeToggle() {
|
||||
const { isDarkMode, toggleTheme } = useTheme()
|
||||
|
||||
const toggleDarkMode = () => {
|
||||
localStorage.setItem('supabaseDarkMode', (!isDarkMode).toString())
|
||||
toggleTheme()
|
||||
|
||||
const key = localStorage.getItem('supabaseDarkMode')
|
||||
document.documentElement.className = key === 'true' ? 'dark' : ''
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="flex items-center">
|
||||
<IconSun className="text-scale-900" strokeWidth={2} />
|
||||
<button
|
||||
type="button"
|
||||
aria-pressed="false"
|
||||
className={`
|
||||
relative inline-flex h-6 w-11 flex-shrink-0 cursor-pointer rounded-full border-2 border-transparent
|
||||
transition-colors duration-200 ease-in-out focus:outline-none ${
|
||||
isDarkMode ? 'bg-scale-500' : 'bg-scale-900'
|
||||
} mx-5
|
||||
`}
|
||||
onClick={() => toggleDarkMode()}
|
||||
>
|
||||
<span className="sr-only">Toggle Themes</span>
|
||||
<span
|
||||
aria-hidden="true"
|
||||
className={`
|
||||
${
|
||||
isDarkMode ? 'translate-x-5' : 'translate-x-0'
|
||||
} dark:bg-scale-300 inline-block h-5 w-5
|
||||
transform rounded-full bg-white shadow-lg ring-0 transition duration-200 ease-in-out
|
||||
`}
|
||||
/>
|
||||
</button>
|
||||
<IconMoon className="text-scale-900" strokeWidth={2} />
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default DarkModeToggle
|
||||
@@ -1,133 +0,0 @@
|
||||
import { Badge } from 'ui'
|
||||
import Link from 'next/link'
|
||||
import Image from 'next/image'
|
||||
import FooterLinks from 'data/footer.json'
|
||||
import DarkModeToggle from './DarkModeToggle'
|
||||
import { useTheme } from 'common/Providers'
|
||||
import * as supabaseLogoWordmarkDark from 'common/assets/images/supabase-logo-wordmark--dark.png'
|
||||
import * as supabaseLogoWordmarkLight from 'common/assets/images/supabase-logo-wordmark--light.png'
|
||||
|
||||
const Footer = () => {
|
||||
const { isDarkMode } = useTheme()
|
||||
|
||||
return (
|
||||
<footer
|
||||
className="border-scale-500 dark:border-scale-600 border-t"
|
||||
aria-labelledby="footerHeading"
|
||||
>
|
||||
<h2 id="footerHeading" className="sr-only">
|
||||
Footer
|
||||
</h2>
|
||||
<div className="sm:py-18 container relative mx-auto px-6 py-16 md:py-24 lg:px-16 lg:py-24 xl:px-20">
|
||||
<div className="xl:grid xl:grid-cols-3 xl:gap-8">
|
||||
<div className="space-y-8 xl:col-span-1">
|
||||
<Link href="#" as="/">
|
||||
<a className="w-40">
|
||||
<Image
|
||||
src={isDarkMode ? supabaseLogoWordmarkDark : supabaseLogoWordmarkLight}
|
||||
width={160}
|
||||
height={30}
|
||||
alt="Supabase"
|
||||
/>
|
||||
</a>
|
||||
</Link>
|
||||
<div className="flex space-x-5">
|
||||
<a
|
||||
href="https://twitter.com/supabase"
|
||||
className="text-scale-900 hover:text-scale-1200 transition"
|
||||
>
|
||||
<span className="sr-only">Twitter</span>
|
||||
<svg className="h-6 w-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true">
|
||||
<path d="M8.29 20.251c7.547 0 11.675-6.253 11.675-11.675 0-.178 0-.355-.012-.53A8.348 8.348 0 0022 5.92a8.19 8.19 0 01-2.357.646 4.118 4.118 0 001.804-2.27 8.224 8.224 0 01-2.605.996 4.107 4.107 0 00-6.993 3.743 11.65 11.65 0 01-8.457-4.287 4.106 4.106 0 001.27 5.477A4.072 4.072 0 012.8 9.713v.052a4.105 4.105 0 003.292 4.022 4.095 4.095 0 01-1.853.07 4.108 4.108 0 003.834 2.85A8.233 8.233 0 012 18.407a11.616 11.616 0 006.29 1.84" />
|
||||
</svg>
|
||||
</a>
|
||||
|
||||
<a
|
||||
href="https://github.com/supabase"
|
||||
className="text-scale-900 hover:text-scale-1200 transition"
|
||||
>
|
||||
<span className="sr-only">GitHub</span>
|
||||
<svg className="h-6 w-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true">
|
||||
<path
|
||||
fillRule="evenodd"
|
||||
d="M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z"
|
||||
clipRule="evenodd"
|
||||
/>
|
||||
</svg>
|
||||
</a>
|
||||
|
||||
<a
|
||||
href="https://discord.supabase.com/"
|
||||
className="text-scale-900 hover:text-scale-1200 transition"
|
||||
>
|
||||
<span className="sr-only">Discord</span>
|
||||
<svg className="h-6 w-6" fill="currentColor" viewBox="0 0 71 55" aria-hidden="true">
|
||||
<path
|
||||
fillRule="evenodd"
|
||||
d="M60.1045 4.8978C55.5792 2.8214 50.7265 1.2916 45.6527 0.41542C45.5603 0.39851 45.468 0.440769 45.4204 0.525289C44.7963 1.6353 44.105 3.0834 43.6209 4.2216C38.1637 3.4046 32.7345 3.4046 27.3892 4.2216C26.905 3.0581 26.1886 1.6353 25.5617 0.525289C25.5141 0.443589 25.4218 0.40133 25.3294 0.41542C20.2584 1.2888 15.4057 2.8186 10.8776 4.8978C10.8384 4.9147 10.8048 4.9429 10.7825 4.9795C1.57795 18.7309 -0.943561 32.1443 0.293408 45.3914C0.299005 45.4562 0.335386 45.5182 0.385761 45.5576C6.45866 50.0174 12.3413 52.7249 18.1147 54.5195C18.2071 54.5477 18.305 54.5139 18.3638 54.4378C19.7295 52.5728 20.9469 50.6063 21.9907 48.5383C22.0523 48.4172 21.9935 48.2735 21.8676 48.2256C19.9366 47.4931 18.0979 46.6 16.3292 45.5858C16.1893 45.5041 16.1781 45.304 16.3068 45.2082C16.679 44.9293 17.0513 44.6391 17.4067 44.3461C17.471 44.2926 17.5606 44.2813 17.6362 44.3151C29.2558 49.6202 41.8354 49.6202 53.3179 44.3151C53.3935 44.2785 53.4831 44.2898 53.5502 44.3433C53.9057 44.6363 54.2779 44.9293 54.6529 45.2082C54.7816 45.304 54.7732 45.5041 54.6333 45.5858C52.8646 46.6197 51.0259 47.4931 49.0921 48.2228C48.9662 48.2707 48.9102 48.4172 48.9718 48.5383C50.038 50.6034 51.2554 52.5699 52.5959 54.435C52.6519 54.5139 52.7526 54.5477 52.845 54.5195C58.6464 52.7249 64.529 50.0174 70.6019 45.5576C70.6551 45.5182 70.6887 45.459 70.6943 45.3942C72.1747 30.0791 68.2147 16.7757 60.1968 4.9823C60.1772 4.9429 60.1437 4.9147 60.1045 4.8978ZM23.7259 37.3253C20.2276 37.3253 17.3451 34.1136 17.3451 30.1693C17.3451 26.225 20.1717 23.0133 23.7259 23.0133C27.308 23.0133 30.1626 26.2532 30.1066 30.1693C30.1066 34.1136 27.28 37.3253 23.7259 37.3253ZM47.3178 37.3253C43.8196 37.3253 40.9371 34.1136 40.9371 30.1693C40.9371 26.225 43.7636 23.0133 47.3178 23.0133C50.9 23.0133 53.7545 26.2532 53.6986 30.1693C53.6986 34.1136 50.9 37.3253 47.3178 37.3253Z"
|
||||
clipRule="evenodd"
|
||||
/>
|
||||
</svg>
|
||||
</a>
|
||||
|
||||
<a
|
||||
href="https://youtube.com/c/supabase"
|
||||
className="text-scale-900 hover:text-scale-1200 transition"
|
||||
>
|
||||
<span className="sr-only">Youtube</span>
|
||||
<svg
|
||||
className="h-6 w-6"
|
||||
fill="currentColor"
|
||||
viewBox="0 0 576 512"
|
||||
aria-hidden="true"
|
||||
>
|
||||
<path d="M549.655 124.083c-6.281-23.65-24.787-42.276-48.284-48.597C458.781 64 288 64 288 64S117.22 64 74.629 75.486c-23.497 6.322-42.003 24.947-48.284 48.597-11.412 42.867-11.412 132.305-11.412 132.305s0 89.438 11.412 132.305c6.281 23.65 24.787 41.5 48.284 47.821C117.22 448 288 448 288 448s170.78 0 213.371-11.486c23.497-6.321 42.003-24.171 48.284-47.821 11.412-42.867 11.412-132.305 11.412-132.305s0-89.438-11.412-132.305zm-317.51 213.508V175.185l142.739 81.205-142.739 81.201z" />
|
||||
</svg>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div className="mt-12 grid grid-cols-1 gap-8 xl:col-span-2 xl:mt-0">
|
||||
<div className="grid grid-cols-2 gap-8 md:grid-cols-4">
|
||||
{FooterLinks.map((segment: any) => {
|
||||
return (
|
||||
<div key={`footer_${segment.title}`}>
|
||||
<h6 className="text-scale-1200 overwrite text-base">{segment.title}</h6>
|
||||
<ul className="mt-4 space-y-2">
|
||||
{segment.links.map((link: any, idx: number) => (
|
||||
<li key={`${segment.title}_link_${idx}`}>
|
||||
<a
|
||||
href={link.url}
|
||||
className={`text-sm transition-colors ${
|
||||
link.url
|
||||
? 'text-scale-1100 hover:text-scale-1200 '
|
||||
: 'text-scale-900 hover:text-scale-900'
|
||||
} `}
|
||||
>
|
||||
{link.text}
|
||||
{!link.url && (
|
||||
<div className="ml-2 inline text-xs xl:ml-0 xl:block 2xl:ml-2 2xl:inline">
|
||||
<Badge color="scale" size="small">
|
||||
Coming soon
|
||||
</Badge>
|
||||
</div>
|
||||
)}
|
||||
</a>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</div>
|
||||
)
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="border-scale-500 dark:border-scale-600 mt-32 flex justify-between border-t pt-8">
|
||||
<small className="small">© Supabase Inc</small>
|
||||
<DarkModeToggle />
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
)
|
||||
}
|
||||
|
||||
export default Footer
|
||||
@@ -1,11 +1,13 @@
|
||||
const FooterHelpCallout = () => {
|
||||
return (
|
||||
<div className="min-w-full px-8 py-6 prose bg-scale-300 dark:bg-whiteA-200 rounded">
|
||||
<h5 className="text-sm m-0 text-scale-1100">Need some help?</h5>
|
||||
<p className="m-0 text-sm text-scale-900">
|
||||
Not to worry, our specialist engineers are here to help. Submit a support ticket through the{' '}
|
||||
<a href="https://app.supabase.com/support/new">Dashboard</a>.
|
||||
</p>
|
||||
<div className="mt-32">
|
||||
<div className="min-w-full px-8 py-6 prose bg-scale-300 dark:bg-whiteA-200 rounded">
|
||||
<h5 className="text-sm m-0 text-scale-1100">Need some help?</h5>
|
||||
<p className="m-0 text-sm text-scale-900">
|
||||
Not to worry, our specialist engineers are here to help. Submit a support ticket through
|
||||
the <a href="https://app.supabase.com/support/new">Dashboard</a>.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
import Link from 'next/link'
|
||||
|
||||
const Footer = () => {
|
||||
return (
|
||||
<div>
|
||||
<hr className="border-scale-400 mt-8"></hr>
|
||||
<div className="flex flex-col lg:flex-row gap-3 mt-6">
|
||||
<span className="text-xs text-scale-900">Supabase 2022</span>
|
||||
<span className="text-xs text-scale-900">—</span>
|
||||
<Link href="/handbook/contributing">
|
||||
<a className="text-xs text-scale-800 hover:underline">Contributing</a>
|
||||
</Link>
|
||||
<Link href="https://supabase.com/changelog">
|
||||
<a className="text-xs text-scale-800 hover:underline">Changelog</a>
|
||||
</Link>
|
||||
|
||||
<Link href="https://github.com/supabase/supabase/blob/master/DEVELOPERS.md">
|
||||
<a className="text-xs text-scale-800 hover:underline">Author Styleguide</a>
|
||||
</Link>
|
||||
<Link href="https://supabase.com/docs/oss">
|
||||
<a className="text-xs text-scale-800 hover:underline">Open Source</a>
|
||||
</Link>
|
||||
<Link href="https://supabase.com/supasquad">
|
||||
<a className="text-xs text-scale-800 hover:underline">SupaSquad</a>
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default Footer
|
||||
@@ -2,19 +2,7 @@ import Image from 'next/image'
|
||||
import Link from 'next/link'
|
||||
import { useRouter } from 'next/router'
|
||||
import { FC, useEffect, useState } from 'react'
|
||||
import {
|
||||
Badge,
|
||||
Button,
|
||||
Dropdown,
|
||||
IconCommand,
|
||||
IconMenu,
|
||||
IconMessageSquare,
|
||||
IconMoon,
|
||||
IconSearch,
|
||||
IconSun,
|
||||
Input,
|
||||
Listbox,
|
||||
} from 'ui'
|
||||
import { Button, IconCommand, IconGitHub, IconMoon, IconSearch, IconSun } from 'ui'
|
||||
import { SearchButton } from '~/components/DocSearch'
|
||||
import { REFERENCES } from '~/components/Navigation/Navigation.constants'
|
||||
import { useTheme } from 'common/Providers'
|
||||
@@ -134,7 +122,7 @@ const TopNavBarRef: FC = () => {
|
||||
target="_blank"
|
||||
rel="noreferrer noopener"
|
||||
>
|
||||
Main site
|
||||
Supabase.com
|
||||
</Button>
|
||||
<Button
|
||||
type="text"
|
||||
@@ -146,6 +134,18 @@ const TopNavBarRef: FC = () => {
|
||||
>
|
||||
Dashboard
|
||||
</Button>
|
||||
<ul className="flex items-center">
|
||||
<Button
|
||||
type="text"
|
||||
as="a"
|
||||
// @ts-ignore
|
||||
href="https://github.com/supabase/supabase"
|
||||
target="_blank"
|
||||
rel="noreferrer noopener"
|
||||
>
|
||||
<IconGitHub size={16} />
|
||||
</Button>
|
||||
</ul>
|
||||
<ul className="flex items-center">
|
||||
<li className="px-4">
|
||||
<div className="cursor-pointer" onClick={toggleDarkMode}>
|
||||
|
||||
@@ -5,7 +5,7 @@ import { useEffect } from 'react'
|
||||
import components from '~/components'
|
||||
import RefEducationSection from '~/components/reference/RefEducationSection'
|
||||
import RefFunctionSection from '~/components/reference/RefFunctionSection'
|
||||
import OldLayout from '~/layouts/Default'
|
||||
|
||||
import RefSubLayout from '~/layouts/ref/RefSubLayout'
|
||||
import ApiOperationSection from './ApiOperationSection'
|
||||
import CliCommandSection from './CLICommandSection'
|
||||
@@ -34,18 +34,6 @@ const RefSectionHandler = (props) => {
|
||||
}
|
||||
})
|
||||
|
||||
/*
|
||||
* handle old ref pages
|
||||
*/
|
||||
if (!isNewDocs) {
|
||||
return (
|
||||
// @ts-ignore
|
||||
<OldLayout meta={props.pageProps.meta} toc={props.pageProps.toc}>
|
||||
<MDXRemote {...props.pageProps.content} components={components} />
|
||||
</OldLayout>
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<RefSubLayout>
|
||||
{props.sections.map((x) => {
|
||||
|
||||
@@ -1,94 +0,0 @@
|
||||
import { useEffect, FC } from 'react'
|
||||
import { NextSeo } from 'next-seo'
|
||||
import NavBar from '../components/Navigation/NavBar'
|
||||
import SideBar from '../components/Navigation/SideBar'
|
||||
import Footer from '../components/Footer'
|
||||
import TableOfContents from '~/components/TableOfContents'
|
||||
import { menuItems } from '~/components/Navigation/Navigation.constants'
|
||||
import { useRouter } from 'next/router'
|
||||
import { getPageType } from '~/lib/helpers'
|
||||
|
||||
interface Props {
|
||||
meta: { title: string; description?: string; hide_table_of_contents?: boolean }
|
||||
children: any
|
||||
toc?: any
|
||||
menuItems?: any
|
||||
currentPage?: string
|
||||
}
|
||||
|
||||
const Layout: FC<Props> = ({ meta, children, toc }) => {
|
||||
const { asPath } = useRouter()
|
||||
|
||||
useEffect(() => {
|
||||
const key = localStorage.getItem('supabaseDarkMode')
|
||||
if (!key) {
|
||||
// Default to dark mode if no preference config
|
||||
document.documentElement.className = 'dark'
|
||||
} else {
|
||||
document.documentElement.className = key === 'true' ? 'dark' : ''
|
||||
}
|
||||
}, [])
|
||||
|
||||
const hasTableOfContents =
|
||||
toc !== undefined && toc.json.filter((item) => item.lvl !== 1 && item.lvl <= 3).length > 0
|
||||
|
||||
const pageType = getPageType(asPath)
|
||||
|
||||
console.log('Default, pageType', pageType)
|
||||
|
||||
return (
|
||||
<>
|
||||
<NextSeo
|
||||
title={`${meta?.title} | Supabase`}
|
||||
description={meta?.description ? meta?.description : meta?.title}
|
||||
openGraph={{
|
||||
title: meta?.title,
|
||||
description: meta?.description,
|
||||
url: `https://supabase.com/docs/${asPath}`,
|
||||
images: [
|
||||
{
|
||||
url: `https://supabase.com/docs/img/supabase-og-image.png`,
|
||||
},
|
||||
],
|
||||
}}
|
||||
/>
|
||||
|
||||
<main>
|
||||
<NavBar />
|
||||
<div className="flex w-full flex-row">
|
||||
<SideBar menuItems={menuItems[pageType]} />
|
||||
<div className="main-content-pane docs-width grid md:grid-cols-12 gap-4 justify-between p-4 pb-8 w-full">
|
||||
<div
|
||||
className={`${
|
||||
meta?.hide_table_of_contents || !hasTableOfContents
|
||||
? 'col-span-12 xl:col-start-2 xl:col-span-10 2xl:col-start-3 2xl:col-span-8'
|
||||
: 'col-span-12 lg:col-span-9'
|
||||
} py-2 lg:py-4 px-2 lg:px-8 mx-auto`}
|
||||
>
|
||||
<article
|
||||
className={`${
|
||||
meta?.hide_table_of_contents || !hasTableOfContents ? 'xl:min-w-[880px]' : ''
|
||||
} doc-content-container prose dark:prose-dark dark:bg-scale-200 width-full mt-8 2xl:max-w-[880px]`}
|
||||
>
|
||||
{children}
|
||||
</article>
|
||||
</div>
|
||||
{hasTableOfContents && !meta?.hide_table_of_contents && (
|
||||
<div
|
||||
className={[
|
||||
'border-scale-400 dark:bg-scale-200 table-of-contents-height border-l',
|
||||
'thin-scrollbar overflow-y-auto sticky hidden xl:block md:col-span-3 px-2',
|
||||
].join(' ')}
|
||||
>
|
||||
<TableOfContents toc={toc} />
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
<Footer />
|
||||
</main>
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
export default Layout
|
||||
@@ -9,8 +9,9 @@ import FooterHelpCallout from '~/components/FooterHelpCallout'
|
||||
|
||||
import { menuState, useMenuLevelId, useMenuMobileOpen } from '~/hooks/useMenuState'
|
||||
import { useEffect } from 'react'
|
||||
import Footer from '~/components/Navigation/Footer'
|
||||
|
||||
const SiteRefLayout = ({ children }) => {
|
||||
const SiteLayout = ({ children }) => {
|
||||
const { isDarkMode } = useTheme()
|
||||
|
||||
useEffect(() => {
|
||||
@@ -270,31 +271,8 @@ const SiteRefLayout = ({ children }) => {
|
||||
</div>
|
||||
<div className="grow px-5 max-w-7xl mx-auto py-16">
|
||||
{children}
|
||||
|
||||
<div className="mt-32">
|
||||
<FooterHelpCallout />
|
||||
</div>
|
||||
<hr className="border-scale-400 mt-8"></hr>
|
||||
<div className="flex flex-col lg:flex-row gap-3 mt-6">
|
||||
<span className="text-xs text-scale-900">Supabase 2022</span>
|
||||
<span className="text-xs text-scale-900">—</span>
|
||||
<Link href="/handbook/contributing">
|
||||
<a className="text-xs text-scale-800 hover:underline">Contributing</a>
|
||||
</Link>
|
||||
<Link href="https://supabase.com/changelog">
|
||||
<a className="text-xs text-scale-800 hover:underline">Changelog</a>
|
||||
</Link>
|
||||
|
||||
<Link href="https://github.com/supabase/supabase/blob/master/DEVELOPERS.md">
|
||||
<a className="text-xs text-scale-800 hover:underline">Author Styleguide</a>
|
||||
</Link>
|
||||
<Link href="https://supabase.com/docs/oss">
|
||||
<a className="text-xs text-scale-800 hover:underline">Open Source</a>
|
||||
</Link>
|
||||
<Link href="https://supabase.com/supasquad">
|
||||
<a className="text-xs text-scale-800 hover:underline">SupaSquad</a>
|
||||
</Link>
|
||||
</div>
|
||||
<FooterHelpCallout />
|
||||
<Footer />
|
||||
</div>
|
||||
|
||||
<div
|
||||
@@ -317,4 +295,4 @@ const SiteRefLayout = ({ children }) => {
|
||||
)
|
||||
}
|
||||
|
||||
export default SiteRefLayout
|
||||
export default SiteLayout
|
||||
@@ -1,321 +0,0 @@
|
||||
import { useTheme } from 'common/Providers'
|
||||
import Image from 'next/image'
|
||||
import Link from 'next/link'
|
||||
import { useRouter } from 'next/router'
|
||||
import NavigationMenu from '~/components/Navigation/NavigationMenu/NavigationMenu'
|
||||
import TopNavBarRef from '~/components/Navigation/NavigationMenu/TopNavBarRef'
|
||||
|
||||
import FooterHelpCallout from '~/components/FooterHelpCallout'
|
||||
|
||||
import { menuState } from '~/hooks/useMenuState'
|
||||
import { useEffect } from 'react'
|
||||
|
||||
const SiteRefLayout = ({ children }) => {
|
||||
const { isDarkMode } = useTheme()
|
||||
|
||||
useEffect(() => {
|
||||
const key = localStorage.getItem('supabaseDarkMode')
|
||||
if (!key) {
|
||||
// Default to dark mode if no preference config
|
||||
document.documentElement.className = 'dark'
|
||||
} else {
|
||||
document.documentElement.className = key === 'true' ? 'dark' : ''
|
||||
}
|
||||
}, [])
|
||||
|
||||
const menuLevel = 'home'
|
||||
// useMenuLevelId()
|
||||
const mobileMenuOpen = false
|
||||
|
||||
const levelsData = {
|
||||
home: {
|
||||
icon: '/docs/img/icons/menu/home',
|
||||
name: 'Home',
|
||||
},
|
||||
gettingstarted: {
|
||||
icon: '/docs/img/icons/menu/getting-started',
|
||||
name: 'Getting Started',
|
||||
},
|
||||
database: {
|
||||
icon: '/docs/img/icons/menu/database',
|
||||
name: 'Database',
|
||||
},
|
||||
auth: {
|
||||
icon: '/docs/img/icons/menu/auth',
|
||||
name: 'Auth',
|
||||
},
|
||||
functions: {
|
||||
icon: '/docs/img/icons/menu/functions',
|
||||
name: 'Functions',
|
||||
},
|
||||
realtime: {
|
||||
icon: '/docs/img/icons/menu/realtime',
|
||||
name: 'Realtime',
|
||||
},
|
||||
storage: {
|
||||
icon: '/docs/img/icons/menu/storage',
|
||||
name: 'Storage',
|
||||
},
|
||||
platform: {
|
||||
icon: '/docs/img/icons/menu/platform',
|
||||
name: 'Platform',
|
||||
},
|
||||
resources: {
|
||||
icon: '/docs/img/icons/menu/resources',
|
||||
name: 'Resources',
|
||||
},
|
||||
integrations: {
|
||||
icon: '/docs/img/icons/menu/integrations',
|
||||
name: 'Integrations',
|
||||
},
|
||||
reference_javascript_v1: {
|
||||
icon: '/docs/img/icons/menu/reference-javascript',
|
||||
name: 'Javascript Reference v1.0',
|
||||
},
|
||||
reference_javascript_v2: {
|
||||
icon: '/docs/img/icons/menu/reference-javascript',
|
||||
name: 'Javascript Reference v2.0',
|
||||
},
|
||||
reference_dart_v0: {
|
||||
icon: '/docs/img/icons/menu/reference-dart',
|
||||
name: 'Dart Reference v0.0',
|
||||
},
|
||||
reference_dart_v1: {
|
||||
icon: '/docs/img/icons/menu/reference-dart',
|
||||
name: 'Dart Reference v0.0',
|
||||
},
|
||||
reference_cli: {
|
||||
icon: '/docs/img/icons/menu/reference-cli',
|
||||
name: 'CLI Reference',
|
||||
},
|
||||
reference_api: {
|
||||
icon: '/docs/img/icons/menu/reference-api',
|
||||
name: 'Management API Reference',
|
||||
},
|
||||
reference_self_hosting_auth: {
|
||||
icon: '/docs/img/icons/menu/reference-auth',
|
||||
name: 'Auth Server Reference',
|
||||
},
|
||||
reference_self_hosting_storage: {
|
||||
icon: '/docs/img/icons/menu/reference-storage',
|
||||
name: 'Storage Server Reference',
|
||||
},
|
||||
reference_self_hosting_realtime: {
|
||||
icon: '/docs/img/icons/menu/reference-realtime',
|
||||
name: 'Realtime Server Reference',
|
||||
},
|
||||
}
|
||||
|
||||
return (
|
||||
<main>
|
||||
{/* <img
|
||||
src={`${router.basePath}/img/gradient-bg.png`}
|
||||
className="absolute left-0 w-[520px] top-0 -z-1 pointer-events-none"
|
||||
/> */}
|
||||
|
||||
<div className="flex flex-row h-screen">
|
||||
<div
|
||||
className={[
|
||||
'hidden', // experiment hidden
|
||||
'transition-all',
|
||||
'top-0',
|
||||
'relative',
|
||||
'h-screen w-[420px]',
|
||||
'z-10',
|
||||
'lg:flex flex-col ml-0',
|
||||
].join(' ')}
|
||||
>
|
||||
<div
|
||||
className={[
|
||||
'top-0',
|
||||
'relative',
|
||||
'w-auto',
|
||||
'z-10',
|
||||
|
||||
'border-r overflow-auto h-screen',
|
||||
'backdrop-blur backdrop-filter bg-white-1200 dark:bg-blackA-300',
|
||||
'flex flex-col',
|
||||
].join(' ')}
|
||||
>
|
||||
<div className="top-0 sticky z-10">
|
||||
<div>
|
||||
<div>
|
||||
<div
|
||||
className={[
|
||||
'hidden md:flex md:height-auto',
|
||||
'pt-8 bg-scale-200 flex-col gap-8',
|
||||
].join(' ')}
|
||||
>
|
||||
<Link href="/">
|
||||
<a className="px-10 flex items-center gap-2">
|
||||
<Image
|
||||
className="cursor-pointer"
|
||||
src={isDarkMode ? '/docs/supabase-dark.svg' : '/docs/supabase-light.svg'}
|
||||
width={96}
|
||||
height={24}
|
||||
alt="Supabase Logo"
|
||||
/>
|
||||
<span className="font-mono text-sm font-medium text-brand-900">DOCS</span>
|
||||
</a>
|
||||
</Link>
|
||||
{/* {router.asPath.includes('/reference/') && <RefSwitcher />} */}
|
||||
</div>
|
||||
<div className="h-4 bg-scale-200 w-full"></div>
|
||||
<div className="bg-gradient-to-b from-scale-200 to-transparent h-4 w-full"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className={['pb-10 px-5 md:px-10 md:flex'].join(' ')}>
|
||||
<NavigationMenu />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
// #docs-content-container is used by layout to scroll to top
|
||||
id="docs-content-container"
|
||||
className={[
|
||||
'w-full h-screen transition-all ease-out',
|
||||
mobileMenuOpen ? 'overflow-hidden' : 'overflow-auto',
|
||||
].join(' ')}
|
||||
>
|
||||
<div className="flex flex-col relative">
|
||||
{/* <NavigationMenu /> */}
|
||||
<div className={['lg:sticky top-0 z-10 overflow-hidden'].join(' ')}>
|
||||
<TopNavBarRef />
|
||||
</div>
|
||||
<div
|
||||
className={[
|
||||
'sticky transition-all top-0',
|
||||
'z-10',
|
||||
'backdrop-blur backdrop-filter bg-white-1200 dark:bg-blackA-300',
|
||||
].join(' ')}
|
||||
>
|
||||
<div className={['lg:hidden', 'px-5 ', 'border-b z-10'].join(' ')}>
|
||||
<div
|
||||
className={[
|
||||
'transition-all ease-out z-10',
|
||||
'top-0',
|
||||
mobileMenuOpen && 'absolute',
|
||||
'flex items-center h-[40px]',
|
||||
mobileMenuOpen ? 'gap-0' : 'gap-3',
|
||||
].join(' ')}
|
||||
>
|
||||
<button
|
||||
className={['mr-2', mobileMenuOpen && 'mt-0.5'].join(' ')}
|
||||
onClick={() => menuState.setMenuMobileOpen(!mobileMenuOpen)}
|
||||
>
|
||||
<div
|
||||
className={[
|
||||
'space-y-1 group cursor-pointer relative',
|
||||
mobileMenuOpen ? 'w-4 h-4' : 'w-4 h-[8px]',
|
||||
].join(' ')}
|
||||
>
|
||||
<span
|
||||
className={[
|
||||
'transition-all ease-out block w-4 h-px bg-scale-900 group-hover:bg-scale-1200',
|
||||
!mobileMenuOpen ? 'w-4' : 'absolute rotate-45 top-[6px]',
|
||||
].join(' ')}
|
||||
></span>
|
||||
<span
|
||||
className={[
|
||||
'transition-all ease-out block h-px bg-scale-900 group-hover:bg-scale-1200',
|
||||
!mobileMenuOpen
|
||||
? 'w-3 group-hover:w-4'
|
||||
: 'absolute w-4 -rotate-45 top-[2px]',
|
||||
].join(' ')}
|
||||
></span>
|
||||
</div>
|
||||
</button>
|
||||
<div className={[].join(' ')}>
|
||||
<img
|
||||
src={
|
||||
menuLevel
|
||||
? levelsData[menuLevel].icon + '.svg'
|
||||
: levelsData['home'].icon + '.svg'
|
||||
}
|
||||
className={[
|
||||
'transition-all duration-200',
|
||||
mobileMenuOpen ? 'invisible w-0 h-0' : 'w-4 h-4',
|
||||
].join(' ')}
|
||||
/>
|
||||
</div>
|
||||
<span
|
||||
className={[
|
||||
'transition-all duration-200',
|
||||
'text-scale-1200',
|
||||
mobileMenuOpen ? 'text-xs' : 'text-sm',
|
||||
].join(' ')}
|
||||
>
|
||||
{mobileMenuOpen
|
||||
? 'Close'
|
||||
: menuLevel
|
||||
? levelsData[menuLevel].name
|
||||
: levelsData['home'].name}
|
||||
</span>
|
||||
</div>
|
||||
<div
|
||||
className={[
|
||||
'transition-all ease-out duration-200',
|
||||
'absolute left-0 right-0 h-screen',
|
||||
'px-5 pl-5 py-16',
|
||||
'top-[0px]',
|
||||
'bg-scale-200',
|
||||
mobileMenuOpen
|
||||
? 'overflow-y-auto opacity-100 left-[0px] visible'
|
||||
: 'left-[-40px] h-0 opacity-0 invisible',
|
||||
].join(' ')}
|
||||
>
|
||||
<NavigationMenu />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="grow px-5 max-w-7xl mx-auto py-16">
|
||||
{children}
|
||||
|
||||
<div className="mt-32">
|
||||
<FooterHelpCallout />
|
||||
</div>
|
||||
<hr className="border-scale-400 mt-8"></hr>
|
||||
<div className="flex flex-col lg:flex-row gap-3 mt-6">
|
||||
<span className="text-xs text-scale-900">Supabase 2022</span>
|
||||
<span className="text-xs text-scale-900">—</span>
|
||||
<Link href="/handbook/contributing">
|
||||
<a className="text-xs text-scale-800 hover:underline">Contributing</a>
|
||||
</Link>
|
||||
<Link href="https://supabase.com/changelog">
|
||||
<a className="text-xs text-scale-800 hover:underline">Changelog</a>
|
||||
</Link>
|
||||
|
||||
<Link href="https://github.com/supabase/supabase/blob/master/DEVELOPERS.md">
|
||||
<a className="text-xs text-scale-800 hover:underline">Author Styleguide</a>
|
||||
</Link>
|
||||
<Link href="https://supabase.com/docs/oss">
|
||||
<a className="text-xs text-scale-800 hover:underline">Open Source</a>
|
||||
</Link>
|
||||
<Link href="https://supabase.com/supasquad">
|
||||
<a className="text-xs text-scale-800 hover:underline">SupaSquad</a>
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div
|
||||
className={[
|
||||
// 'top-0 left-0',
|
||||
'hidden', // experiment hidden
|
||||
'h-full',
|
||||
'left-0',
|
||||
'right-0',
|
||||
'z-10',
|
||||
'backdrop-blur-sm backdrop-filter bg-white-1200 dark:bg-blackA-600',
|
||||
mobileMenuOpen ? 'absolute MOBILE-MENU-OPEN' : 'hidden h-0 MOBILE-MENU-CLOSED',
|
||||
].join(' ')}
|
||||
onClick={() => menuState.setMenuMobileOpen(!mobileMenuOpen)}
|
||||
></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
)
|
||||
}
|
||||
|
||||
export default SiteRefLayout
|
||||
@@ -76,7 +76,7 @@ const Layout: FC<Props> = (props) => {
|
||||
}}
|
||||
/>
|
||||
|
||||
<div className={['grid grid-cols-12 relative'].join(' ')}>
|
||||
<div className={['grid grid-cols-12 relative gap-4'].join(' ')}>
|
||||
<div
|
||||
className={[
|
||||
'relative',
|
||||
|
||||
@@ -1,74 +0,0 @@
|
||||
import toc from 'markdown-toc'
|
||||
import { MDXRemote } from 'next-mdx-remote'
|
||||
import { serialize } from 'next-mdx-remote/serialize'
|
||||
import components from '../components/index'
|
||||
import NewLayout from '~/layouts/DefaultGuideLayout'
|
||||
|
||||
import Layout from '~/layouts/Default'
|
||||
import { getAllDocs, getDocsBySlug } from '../lib/docs'
|
||||
|
||||
interface Meta {
|
||||
id: string
|
||||
title: string
|
||||
sidebar_label: string
|
||||
hide_table_of_contents: boolean
|
||||
}
|
||||
|
||||
interface Props {
|
||||
meta: Meta
|
||||
content: any
|
||||
toc: any
|
||||
}
|
||||
const isNewDocs = process.env.NEXT_PUBLIC_NEW_DOCS === 'true'
|
||||
|
||||
export default function Doc({ meta, content, toc }: Props) {
|
||||
return (
|
||||
// @ts-ignore
|
||||
<>
|
||||
{Object.entries(meta).length > 0 || !isNewDocs ? (
|
||||
<Layout meta={meta} toc={toc}>
|
||||
<MDXRemote {...content} components={components} />
|
||||
</Layout>
|
||||
) : (
|
||||
<NewLayout meta={meta} toc={toc}>
|
||||
<MDXRemote {...content} components={components} />
|
||||
</NewLayout>
|
||||
)}
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
export async function getStaticProps({ params }: { params: { slug: string[] } }) {
|
||||
let slug
|
||||
if (params.slug.length > 1) {
|
||||
slug = `docs/${params.slug.join('/')}`
|
||||
} else {
|
||||
slug = `docs/${params.slug[0]}`
|
||||
}
|
||||
|
||||
let doc = getDocsBySlug(slug)
|
||||
const content = await serialize(doc.content || '')
|
||||
|
||||
return {
|
||||
props: {
|
||||
...doc,
|
||||
content,
|
||||
toc: toc(doc.content, { maxdepth: 1, firsth1: false }),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
export function getStaticPaths() {
|
||||
let docs = getAllDocs()
|
||||
|
||||
return {
|
||||
paths: docs.map(() => {
|
||||
return {
|
||||
params: {
|
||||
slug: docs.map((d) => d.slug),
|
||||
},
|
||||
}
|
||||
}),
|
||||
fallback: 'blocking',
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user