Skip to content

Commit af677d8

Browse files
committed
responsive max-width
1 parent 49c7771 commit af677d8

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

docs/working-notes/todo4.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,12 @@ height and width MUST be defined ON SERVER component to prevent layout shift
113113
----
114114
img srcset
115115
copy hooks for width for page size and observer form react-use or usehooks
116+
117+
--------
118+
fora0: cant pass props from client component to child server component - slot (astro Image component)
119+
fora1: margin collapsing disabled in flex, grid, mdx container
120+
fora2: client component size must be set in server component to prevent layout shift (flex or height and max-height)
121+
fora3: px suffix for style={{width, height}} in react
116122
```
117123

118124

src/components/ImageRandom.astro

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ const { width, height } = Object.fromEntries(
1717
{/* height and width MUST be defined ON SERVER component to prevent layout shift */}
1818
{/* set height and width to image size but set real size with max-height and max-width */}
1919

20-
<div class={cn('max-w-full max-h-96 my-8', className)} style={{ width, height }} {...props}>
20+
<div
21+
class={cn('max-w-full max-h-64 md:max-h-96 my-8', className)}
22+
style={{ width, height }}
23+
{...props}
24+
>
2125
<ImageRandomReact {galleryImages} client:load />
2226
</div>

0 commit comments

Comments
 (0)