Skip to content

Commit fa0e9a1

Browse files
authored
Merge pull request supabase#7297 from supabase/fix/blog-next-image
fix:blog posts now using @next/image
2 parents 085b7ef + f8459dd commit fa0e9a1

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

apps/www/pages/blog/[year]/[month]/[day]/[slug].tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,13 @@ const components = {
2929
return <CodeBlock {...props} />
3030
},
3131
ImageGrid,
32+
img: (props: any) => {
33+
return (
34+
<div className="next-image--dynamic-fill">
35+
<Image {...props} layout="fill" className="custom-img" />
36+
</div>
37+
)
38+
},
3239
}
3340

3441
// plugins for next-mdx-remote

apps/www/styles/index.css

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,3 +223,22 @@ table {
223223
.sbui-typography a {
224224
@apply break-words;
225225
}
226+
227+
/*
228+
* sets the image in @Next/Image components
229+
* to respect the height of the content
230+
*
231+
*/
232+
.next-image--dynamic-fill {
233+
width: 100%;
234+
grid-column: 1 / -1;
235+
}
236+
.next-image--dynamic-fill > span {
237+
position: relative !important;
238+
}
239+
.next-image--dynamic-fill img {
240+
object-fit: contain;
241+
width: 100% !important;
242+
position: relative !important;
243+
height: unset !important;
244+
}

0 commit comments

Comments
 (0)