Skip to content

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

chore: use next/image for images in articles

Jonathan Summers-Muirdc7e615e4159
diff --git a/apps/docs/components/index.tsx b/apps/docs/components/index.tsx
index c5a5aa3752a..cdfa36060b5 100644
--- a/apps/docs/components/index.tsx
+++ b/apps/docs/components/index.tsx
@@ -29,6 +29,7 @@ import CliGlobalFlagsHandler from '~/components/reference/enrichments/cli/CliGlo
import Options from '~/components/Options'
import Param from '~/components/Params'
+import Image from 'next/image'
const components = {
Admonition,
@@ -73,6 +74,13 @@ const components = {
CliGlobalFlagsHandler: () => <CliGlobalFlagsHandler />,
Options,
Param,
+ img: (props: any) => {
+ return (
+ <span className={['next-image--dynamic-fill'].join(' ')}>
+ <Image {...props} className={['rounded-md border'].join(' ')} layout="fill" />
+ </span>
+ )
+ },
}
export default components
diff --git a/apps/docs/styles/main.scss b/apps/docs/styles/main.scss
index db00f8c12e2..4d051a837ad 100644
--- a/apps/docs/styles/main.scss
+++ b/apps/docs/styles/main.scss
@@ -253,3 +253,29 @@ div[role='tablist'] {
max-width: 620px;
}
}
+
+/*
+* sets the image in @Next/Image components
+* to respect the height of the content
+*
+*/
+.next-image--dynamic-fill {
+ width: 100%;
+ grid-column: 1 / -1;
+}
+.next-image--dynamic-fill > span {
+ position: relative !important;
+}
+.next-image--dynamic-fill img {
+ object-fit: contain;
+ width: 100% !important;
+ position: relative !important;
+ height: unset !important;
+}
+
+.line-clamp {
+ display: -webkit-box;
+ margin: 0 auto;
+ -webkit-line-clamp: 2;
+ -webkit-box-orient: vertical;
+}