Skip to content
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

test(Image): test for Image added #361

Merged
merged 5 commits into from
Sep 21, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/components/Image/Image.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export interface ImageProps extends Partial<ImageObjectProps>, Partial<ImageDevi
export interface DeviceSpecificFragmentProps extends QAProps {
disableWebp: boolean;
src: string;
breakpoint: 'md' | 'sm';
breakpoint: string;
}

const checkWebP = (src: string) => {
Expand All @@ -37,11 +37,11 @@ const DeviceSpecificFragment = ({
<source
srcSet={checkWebP(src)}
type="image/webp"
media={`(max-width: ${BREAKPOINTS[breakpoint]}px)`}
media={`(max-width: ${breakpoint})`}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's put px here inside and remove extra parenthesis

media={(max-width: ${breakpoint}px}
telegram-cloud-photo-size-2-5217477476513602623-x

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure

data-qa={`${qa}-compressed`}
/>
)}
<source srcSet={src} media={`(max-width: ${BREAKPOINTS[breakpoint]}px)`} data-qa={qa} />
<source srcSet={src} media={`(max-width: ${breakpoint})`} data-qa={qa} />
</Fragment>
);

Expand Down Expand Up @@ -89,15 +89,15 @@ const Image = (props: ImageProps) => {
<DeviceSpecificFragment
src={mobile}
disableWebp={disableWebp}
breakpoint="sm"
breakpoint={`${BREAKPOINTS.sm} px)`}
qa={qaAttributes.mobileSource}
/>
)}
{tablet && (
<DeviceSpecificFragment
src={tablet}
disableWebp={disableWebp}
breakpoint="md"
breakpoint={`${BREAKPOINTS.md} px)`}
qa={qaAttributes.tabletSource}
/>
)}
Expand Down
Loading