-
Notifications
You must be signed in to change notification settings - Fork 8
Demo Site: Add createImageSizes helper #3804
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
<RichTextBlock data={text} /> | ||
</TextContainer> | ||
</Root> | ||
<PageLayout> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By adding into a block, you are converting it into a PageContent-Block (a block that positions itself in the page (adds margins etc)).
PageContent-Blocks can only be used in the outer PageContentBlock (the root content-BlocksBlock) as it would add extra margins for nested usages.
common/blocks/* blocks can have two exports: A PageContent version and a plain version.
5f93d98
to
dfb5c9f
Compare
@@ -0,0 +1,17 @@ | |||
import theme, { Theme } from "@src/theme"; | |||
|
|||
export function createImageSizes(breakpointWidths: Partial<Record<keyof Theme["breakpoints"], string | number>>) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess this helper will never move into @comet/site
(because then you can't just import from src/theme)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As discussed in the focus meeting and with @johnnyomair the helper should only exist in the demo and the starter.
flex: 1; | ||
aspect-ratio: ${({ $imageAspectRatio }) => $imageAspectRatio}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this needed? the image itself already has the aspect-ratio
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without it there's a layout shift occurring. But there's already a task (https://vivid-planet.atlassian.net/browse/COM-1678) for it, so I removed it again.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
one PR, one task :)
import styled, { css } from "styled-components"; | ||
|
||
import { DamImageBlock } from "./DamImageBlock"; | ||
import { RichTextBlock } from "./RichTextBlock"; | ||
|
||
export const TextImageBlock = withPreview( | ||
const TextImageBlock = withPreview( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const TextImageBlock = withPreview( | |
export const TextImageBlock = withPreview(e |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At the moment the TextImageBlock is not used in any other file. Just for my understanding, why would you export it already?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- if it is a PageContent-Only block, it should not be in common/blocks (documents/pages/blocks would be correct I assume)
- it is very likely to be used in eg. Columns block (maybe we should add it there)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, I guess adding it to the ColumnsBlock (and probably the AccordionBlock) would be a topic for another PR, right? If yes, I wouldn't change anything in the folder structure now and handle it in a second PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, please.
(and don't remove the export in this PR)
2ba9767
to
13838b5
Compare
13838b5
to
f0da793
Compare
f0da793
to
e684f5f
Compare
Description
The function
createImageSizes
is implemented to generate thesizes
attribute string for Next.js images based on the breakpoints in the project. Thesizes
attribute is used by the browser to decide which image from thesrcset
to load depending on the viewport width.If not set, it defaults to100vw
.Acceptance criteria
Screenshots/screencasts
Bildschirmaufnahme.2025-04-24.um.15.25.08.mov
Further information