Skip to content

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

Add fly out to beta and slight updates to fly out

Joshen Lime37410e6976a
diff --git a/www/components/UI/FlyOut.tsx b/www/components/UI/FlyOut.tsx
index 4390a96e658..16ebcfc9f42 100644
--- a/www/components/UI/FlyOut.tsx
+++ b/www/components/UI/FlyOut.tsx
@@ -2,12 +2,14 @@ import React, { useState, useEffect, useImperativeHandle } from 'react'
import Transition from 'lib/Transition'
type Props = {
- title: string
+ title?: string
children?: React.ReactNode,
- ref? : any
+ className?: string,
+ renderTriggerElement?: any,
}
const FlyOut = (props :Props) => {
+ const { title = '', children, className = '', renderTriggerElement = null } = props
const [show, setShow] = useState(false)
function handleToggle() {
@@ -26,26 +28,36 @@ const FlyOut = (props :Props) => {
return (
<>
- <a
- href="#"
- className="inline-flex items-center px-1 border-b-2 border-transparent text-sm font-medium text-gray-500 hover:text-gray-700 hover:border-gray-300 dark:text-dark-100 dark:hover:border-dark-100"
+ <div
+ className={`
+ inline-flex items-center px-1 border-b-2 border-transparent text-sm font-medium text-gray-500 hover:text-gray-700
+ dark:text-dark-100 ${renderTriggerElement === null ? 'hover:border-gray-300 dark:hover:border-dark-100' : ''}
+ `}
onClick={() => handleToggle()}
>
- <span>{props.title}</span>
- <svg
- className="ml-2 h-5 w-5 text-gray-300 group-hover:text-gray-300 transition ease-in-out duration-150"
- xmlns="http://www.w3.org/2000/svg"
- viewBox="0 0 20 20"
- fill="currentColor"
- aria-hidden="true"
- >
- <path
- fillRule="evenodd"
- d="M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z"
- clipRule="evenodd"
- />
- </svg>
- </a>
+ {
+ renderTriggerElement !== null
+ ? <>{renderTriggerElement()}</>
+ : (
+ <>
+ <span>{title}</span>
+ <svg
+ className="ml-2 h-5 w-5 text-gray-300 group-hover:text-gray-300 transition ease-in-out duration-150"
+ xmlns="http://www.w3.org/2000/svg"
+ viewBox="0 0 20 20"
+ fill="currentColor"
+ aria-hidden="true"
+ >
+ <path
+ fillRule="evenodd"
+ d="M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z"
+ clipRule="evenodd"
+ />
+ </svg>
+ </>
+ )
+ }
+ </div>
<Transition
appear={true}
show={show}
@@ -67,6 +79,7 @@ const FlyOut = (props :Props) => {
marginTop: '63px',
left: '-50vw',
right: '-50vw',
+ top: 0,
}}
>
<div className="absolute inset-0 flex sm:flex-col lg:flex-row" aria-hidden="true">
@@ -74,8 +87,8 @@ const FlyOut = (props :Props) => {
<div className="bg-gray-50 dark:bg-dark-500 sm:w-full sm:h-1/2 lg:w-1/2 lg:h-full"></div>
{/* <div className="bg-gray-50 dark:bg-dark-300 md:hidden lg:block lg:w-1/2"></div> */}
</div>
- <div className="relative max-w-7xl mx-auto grid grid-cols-1 lg:grid-cols-2">
- {props.children}
+ <div className={`relative max-w-7xl mx-auto grid grid-cols-1 lg:grid-cols-2 ${className}`}>
+ {children}
</div>
</div>
<div
diff --git a/www/data/BetaPage.js b/www/data/BetaPage.js
index 623e6fa761b..deabab98583 100644
--- a/www/data/BetaPage.js
+++ b/www/data/BetaPage.js
@@ -163,6 +163,7 @@ export const IntroductionSegments = [
},
]
+// Currently unused
export const PerformanceComparisonData = [
{
name: 'Supabase',
@@ -174,4 +175,4 @@ export const PerformanceComparisonData = [
read: 366,
write: 280
}
-]
\ No newline at end of file
+]
diff --git a/www/pages/beta.tsx b/www/pages/beta.tsx
index 0c53122f236..4dc075effb1 100644
--- a/www/pages/beta.tsx
+++ b/www/pages/beta.tsx
@@ -3,6 +3,7 @@ import { useRef } from 'react'
import Container from 'components/Container'
import Layout from 'components/Layout'
import CountUp from 'components/CountUp'
+import FlyOut from 'components/UI/FlyOut'
import { APP_NAME, DESCRIPTION } from 'lib/constants'
import { AlphaNumbers, IntroductionSegments } from 'data/BetaPage'
@@ -11,6 +12,29 @@ const site_title = `${APP_NAME} | We are now in Beta`
// Dark text: text-dark-400
// Light text: text-dark-300
+const NavFlyOutMenu = (props: any) => {
+ const { scrollTo } = props
+ const segments = IntroductionSegments.map((segment: any) => segment.chapters)
+
+ return (
+ <>
+ <div className="col-span-12 grid grid-cols-12 items-center">
+ {segments.flat().map((segment: any) => (
+ <div
+ onClick={() => scrollTo(segment.key)}
+ className="col-span-4 px-6 py-8 text-dark-300 dark:text-dark-400 cursor-pointer bg-white hover:bg-dark-100"
+ >
+ <p className="flex items-center text-black dark:text-white">
+ <span className="font-mono text-xs text-dark-300 dark:text-dark-400 mr-2">0{segment.no}</span>
+ <span>{segment.name}</span>
+ </p>
+ </div>
+ ))}
+ </div>
+ </>
+ )
+}
+
const VideoShot = (props: any) => {
const { src } = props
return (
@@ -27,7 +51,7 @@ const VideoShot = (props: any) => {
)
}
-const HamburgerMenu = () => (
+const renderHamburgerMenu = () => (
<div className="cursor-pointer">
<svg
viewBox="0 0 24 24"
@@ -151,8 +175,8 @@ const Introduction = (props: any) => {
className="flex items-center mb-5 cursor-pointer"
onClick={() => scrollTo(chapter.key)}
>
- <p className="font-mono text-xs text-dark-300 dark:text-dark-400">{`0${chapter.no}`}</p>
- <p className="ml-4 transition text-base border-b border-gray-400 hover:text-black">
+ <p className="font-mono text-xs text-dark-400">{`0${chapter.no}`}</p>
+ <p className="ml-4 transition text-base border-b border-gray-400 hover:text-white">
{chapter.name}
</p>
</div>
@@ -820,9 +844,11 @@ const Beta = () => {
<meta name="twitter:image" content="/public/og/og-image.jpg" />
</Head>
<Container>
- <div className="shadow-lg py-5 px-5 lg:px-20 sticky inset-0 bg-dark-800 z-50 flex items-center justify-between">
+ <div className="relative shadow-lg py-5 px-5 lg:px-20 sticky inset-0 bg-dark-800 z-50 flex items-center justify-between">
<img className="h-5" src="images/logo-dark.png" />
- <HamburgerMenu />
+ <FlyOut className="lg:col-span-1" renderTriggerElement={renderHamburgerMenu}>
+ <NavFlyOutMenu scrollTo={scrollTo} />
+ </FlyOut>
</div>
<Hero />
<Introduction scrollTo={scrollTo} />