Skip to content

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

Makes our blog posts page more readable

Paul Copplestone0a9e3e7e1212
diff --git a/web/package-lock.json b/web/package-lock.json
index 1804b27ef23..bfa7251f7af 100644
--- a/web/package-lock.json
+++ b/web/package-lock.json
@@ -8586,9 +8586,9 @@
}
},
"node-forge": {
- "version": "0.9.0",
- "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-0.9.0.tgz",
- "integrity": "sha512-7ASaDa3pD+lJ3WvXFsxekJQelBKRpne+GOVbLbtHYdd7pFspyeuJHnWfLplGf3SwKGbfs/aYl5V/JCIaHVUKKQ=="
+ "version": "0.10.0",
+ "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-0.10.0.tgz",
+ "integrity": "sha512-PPmu8eEeG9saEUvI97fm4OYxXVB6bFvyNTyiUOBichBpFG8A1Ljw3bY62+5oOjDEMHRnd0Y7HQ+x7uzxOzC6JA=="
},
"node-libs-browser": {
"version": "2.2.1",
@@ -11766,11 +11766,11 @@
"integrity": "sha1-Yl2GWPhlr0Psliv8N2o3NZpJlMo="
},
"selfsigned": {
- "version": "1.10.7",
- "resolved": "https://registry.npmjs.org/selfsigned/-/selfsigned-1.10.7.tgz",
- "integrity": "sha512-8M3wBCzeWIJnQfl43IKwOmC4H/RAp50S8DF60znzjW5GVqTcSe2vWclt7hmYVPkKPlHWOu5EaWOMZ2Y6W8ZXTA==",
+ "version": "1.10.8",
+ "resolved": "https://registry.npmjs.org/selfsigned/-/selfsigned-1.10.8.tgz",
+ "integrity": "sha512-2P4PtieJeEwVgTU9QEcwIRDQ/mXJLX8/+I3ur+Pg16nS8oNbrGxEso9NyYWy8NAmXiNl4dlAp5MwoNeCWzON4w==",
"requires": {
- "node-forge": "0.9.0"
+ "node-forge": "^0.10.0"
}
},
"semver": {
@@ -13617,7 +13617,6 @@
"version": "2.3.2",
"resolved": "https://registry.npmjs.org/braces/-/braces-2.3.2.tgz",
"integrity": "sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w==",
- "optional": true,
"requires": {
"arr-flatten": "^1.1.0",
"array-unique": "^0.3.2",
@@ -13635,7 +13634,6 @@
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz",
"integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=",
- "optional": true,
"requires": {
"is-extendable": "^0.1.0"
}
@@ -13666,7 +13664,6 @@
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-3.0.2.tgz",
"integrity": "sha1-Jqcarwc7OfshJxcnRhMcJwQCjbg=",
- "optional": true,
"requires": {
"assign-symbols": "^1.0.0",
"is-extendable": "^1.0.1"
@@ -13676,7 +13673,6 @@
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz",
"integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==",
- "optional": true,
"requires": {
"is-plain-object": "^2.0.4"
}
@@ -13687,7 +13683,6 @@
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz",
"integrity": "sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc=",
- "optional": true,
"requires": {
"extend-shallow": "^2.0.1",
"is-number": "^3.0.0",
@@ -13699,7 +13694,6 @@
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz",
"integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=",
- "optional": true,
"requires": {
"is-extendable": "^0.1.0"
}
@@ -13750,7 +13744,6 @@
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz",
"integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=",
- "optional": true,
"requires": {
"kind-of": "^3.0.2"
},
@@ -13759,7 +13752,6 @@
"version": "3.2.2",
"resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz",
"integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=",
- "optional": true,
"requires": {
"is-buffer": "^1.1.5"
}
@@ -13770,7 +13762,6 @@
"version": "3.1.10",
"resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.10.tgz",
"integrity": "sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg==",
- "optional": true,
"requires": {
"arr-diff": "^4.0.0",
"array-unique": "^0.3.2",
@@ -13826,7 +13817,6 @@
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-2.1.1.tgz",
"integrity": "sha1-fIDBe53+vlmeJzZ+DU3VWQFB2zg=",
- "optional": true,
"requires": {
"is-number": "^3.0.0",
"repeat-string": "^1.6.1"
diff --git a/web/package.json b/web/package.json
index 6e9c7641139..42ab9973f3d 100644
--- a/web/package.json
+++ b/web/package.json
@@ -33,6 +33,7 @@
},
"devDependencies": {
"axios": "^0.19.2",
- "babel-plugin-css-modules-transform": "^1.6.2"
+ "babel-plugin-css-modules-transform": "^1.6.2",
+ "clsx": "^1.1.1"
}
}
diff --git a/web/src/theme/BlogListPage/index.tsx b/web/src/theme/BlogListPage/index.tsx
new file mode 100644
index 00000000000..c725a954be5
--- /dev/null
+++ b/web/src/theme/BlogListPage/index.tsx
@@ -0,0 +1,112 @@
+/**
+ * Copyright (c) Facebook, Inc. and its affiliates.
+ *
+ * This source code is licensed under the MIT license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+import React from 'react';
+
+import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
+import Layout from '@theme/Layout';
+import BlogPostItem from '@theme/BlogPostItem';
+import BlogListPaginator from '@theme/BlogListPaginator';
+import type {Props} from '@theme/BlogListPage';
+import Link from '@docusaurus/Link'
+import styles from './styles.module.css'
+import clsx from 'clsx'
+
+const MONTHS = [
+ 'January',
+ 'February',
+ 'March',
+ 'April',
+ 'May',
+ 'June',
+ 'July',
+ 'August',
+ 'September',
+ 'October',
+ 'November',
+ 'December',
+]
+
+function BlogListPage(props: Props): JSX.Element {
+ const {metadata, items} = props;
+ const {
+ siteConfig: {title: siteTitle},
+ } = useDocusaurusContext();
+ const isBlogOnlyMode = metadata.permalink === '/';
+ const title = isBlogOnlyMode ? siteTitle : 'Blog';
+ const {blogDescription} = metadata;
+
+ return (
+ <Layout title={title} description={blogDescription}>
+ <div className="BlogListPage container margin-vert--lg">
+ <div className="row">
+ <main className="col col--10 col--offset-1">
+ <div className="row is-multiline ">
+ {items.map(({ content: BlogPostContent }) => {
+ const { date, permalink, tags, readingTime } = BlogPostContent.metadata
+ const match = date.substring(0, 10).split('-')
+ const year = match[0]
+ const month = MONTHS[parseInt(match[1], 10) - 1]
+ const day = parseInt(match[2], 10)
+ return (
+ <div className="col col--6">
+ <Link
+ className={clsx('card', styles.PostPreview)}
+ to={BlogPostContent.metadata.permalink}
+ key={BlogPostContent.metadata.permalink}
+ >
+ <div className={clsx('card__body', styles.PostPreviewBody)}>
+ <div className={styles.PostPreviewHeading}>
+ <h2>{BlogPostContent.frontMatter.title}</h2>
+ </div>
+
+ <div className="row row--no-gutters">
+ <div className={styles.PreviewDate}>
+ <time dateTime={date} className={styles.blogPostDate}>
+ {month} {day}, {year}{' '}
+ {readingTime && <> · {Math.ceil(readingTime)} min read</>}
+ </time>
+ </div>
+ <div className={styles.PreviewArrow}>
+ <svg
+ xmlns="http://www.w3.org/2000/svg"
+ viewBox="0 0 20 20"
+ fill="currentColor"
+ >
+ <path
+ fillRule="evenodd"
+ d="M12.293 5.293a1 1 0 011.414 0l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414-1.414L14.586 11H3a1 1 0 110-2h11.586l-2.293-2.293a1 1 0 010-1.414z"
+ clipRule="evenodd"
+ />
+ </svg>
+ </div>
+ </div>
+ {/* <BlogPostItem
+ key={BlogPostContent.metadata.permalink}
+ frontMatter={BlogPostContent.frontMatter}
+ metadata={BlogPostContent.metadata}
+ truncated={BlogPostContent.metadata.truncated}
+ >
+ <BlogPostContent />
+ </BlogPostItem> */}
+ </div>
+ </Link>
+ </div>
+ )
+ })}
+ </div>
+ <div style={{paddingLeft: 12}}>
+ <BlogListPaginator metadata={metadata} />
+ </div>
+ </main>
+ </div>
+ </div>
+ </Layout>
+ )
+}
+
+export default BlogListPage;
diff --git a/web/src/theme/BlogListPage/styles.module.css b/web/src/theme/BlogListPage/styles.module.css
new file mode 100644
index 00000000000..1fda9cc6c6a
--- /dev/null
+++ b/web/src/theme/BlogListPage/styles.module.css
@@ -0,0 +1,28 @@
+.PostPreview {
+ display: block;
+ border-width: 2px !important;
+}
+
+.PostPreviewBody {
+ display: flex;
+ flex-direction: column;
+ min-height: 140px !important;
+}
+.PostPreviewHeading {
+ flex-grow: 1;
+}
+.PreviewDate {
+ flex-grow: 1;
+}
+.PreviewArrow {
+ width: 25px;
+ height: 25px;
+ padding: 2px;
+}
+
+.PostPreview:hover .PreviewArrow {
+ margin-right: -5px;
+}
+.PostPreview:hover svg {
+ fill: var(--custom-primary);
+}
\ No newline at end of file