The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
added flyout example for the nav bar. added transition component to /lib for animations
mildtomato3f4221089eda
diff --git a/www/components/ArticleThumb.tsx b/www/components/ArticleThumb.tsxindex 45cf9082d4a..0df9c75989d 100644--- a/www/components/ArticleThumb.tsx+++ b/www/components/ArticleThumb.tsx@@ -21,7 +21,7 @@ const ArticleThumb = (props: any) => {// avatar_url :string;// }- console.log(props.article)+ // console.log(props.article)// @ts-ignoreconst AuthorProfile: User = Authors[author]@@ -38,8 +38,8 @@ const ArticleThumb = (props: any) => {)})- console.log(icons)- console.log(iconMarkup)+ // console.log(icons)+ // console.log(iconMarkup)return (<div className="flex flex-col rounded-sm shadow-lg overflow-hidden">diff --git a/www/components/index_sections/BuiltWithSupabase.tsx b/www/components/index_sections/BuiltWithSupabase.tsxindex df14f5c62d3..f2d056f5654 100644--- a/www/components/index_sections/BuiltWithSupabase.tsx+++ b/www/components/index_sections/BuiltWithSupabase.tsx@@ -27,11 +27,7 @@ const BuiltExamples = () => {}/><ArticleThumb article={// @ts-ignore- ProjectExamples["vercel_and_stripe"]- }/>- <ArticleThumb article={- // @ts-ignore- ProjectExamples["vercel_and_stripe"]+ ProjectExamples["nextjs-slack-clone"]}/></div></div>diff --git a/www/components/nav.tsx b/www/components/nav.tsxindex 9f2e7f3204d..5a4471bbb63 100644--- a/www/components/nav.tsx+++ b/www/components/nav.tsx@@ -1,9 +1,10 @@import Link from 'next/link'+import FlyOut from './nav/FlyOut'const Nav = () => {return (-<nav className="bg-white shadow">+<nav className="bg-white shadow" style={{zIndex: 500}}><div className="max-w-7xl mx-auto px-2 sm:px-6 lg:px-8"><div className="relative flex justify-between h-16"><div className="absolute inset-y-0 left-0 flex items-center sm:hidden">@@ -38,6 +39,7 @@ const Nav = () => {<a href="#" className="inline-flex items-center px-1 pt-1 border-b-2 border-transparent text-sm font-medium text-gray-500 hover:text-gray-700 hover:border-gray-300">Calendar</a>+ <FlyOut/></div></div><div className="absolute inset-y-0 right-0 flex items-center pr-2 sm:static sm:inset-auto sm:ml-6 sm:pr-0">diff --git a/www/components/nav/FlyOut.js b/www/components/nav/FlyOut.jsnew file mode 100644index 00000000000..7189fad9b6a--- /dev/null+++ b/www/components/nav/FlyOut.js@@ -0,0 +1,313 @@+import { useState, useEffect } from 'react'+import Transition from '../../lib/Transition'++const FlyOut = () => {+ const [show, setShow] = useState(false)++ function handleToggle() {+ setShow(!show)+ }++ useEffect(() => {+ // window is accessible here.+ window.addEventListener('scroll', function(e){+ // close Fly Out window if user scrolls past 96px from top+ if (window.pageYOffset > 96) {+ setShow(false)+ }+ });+ }, []);+++ return (+ <React.Fragment>+ <a+ href="#"+ className="inline-flex items-center px-1 pt-1 border-b-2 border-transparent text-sm font-medium text-gray-500 hover:text-gray-700 hover:border-gray-300"+ onClick={() => handleToggle()}+ >+ <span>Solutions</span>+ <svg+ className="ml-2 h-5 w-5 text-gray-400 group-hover:text-gray-500 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"+ clip-rule="evenodd"+ />+ </svg>+ </a>+ <Transition+ show={show}+ enter="transition ease-out duration-200"+ enterFrom="opacity-0 translate-y-1"+ enterTo="opacity-100 translate-y-0"+ leave="transition ease-in duration-150"+ leaveFrom="opacity-100 translate-y-0"+ leaveTo="opacity-0 translate-y-1"+ >+ <React.Fragment>+ <div+ class="absolute inset-x-0 transform shadow-lg border-t-2 border-gray-50"+ style={{+ zIndex: 999,+ position: 'absolute',+ width: '100vw',+ margin: '0 auto',+ marginTop: '64px',+ left: '-50vw',+ right: '-50vw',+ }}+ >+ <div className="absolute inset-0 flex" aria-hidden="true">+ <div className="bg-white w-1/2"></div>+ <div className="bg-gray-50 w-1/2"></div>+ </div>+ <div className="relative max-w-7xl mx-auto grid grid-cols-1 lg:grid-cols-2">+ <nav+ className="grid gap-y-10 px-4 py-8 bg-white sm:grid-cols-2 sm:gap-x-8 sm:py-12 sm:px-6 lg:px-8 xl:pr-12"+ aria-labelledby="solutionsHeading"+ >+ <a+ href="#"+ className="-m-3 p-3 flex flex-col justify-between rounded-lg hover:bg-gray-50 transition ease-in-out duration-150"+ >+ <div className="flex md:h-full lg:flex-col">+ <div className="flex-shrink-0">+ <div className="inline-flex items-center justify-center h-10 w-10 rounded-md bg-brand-500 text-white sm:h-12 sm:w-12">+ {/* <!-- Heroicon name: chart-bar --> */}+ <svg+ className="h-6 w-6"+ xmlns="http://www.w3.org/2000/svg"+ fill="none"+ viewBox="0 0 24 24"+ stroke="currentColor"+ aria-hidden="true"+ >+ <path+ strokeLinecap="round"+ strokeLinejoin="round"+ strokeWidth="2"+ d="M9 19v-6a2 2 0 00-2-2H5a2 2 0 00-2 2v6a2 2 0 002 2h2a2 2 0 002-2zm0 0V9a2 2 0 012-2h2a2 2 0 012 2v10m-6 0a2 2 0 002 2h2a2 2 0 002-2m0 0V5a2 2 0 012-2h2a2 2 0 012 2v14a2 2 0 01-2 2h-2a2 2 0 01-2-2z"+ />+ </svg>+ </div>+ </div>+ <div className="ml-4 md:flex-1 md:flex md:flex-col md:justify-between lg:ml-0 lg:mt-4">+ <div>+ <p className="text-base font-medium text-gray-900">Database</p>+ <p className="mt-1 text-sm text-gray-500">+ Built on top of Postgres, an extremely scalable relational database, so you can start building with the best tool in hand.+ </p>+ </div>+ <p className="mt-2 text-sm font-medium text-brand-600 lg:mt-4">+ Learn more <span aria-hidden="true">→</span>+ </p>+ </div>+ </div>+ </a>++ <a+ href="#"+ className="-m-3 p-3 flex flex-col justify-between rounded-lg hover:bg-gray-50 transition ease-in-out duration-150"+ >+ <div className="flex md:h-full lg:flex-col">+ <div className="flex-shrink-0">+ <div className="inline-flex items-center justify-center h-10 w-10 rounded-md bg-brand-500 text-white sm:h-12 sm:w-12">+ {/* <!-- Heroicon name: chart-bar --> */}+ <svg+ className="h-6 w-6"+ xmlns="http://www.w3.org/2000/svg"+ fill="none"+ viewBox="0 0 24 24"+ stroke="currentColor"+ aria-hidden="true"+ >+ <path+ strokeLinecap="round"+ strokeLinejoin="round"+ strokeWidth="2"+ d="M9 19v-6a2 2 0 00-2-2H5a2 2 0 00-2 2v6a2 2 0 002 2h2a2 2 0 002-2zm0 0V9a2 2 0 012-2h2a2 2 0 012 2v10m-6 0a2 2 0 002 2h2a2 2 0 002-2m0 0V5a2 2 0 012-2h2a2 2 0 012 2v14a2 2 0 01-2 2h-2a2 2 0 01-2-2z"+ />+ </svg>+ </div>+ </div>+ <div className="ml-4 md:flex-1 md:flex md:flex-col md:justify-between lg:ml-0 lg:mt-4">+ <div>+ <p className="text-base font-medium text-gray-900">Authentication</p>+ <p className="mt-1 text-sm text-gray-500">+ Manage your users easily, leverage on PostgreSQL’s Row Level Security, and even write policies which fit your unique needs.+ </p>+ </div>+ <p className="mt-2 text-sm font-medium text-brand-600 lg:mt-4">+ Learn more <span aria-hidden="true">→</span>+ </p>+ </div>+ </div>+ </a>++ <a+ href="#"+ className="-m-3 p-3 flex flex-col justify-between rounded-lg hover:bg-gray-50 transition ease-in-out duration-150"+ >+ <div className="flex md:h-full lg:flex-col">+ <div className="flex-shrink-0">+ <div className="inline-flex items-center justify-center h-10 w-10 rounded-md bg-brand-500 text-white sm:h-12 sm:w-12">+ {/* <!-- Heroicon name: chart-bar --> */}+ <svg+ className="h-6 w-6"+ xmlns="http://www.w3.org/2000/svg"+ fill="none"+ viewBox="0 0 24 24"+ stroke="currentColor"+ aria-hidden="true"+ >+ <path+ strokeLinecap="round"+ strokeLinejoin="round"+ strokeWidth="2"+ d="M9 19v-6a2 2 0 00-2-2H5a2 2 0 00-2 2v6a2 2 0 002 2h2a2 2 0 002-2zm0 0V9a2 2 0 012-2h2a2 2 0 012 2v10m-6 0a2 2 0 002 2h2a2 2 0 002-2m0 0V5a2 2 0 012-2h2a2 2 0 012 2v14a2 2 0 01-2 2h-2a2 2 0 01-2-2z"+ />+ </svg>+ </div>+ </div>+ <div className="ml-4 md:flex-1 md:flex md:flex-col md:justify-between lg:ml-0 lg:mt-4">+ <div>+ <p className="text-base font-medium text-gray-900">Storage</p>+ <p className="mt-1 text-sm text-gray-500">+ Store, organize, and serve any amount of assets from anywhere. Any media, including videos of any size and format.+ </p>+ </div>+ <p className="mt-2 text-sm font-medium text-brand-600 lg:mt-4">+ Learn more <span aria-hidden="true">→</span>+ </p>+ </div>+ </div>+ </a>++ <a+ href="#"+ className="-m-3 p-3 flex flex-col justify-between rounded-lg hover:bg-gray-50 transition ease-in-out duration-150"+ >+ <div className="flex md:h-full lg:flex-col">+ <div className="flex-shrink-0">+ <div className="inline-flex items-center justify-center h-10 w-10 rounded-md bg-brand-500 text-white sm:h-12 sm:w-12">+ {/* <!-- Heroicon name: chart-bar --> */}+ <svg+ className="h-6 w-6"+ xmlns="http://www.w3.org/2000/svg"+ fill="none"+ viewBox="0 0 24 24"+ stroke="currentColor"+ aria-hidden="true"+ >+ <path+ strokeLinecap="round"+ strokeLinejoin="round"+ strokeWidth="2"+ d="M9 19v-6a2 2 0 00-2-2H5a2 2 0 00-2 2v6a2 2 0 002 2h2a2 2 0 002-2zm0 0V9a2 2 0 012-2h2a2 2 0 012 2v10m-6 0a2 2 0 002 2h2a2 2 0 002-2m0 0V5a2 2 0 012-2h2a2 2 0 012 2v14a2 2 0 01-2 2h-2a2 2 0 01-2-2z"+ />+ </svg>+ </div>+ </div>+ <div className="ml-4 md:flex-1 md:flex md:flex-col md:justify-between lg:ml-0 lg:mt-4">+ <div>+ <p className="text-base font-medium text-gray-900">Functions</p>+ <p className="mt-1 text-sm text-gray-500">+ Trigger backend code automatically with database events, without ever worrying about scaling a server.+ </p>+ </div>+ <p className="mt-2 text-sm font-medium text-brand-600 lg:mt-4">+ Learn more <span aria-hidden="true">→</span>+ </p>+ </div>+ </div>+ </a>+ </nav>+ <div className="bg-gray-50 px-4 py-8 sm:py-12 sm:px-6 lg:px-8 xl:pl-12">+ <div>+ <h3 className="text-sm font-medium tracking-wide text-gray-500 uppercase">+ Latest news+ </h3>+ <ul className="mt-6 space-y-6">+ <li className="flow-root">+ <a+ href="#"+ className="-m-3 p-3 flex rounded-lg hover:bg-gray-100 transition ease-in-out duration-150"+ >+ <div className="hidden sm:block flex-shrink-0">+ <img+ className="w-32 h-20 object-cover rounded-md"+ src="https://images.unsplash.com/photo-1558478551-1a378f63328e?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=2849&q=80"+ alt=""+ />+ </div>+ <div className="min-w-0 flex-1 sm:ml-8">+ <h4 className="text-base font-medium text-gray-900 truncate">+ Supabase launch news+ </h4>+ <p className="mt-1 text-sm text-gray-500">+ Eget ullamcorper ac ut vulputate fames nec mattis pellentesque+ elementum. Viverra tempor id mus.+ </p>+ </div>+ </a>+ </li>+ <li className="flow-root">+ <a+ href="#"+ className="-m-3 p-3 flex rounded-lg hover:bg-gray-100 transition ease-in-out duration-150"+ >+ <div className="hidden sm:block flex-shrink-0">+ <img+ className="w-32 h-20 object-cover rounded-md"+ src="https://images.unsplash.com/1/apple-gear-looking-pretty.jpg?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=2850&q=80"+ alt=""+ />+ </div>+ <div className="min-w-0 flex-1 sm:ml-8">+ <h4 className="text-base font-medium text-gray-900 truncate">+ New project example released+ </h4>+ <p className="mt-1 text-sm text-gray-500">+ Eget ullamcorper ac ut vulputate fames nec mattis pellentesque+ elementum. Viverra tempor id mus.+ </p>+ </div>+ </a>+ </li>+ </ul>+ </div>+ <div className="mt-6 text-sm font-medium">+ <a+ href="#"+ className="text-gray-600 hover:text-gray-500 transition ease-in-out duration-150"+ >+ View all posts <span aria-hidden="true">→</span>+ </a>+ </div>+ </div>+ </div>+ </div>+ <div+ className="fixed inset-0 transition-opacity"+ style={{+ zIndex: 100,+ marginLeft: 0,+ pointerEvents: 'visiblePainted'+ }}+ onClick={() => handleToggle()}+ >+ <div className="absolute inset-0 opacity-0"></div>+ </div>+ </React.Fragment>+ </Transition>+ </React.Fragment>+ )+}++export default FlyOutdiff --git a/www/data/ProjectExamples.json b/www/data/ProjectExamples.jsonindex 4b72bbce930..374aceee373 100644--- a/www/data/ProjectExamples.json+++ b/www/data/ProjectExamples.json@@ -1,14 +1,14 @@{"vercel_and_stripe": {"type": "project example",- "title": "NextJS, Vercel and Supabase",- "url": "https://supabase.io/casestudies/monitoro",- "description":"Easily deploy a Supabase powered app with Stripe already built in for payments.",+ "title": "NextJS, Stripe and Supabase",+ "url": "https://github.com/supabase/supabase/tree/master/examples",+ "description":"Easily deploy a Supabase powered app with Stripe already built in for payments","icons" : [{"img_url": "https://avatars3.githubusercontent.com/u/54469796?s=480&v=4",- "img_alt": "vercel logo"+ "img_alt": "supabase icon"},{"img_url": "https://avatars1.githubusercontent.com/u/14985020?s=480&v=4",@@ -20,5 +20,23 @@}],"cta" : true+ },+ "nextjs-slack-clone": {+ "type": "project example",+ "title": "NextJS realtime chat using Supabase",+ "url": "https://github.com/supabase/supabase/tree/master/examples/nextjs-slack-clone",+ "description":"Full-stack Slack clone example",++ "icons" : [+ {+ "img_url": "https://avatars3.githubusercontent.com/u/54469796?s=480&v=4",+ "img_alt": "supabase icon"+ },+ {+ "img_url": "https://avatars1.githubusercontent.com/u/14985020?s=480&v=4",+ "img_alt": "vercel icon"+ }+ ],+ "cta" : true}}diff --git a/www/lib/Transition.js b/www/lib/Transition.jsnew file mode 100644index 00000000000..506310826c3--- /dev/null+++ b/www/lib/Transition.js@@ -0,0 +1,108 @@+// From: https://gist.github.com/adamwathan/3b9f3ad1a285a2d1b482769aeb862467++import { CSSTransition as ReactCSSTransition } from 'react-transition-group'+import React, { useRef, useEffect, useContext } from 'react'++const TransitionContext = React.createContext({+ parent: {},+})++function useIsInitialRender() {+ const isInitialRender = useRef(true)+ useEffect(() => {+ isInitialRender.current = false+ }, [])+ return isInitialRender.current+}++function CSSTransition({+ show,+ enter = '',+ enterFrom = '',+ enterTo = '',+ leave = '',+ leaveFrom = '',+ leaveTo = '',+ appear,+ children,+}) {+ const enterClasses = enter.split(' ').filter(s => s.length)+ const enterFromClasses = enterFrom.split(' ').filter(s => s.length)+ const enterToClasses = enterTo.split(' ').filter(s => s.length)+ const leaveClasses = leave.split(' ').filter(s => s.length)+ const leaveFromClasses = leaveFrom.split(' ').filter(s => s.length)+ const leaveToClasses = leaveTo.split(' ').filter(s => s.length)++ function addClasses(node, classes) {+ classes.length && node.classList.add(...classes)+ }++ function removeClasses(node, classes) {+ classes.length && node.classList.remove(...classes)+ }++ return (+ <ReactCSSTransition+ appear={appear}+ unmountOnExit+ in={show}+ addEndListener={(node, done) => {+ node.addEventListener('transitionend', done, false)+ }}+ onEnter={node => {+ addClasses(node, [...enterClasses, ...enterFromClasses])+ }}+ onEntering={node => {+ removeClasses(node, enterFromClasses)+ addClasses(node, enterToClasses)+ }}+ onEntered={node => {+ removeClasses(node, [...enterToClasses, ...enterClasses])+ }}+ onExit={node => {+ addClasses(node, [...leaveClasses, ...leaveFromClasses])+ }}+ onExiting={node => {+ removeClasses(node, leaveFromClasses)+ addClasses(node, leaveToClasses)+ }}+ onExited={node => {+ removeClasses(node, [...leaveToClasses, ...leaveClasses])+ }}+ >+ {children}+ </ReactCSSTransition>+ )+}++function Transition({ show, appear, ...rest }) {+ const { parent } = useContext(TransitionContext)+ const isInitialRender = useIsInitialRender()+ const isChild = show === undefined++ if (isChild) {+ return (+ <CSSTransition+ appear={parent.appear || !parent.isInitialRender}+ show={parent.show}+ {...rest}+ />+ )+ }++ return (+ <TransitionContext.Provider+ value={{+ parent: {+ show,+ isInitialRender,+ appear,+ },+ }}+ >+ <CSSTransition appear={appear} show={show} {...rest} />+ </TransitionContext.Provider>+ )+}++export default Transitiondiff --git a/www/package-lock.json b/www/package-lock.jsonindex 79512375f0a..d8e0deb8432 100644--- a/www/package-lock.json+++ b/www/package-lock.json@@ -1835,6 +1835,11 @@}}},+ "csstype": {+ "version": "3.0.5",+ "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.0.5.tgz",+ "integrity": "sha512-uVDi8LpBUKQj6sdxNaTetL6FpeCqTjOvAQuQUa/qAqq8oOd4ivkbhgnqayl0dnPal8Tb/yB1tF+gOvCBiicaiQ=="+ },"cyclist": {"version": "1.0.1","resolved": "https://registry.npmjs.org/cyclist/-/cyclist-1.0.1.tgz",@@ -2018,6 +2023,15 @@}}},+ "dom-helpers": {+ "version": "5.2.0",+ "resolved": "https://registry.npmjs.org/dom-helpers/-/dom-helpers-5.2.0.tgz",+ "integrity": "sha512-Ru5o9+V8CpunKnz5LGgWXkmrH/20cGKwcHwS4m73zIvs54CN9epEmT/HLqFJW3kXpakAFkEdzgy1hzlJe3E4OQ==",+ "requires": {+ "@babel/runtime": "^7.8.7",+ "csstype": "^3.0.2"+ }+ },"dom-serializer": {"version": "1.0.1","resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-1.0.1.tgz",@@ -5717,6 +5731,17 @@"refractor": "^3.2.0"}},+ "react-transition-group": {+ "version": "4.4.1",+ "resolved": "https://registry.npmjs.org/react-transition-group/-/react-transition-group-4.4.1.tgz",+ "integrity": "sha512-Djqr7OQ2aPUiYurhPalTrVy9ddmFCCzwhqQmtN+J3+3DzLO209Fdr70QrN8Z3DsglWql6iY1lDWAfpFiBtuKGw==",+ "requires": {+ "@babel/runtime": "^7.5.5",+ "dom-helpers": "^5.0.1",+ "loose-envify": "^1.4.0",+ "prop-types": "^15.6.2"+ }+ },"readable-stream": {"version": "3.6.0","resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz",diff --git a/www/package.json b/www/package.jsonindex c5bf184dea5..a91004f0850 100644--- a/www/package.json+++ b/www/package.json@@ -21,7 +21,8 @@"react-syntax-highlighter": "^15.3.1","remark": "11.0.2","remark-html": "10.0.0",- "typescript": "^4.0.3"+ "typescript": "^4.0.3",+ "react-transition-group": "^4.4.1"},"devDependencies": {"@types/classnames": "^2.2.10",