From 430e67e723dba6fb07a6631d59352eea809d9abc Mon Sep 17 00:00:00 2001 From: Copple Date: Fri, 10 Jan 2020 18:31:26 +0800 Subject: [PATCH] Major updates to the homepage and the pism theme --- web/docusaurus.config.js | 4 +- web/src/css/custom.css | 63 ++++++++++- web/src/pages/index.js | 193 +++++++++++++++++++++++--------- web/src/pages/styles.module.css | 10 +- 4 files changed, 199 insertions(+), 71 deletions(-) diff --git a/web/docusaurus.config.js b/web/docusaurus.config.js index b48aa341828..b83d4a26d4b 100755 --- a/web/docusaurus.config.js +++ b/web/docusaurus.config.js @@ -7,7 +7,7 @@ module.exports = { title: 'Supabase', - tagline: 'Instant Realtime API', + tagline: 'realtime postgres.', url: 'https://supabase.io', baseUrl: '/', favicon: '/static/favicon.ico', @@ -35,7 +35,7 @@ module.exports = { // }, { href: 'https://app.supabase.io', - label: 'Request Early Access →', + label: 'Join the List', position: 'right', }, ], diff --git a/web/src/css/custom.css b/web/src/css/custom.css index 9a1848e62b3..d3ec037f6c0 100755 --- a/web/src/css/custom.css +++ b/web/src/css/custom.css @@ -182,10 +182,6 @@ } -:root[data-theme='dark'] .prism-code { - background: var(--custom-background-color-highlight) !important; -} - img.navbar__logo path { fill: red !important; } @@ -237,7 +233,7 @@ li + li { .with-underline::after, .markdown h2:after { - content: '\2501'; + content: '\2501\2501'; display: block; color: var(--custom-primary); } @@ -468,4 +464,61 @@ div[class^='sidebar_'] .menu__link.menu__link--active:not(.menu__link--sublist) } .Collapsable summary:hover { cursor: pointer; +} + +/* Hero */ +.hero--button { + margin: 0 10px 0 0 !important; +} +/* Hero */ +.hero--button.button--secondary { + border-color: #000; +} + +/* Code */ +.prism-code { + background: #2a2a2a !important; + white-space: pre !important; + font-size: 0.8rem; + overflow: auto !important; +} +.token.keyword.module, .token.function { + font-style: normal !important; + color: #DCDCAA !important; +} +.token.plain, .token.parameter { + font-style: normal !important; + color: #9CDCFE !important; +} +.token.keyword { + font-style: normal !important; + color: #569cd6 !important; +} +.token.string { + font-style: normal !important; + color: #CE9178 !important; +} +.token.console { + font-style: normal !important; + color: #49C1AD !important; +} +.token.comment { + color: #6A9955 !important; +} +.token.number { + color: #B5CEA8 !important; +} + +/* HomePage */ +.ForDevelopers .row { + display: flex; + flex-direction: row-reverse; +} +.ForDevelopers .button { + text-align: left; +} +.ForDevelopers .button.button--link:hover { + text-decoration: none; + transition: all 0.2s ease; + opacity: 0.8; } \ No newline at end of file diff --git a/web/src/pages/index.js b/web/src/pages/index.js index b7ff1bbb67d..aa49c09c409 100755 --- a/web/src/pages/index.js +++ b/web/src/pages/index.js @@ -1,4 +1,4 @@ -import React from 'react' +import React, { useState } from 'react' import classnames from 'classnames' import Layout from '@theme/Layout' import Link from '@docusaurus/Link' @@ -10,16 +10,56 @@ import CodeBlock from '@theme/CodeBlock' const subscribeExample = ` import { createClient } from '@supabase/supabase-js' -// Create a single supabase client for interacting with your database -const supabase = createClient('https://chat-room.supabase.io', '1a2b-3c4d-5e6f-7g8h') +// Connect to your own PostgreSQL database +const supabase = createClient('https://your-db.supabase.io', '1a2b-3c4d-5e6f-7g8h') -// Listen to all new messages in your chat room +// Receive updates when a new record is inserted into your database const listener = supabase - .subscribe('messages') - .on('INSERT', chatMessage => { - console.log('New chat!', chatMessage) + .from('*') + .on('INSERT', change => { + console.log('Change received!', change) }) + .subscribe() ` +const readExample = ` +import { createClient } from '@supabase/supabase-js' + +// Connect to your own PostgreSQL database +const supabase = createClient('https://world.supabase.io', '1a2b-3c4d-5e6f-7g8h') + +// Get all countries and the cities with a population over 10,000 people +const countries = await supabase + .from('countries') + .select(\` + name, + cities { name, population } + \`) + .filter('cities=popution=gte.10000') +` +const createExample = ` +import { createClient } from '@supabase/supabase-js' + +// Connect to your own PostgreSQL database +const supabase = createClient('https://stripe.supabase.io', '1a2b-3c4d-5e6f-7g8h') + +// Create a new employee in your 'employees' table +const newEmployee = supabase + .from('employees') + .insert({ id: 1, name: 'Greg Brockman', salary: 5000 }) +` +const updateExample = ` +import { createClient } from '@supabase/supabase-js' + +// Connect to your own PostgreSQL database +const supabase = createClient('https://world.supabase.io', '1a2b-3c4d-5e6f-7g8h') + +// Update all city names in New Zealand +const listener = supabase + .from('employees') + .eq('country_code', 'NZ') + .update({ name: 'Middle Earth' }) +` + const features = [ { title: <>Chat apps, @@ -63,43 +103,50 @@ function Feature({ imageUrl, title, description, href }) { function Home() { const context = useDocusaurusContext() const { siteConfig = {} } = context + const [visibleCodeExample, showCodeExample] = useState('SUBSCRIBE') return ( -
-
-

{siteConfig.tagline}

-

- Add a Realtime API to your PostgreSQL database without a single line of code. -

-
- {/* Supabase */} +
+
+
+
+
+

{siteConfig.tagline}

+

+ Add realtime and RESTful APIs to your existing PostgreSQL + database without a single line of code. +
+ Forget about custom-coding relational APIs and websockets. We introspect your + database and provide APIs instantly so you can focus on what is + most important - building your products. +

+
+ + Learn More + + + Join the List + +
+
+
+ {subscribeExample} +
+
- - Learn More - - - Request Early Access - -
-
- -
+ {features && features.length && (
@@ -116,21 +163,57 @@ function Home() {
-
-

For Developers

-

- We're a bunch of developers, building tools for developers. We're obsessed with solving your problems, - because they solve our problems too. Our products prioritize performance and simplicity because sometimes - doing less is better. +

+

For Developers

+

+ We're a bunch of developers, building tools for developers. We're obsessed with + solving your problems, because they solve our problems too. Our products + prioritize performance and simplicity because sometimes doing less is better.

-
-
- {subscribeExample} -
-
- +
+
+
+ + + + +
+
+ {visibleCodeExample === 'SUBSCRIBE' && {subscribeExample}} + {visibleCodeExample === 'READ' && {readExample}} + {visibleCodeExample === 'CREATE' && {createExample}} + {visibleCodeExample === 'UPDATE' && {updateExample}} +
@@ -139,7 +222,7 @@ function Home() {
- Try Supabase for free + Join the waiting list - GO + GO →
diff --git a/web/src/pages/styles.module.css b/web/src/pages/styles.module.css index 4331aa0c812..c897f7a1d6e 100755 --- a/web/src/pages/styles.module.css +++ b/web/src/pages/styles.module.css @@ -17,11 +17,6 @@ overflow: hidden; } */ -@media screen and (max-width: 966px) { - .heroBanner { - padding: 2rem; - } -} .heroBanner h2 { font-size: 2rem !important; @@ -29,12 +24,9 @@ .heroBanner p { font-size: 1rem !important; } - - .heroImage { max-height: 50vh; } - .features { display: flex; margin-top: 5rem; @@ -75,5 +67,5 @@ margin-bottom: 20px; } .pricingCard p { - margin: 0; + margin: 0; } \ No newline at end of file