Skip to content

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

chore: blog post styling updated

Jonathan Summers-Muirdf43575f8e62
diff --git a/www/components/Blog/BlogListItem.tsx b/www/components/Blog/BlogListItem.tsx
index 3d20a229988..25a1e961119 100644
--- a/www/components/Blog/BlogListItem.tsx
+++ b/www/components/Blog/BlogListItem.tsx
@@ -45,10 +45,10 @@ const BlogListItem = ({ blog }: Props) => {
{author.author_image_url && (
<img src={author.author_image_url} className="rounded-full w-10 mr-4" />
)}
- <Space direction="vertical" size={0}>
- <p className="text-sm m-0">{author.author}</p>
- <p className="text-xs m-0 text-scale-900">{author.position}</p>
- </Space>
+ <div className="flex flex-col">
+ <span className="text-sm m-0 text-scale-1200">{author.author}</span>
+ <span className="text-xs m-0 text-scale-900">{author.position}</span>
+ </div>
</div>
)}
</div>
diff --git a/www/components/CodeBlock/CodeBlock.module.css b/www/components/CodeBlock/CodeBlock.module.css
index 5df186966fd..d4bc776c1e5 100644
--- a/www/components/CodeBlock/CodeBlock.module.css
+++ b/www/components/CodeBlock/CodeBlock.module.css
@@ -1,6 +1,5 @@
.code-block {
@apply rounded-lg;
- /* padding-top: 8px !important; */
@apply border border-gray-600;
}
diff --git a/www/package.json b/www/package.json
index 97f698cd2fb..312c3216028 100644
--- a/www/package.json
+++ b/www/package.json
@@ -45,6 +45,7 @@
"uuid": "^8.3.2"
},
"devDependencies": {
+ "@tailwindcss/typography": "^0.5.2",
"@types/classnames": "^2.2.10",
"@types/jest": "^25.2.2",
"@types/node": "^14.0.1",
diff --git a/www/pages/blog.tsx b/www/pages/blog.tsx
index 139090ba4e0..5962de26e97 100644
--- a/www/pages/blog.tsx
+++ b/www/pages/blog.tsx
@@ -161,8 +161,8 @@ function FeaturedThumb(blog: PostTypes) {
<img src={author.author_image_url} className="rounded-full w-10" />
)}
<div className="flex flex-col">
- <p className="m-0 text-sm">{author.author}</p>
- <p className="m-0 text-xs">{author.position}</p>
+ <span className="m-0 text-sm text-scale-1200">{author.author}</span>
+ <span className="m-0 text-xs text-scale-900">{author.position}</span>
</div>
</div>
)}
diff --git a/www/pages/blog/[year]/[month]/[day]/[slug].module.css b/www/pages/blog/[year]/[month]/[day]/[slug].module.css
index 66da7170e6c..f5f939a0445 100644
--- a/www/pages/blog/[year]/[month]/[day]/[slug].module.css
+++ b/www/pages/blog/[year]/[month]/[day]/[slug].module.css
@@ -1,4 +1,4 @@
-.toc a {
+/* .toc a {
text-decoration: none !important;
font-weight: 400 !important;
}
@@ -43,4 +43,4 @@
.article > div > pre {
padding: 0;
background: none;
-}
+} */
diff --git a/www/pages/blog/[year]/[month]/[day]/[slug].tsx b/www/pages/blog/[year]/[month]/[day]/[slug].tsx
index d621a72b9bf..b19cd8cfd66 100644
--- a/www/pages/blog/[year]/[month]/[day]/[slug].tsx
+++ b/www/pages/blog/[year]/[month]/[day]/[slug].tsx
@@ -123,9 +123,9 @@ function BlogPostPage(props: any) {
}
const toc = props.blog.toc && (
- <Space direction="vertical" size={8} className="py-8 lg:py-0">
+ <div className="space-y-8 py-8 lg:py-0">
<div>
- <Space>
+ <div className="space-x-2">
{props.blog.tags.map((tag: string) => {
return (
<a href={`/blog/tags/${tag}`} key={`category-badge-${tag}`}>
@@ -133,17 +133,17 @@ function BlogPostPage(props: any) {
</a>
)
})}
- </Space>
+ </div>
</div>
<div>
- <p>Table of contents</p>
+ <p className="text-scale-1200">On this page</p>
<div>
- <div className={blogStyles['toc']}>
+ <div className={[blogStyles['toc'], 'prose prose-toc'].join(' ')}>
<ReactMarkdown plugins={[gfm]}>{props.blog.toc.content}</ReactMarkdown>
</div>
</div>
</div>
- </Space>
+ </div>
)
return (
@@ -219,10 +219,10 @@ function BlogPostPage(props: any) {
className="rounded-full w-10 border border-scale-600 mr-4"
/>
)}
- <Space direction="vertical" size={0}>
- <p className="text-xs m-0">{author.author}</p>
- <p className="text-xs m-0">{author.position}</p>
- </Space>
+ <div className="flex flex-col">
+ <span className="text-xs mb-0">{author.author}</span>
+ <span className="text-xs mb-0 text-scale-900">{author.position}</span>
+ </div>
</div>
</a>
</Link>
@@ -240,16 +240,19 @@ function BlogPostPage(props: any) {
style={{ maxHeight: '520px' }}
/>
)}
- <article className={[blogStyles['article'], 'prose'].join(' ')}>
+ <article className={[blogStyles['article'], 'prose prose-docs'].join(' ')}>
{content}
</article>
- <div className="text-scale-900 dark:text-scale-1000">Share with your friends</div>
- <div className="flex space-x-4 mt-4">
- <div>
+ <div className="py-16">
+ <div className="text-sm text-scale-900 dark:text-scale-1000">
+ Share this article
+ </div>
+ <div className="flex space-x-4 items-center mt-4">
<Link
- href={`https://twitter.com/share?text=Checkout%20@supabase's%20new%20blog%20post%20%7C%20${props.blog.title}&url=https://supabase.com/blog/${props.blog.slug}`}
+ passHref
+ href={`https://twitter.com/share?text=${props.blog.title}&url=https://supabase.com/blog/${props.blog.slug}`}
>
- <a target="_blank" className="text-scale-900 hover:text-scale-1000">
+ <a target="_blank" className="text-scale-900 hover:text-scale-1200">
<svg
height="26"
width="26"
@@ -264,13 +267,12 @@ function BlogPostPage(props: any) {
</svg>
</a>
</Link>
- </div>
- <div>
<Link
- href={`https://www.linkedin.com/shareArticle?url=https://supabase.com/blog/${props.blog.slug}&title=Checkout%20@supabase's%20new%20blog%20post%20%7C%20${props.blog.title}`}
+ passHref
+ href={`https://www.linkedin.com/shareArticle?url=https://supabase.com/blog/${props.blog.slug}&title=${props.blog.title}`}
>
- <a target="_blank" className="text-scale-900 hover:text-scale-1000">
+ <a target="_blank" className="text-scale-900 hover:text-scale-1200">
<svg
width="20"
height="20"
@@ -283,26 +285,6 @@ function BlogPostPage(props: any) {
</a>
</Link>
</div>
-
- <button
- onClick={() => copyLink()}
- className="text-scale-900 hover:text-scale-1000"
- >
- <svg
- className="h-6 w-6"
- viewBox="0 0 24 24"
- fill="none"
- stroke="currentColor"
- xmlns="http://www.w3.org/2000/svg"
- >
- <path
- strokeLinecap="round"
- strokeLinejoin="round"
- strokeWidth={2}
- d="M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"
- />
- </svg>
- </button>
</div>
<div className="grid lg:grid-cols-1 gap-8 py-8">
<div>
@@ -317,40 +299,36 @@ function BlogPostPage(props: any) {
</div>
{/* Sidebar */}
<div className="col-span-12 lg:col-span-5 xl:col-span-3 xl:col-start-9 space-y-8">
- <Space direction="vertical" size={8} className="lg:mb-16 lg:top-16 lg:sticky">
+ <div className="space-y-8 lg:mb-16 lg:top-16 lg:sticky">
<div className="hidden lg:block">{toc}</div>
<div>
<div className="mb-4">
- <p>Related articles</p>
+ <p className="text-sm text-scale-1200">Related articles</p>
</div>
- <Space direction="vertical">
+ <div className="space-y-0">
{props.relatedPosts.map((post: any) => (
<Link href={`/blog/${post.url}`} as={`/blog/${post.url}`}>
<div>
<p className="cursor-pointer">
- <Space>
+ <div className="flex items-center gap-2">
<IconFile size={'small'} style={{ minWidth: '1.2rem' }} />
- <span className="hover:text-gray-900 dark:hover:text-white">
+ <span className="text-sm hover:text-gray-900 dark:hover:text-white">
{post.title}
</span>
- </Space>
+ </div>
</p>
<Divider light className="mt-2" />
</div>
</Link>
))}
<Link href={`/blog`} as={`/blog`}>
- <div>
- <p>
- <span className="hover:text-gray-900 dark:hover:text-white cursor-pointer">
- View all posts
- </span>
- </p>
- </div>
+ <a className="text-sm text-scale-1100 hover:text-scale-1200 cursor-pointer">
+ View all posts
+ </a>
</Link>
- </Space>
+ </div>
</div>
- </Space>
+ </div>
</div>
</div>
</div>
diff --git a/www/styles/index.css b/www/styles/index.css
index 4e0a5e813f1..cfb6a33b266 100644
--- a/www/styles/index.css
+++ b/www/styles/index.css
@@ -28,70 +28,84 @@ body {
-moz-osx-font-smoothing: grayscale;
}
-h1,
+/* h1,
h2,
h3,
h4,
h5,
-h6 {
+h6 { */
+/*
+ Typography
+*/
+
+h1:not(.prose *):not(.overwrite),
+h2:not(.prose *):not(.overwrite),
+h3:not(.prose *):not(.overwrite),
+h4:not(.prose *):not(.overwrite),
+h5:not(.prose *):not(.overwrite),
+h6:not(.prose *):not(.overwrite) {
@apply text-scale-1200;
margin-bottom: 16px;
}
-h2 {
+h1:not(.prose *):not(.overwrite) {
+ @apply text-4xl;
+}
+
+h2:not(.prose *):not(.overwrite) {
@apply text-3xl;
}
-h3 {
+h3:not(.prose *):not(.overwrite) {
@apply text-2xl;
}
-h4 {
+h4:not(.prose *):not(.overwrite) {
@apply text-xl;
}
-h5 {
+h5:not(.prose *):not(.overwrite) {
@apply text-xl;
}
-h1,
-h2 {
+h1:not(.prose *):not(.overwrite),
+h2:not(.prose *):not(.overwrite) {
line-height: 1.2 !important;
}
@media only screen and (max-width: 960px) {
- h1 {
+ h1:not(.prose *):not(.overwrite) {
font-size: 2.2rem !important;
}
- h2 {
+ h2:not(.prose *):not(.overwrite) {
font-size: 2rem !important;
}
}
@media only screen and (max-width: 720px) {
- h1 {
+ h1:not(.prose *):not(.overwrite) {
font-size: 2rem !important;
}
- h2 {
+ h2:not(.prose *):not(.overwrite) {
font-size: 1.8rem !important;
}
}
@media only screen and (max-width: 520px) {
- h1 {
+ h1:not(.prose *):not(.overwrite) {
font-size: 1.8rem !important;
}
- h2 {
+ h2:not(.prose *):not(.overwrite) {
font-size: 1.6rem !important;
}
}
-p {
+p:not(.prose *):not(.overwrite) {
@apply text-scale-1100;
margin-bottom: 16px;
}
-small {
+small:not(.prose *):not(.overwrite) {
@apply text-xs text-scale-900;
}
diff --git a/www/tailwind.config.js b/www/tailwind.config.js
index 41f6e940dc9..d014e4317a2 100644
--- a/www/tailwind.config.js
+++ b/www/tailwind.config.js
@@ -24,6 +24,107 @@ module.exports = ui({
dark: theme('colors.scale.600', 'currentColor'),
}),
extend: {
+ typography: ({ theme }) => ({
+ // Removal of backticks in code blocks for tailwind v3.0
+ // https://github.com/tailwindlabs/tailwindcss-typography/issues/135
+ DEFAULT: {
+ css: {
+ 'code::before': {
+ content: '""',
+ },
+ 'code::after': {
+ content: '""',
+ },
+ '--tw-prose-body': theme('colors.scale[1100]'),
+ '--tw-prose-headings': theme('colors.scale[1200]'),
+ '--tw-prose-lead': theme('colors.scale[1100]'),
+ '--tw-prose-links': theme('colors.brand[900]'),
+ '--tw-prose-bold': theme('colors.scale[1100]'),
+ '--tw-prose-counters': theme('colors.scale[1100]'),
+ '--tw-prose-bullets': theme('colors.scale[900]'),
+ '--tw-prose-hr': theme('colors.scale[500]'),
+ '--tw-prose-quotes': theme('colors.scale[1100]'),
+ '--tw-prose-quote-borders': theme('colors.scale[500]'),
+ '--tw-prose-captions': theme('colors.scale[700]'),
+ '--tw-prose-code': theme('colors.scale[1200]'),
+ '--tw-prose-pre-code': theme('colors.scale[900]'),
+ '--tw-prose-pre-bg': theme('colors.scale[400]'),
+ '--tw-prose-th-borders': theme('colors.scale[500]'),
+ '--tw-prose-td-borders': theme('colors.scale[200]'),
+ '--tw-prose-invert-body': theme('colors.scale[200]'),
+ '--tw-prose-invert-headings': theme('colors.white'),
+ '--tw-prose-invert-lead': theme('colors.scale[500]'),
+ '--tw-prose-invert-links': theme('colors.white'),
+ '--tw-prose-invert-bold': theme('colors.white'),
+ '--tw-prose-invert-counters': theme('colors.scale[400]'),
+ '--tw-prose-invert-bullets': theme('colors.scale[600]'),
+ '--tw-prose-invert-hr': theme('colors.scale[700]'),
+ '--tw-prose-invert-quotes': theme('colors.scale[100]'),
+ '--tw-prose-invert-quote-borders': theme('colors.scale[700]'),
+ '--tw-prose-invert-captions': theme('colors.scale[400]'),
+ // the following are typography overrides
+ // examples can be seen here —> https://github.com/tailwindlabs/tailwindcss-typography/blob/master/src/styles.js
+ // reset all header font weights
+ 'h1, h2, h3, h4, h5': {
+ fontWeight: '400',
+ },
+ h2: {
+ fontWeight: '400',
+ },
+ p: {
+ fontWeight: '400',
+ },
+ a: {
+ fontWeight: '400',
+ },
+ pre: {
+ background: 'none',
+ padding: 0,
+ marginBottom: '32px',
+ },
+ },
+ },
+
+ toc: {
+ css: {
+ ul: {
+ 'list-style-type': 'none',
+ 'padding-left': 0,
+ margin: 0,
+ li: {
+ 'padding-left': 0,
+ },
+ a: {
+ display: 'block',
+ 'text-decoration': 'none',
+ fontSize: '0.8rem',
+ fontWeight: '200',
+ color: theme('colors.scale[1100]'),
+ '&:hover': {
+ color: theme('colors.scale[1200]'),
+ },
+ 'font-weight': '400',
+ },
+ // margin: 0,
+ ul: {
+ 'list-style-type': 'disc',
+ li: {
+ margin: 0,
+ 'padding-left': '0 !important',
+ 'margin-left': '1.5rem',
+ },
+ a: {
+ fontWeight: '200',
+ color: theme('colors.scale[1000]'),
+ '&:hover': {
+ color: theme('colors.scale[1200]'),
+ },
+ },
+ },
+ },
+ },
+ },
+ }),
// screens: {
// sm: '640px',
// // => @media (min-width: 640px) { ... }
@@ -124,5 +225,5 @@ module.exports = ui({
// height: ['hover'],
// },
// },
- plugins: [],
+ plugins: [require('@tailwindcss/typography')],
})