Skip to content

Commit

Permalink
refactor: remove src from source
Browse files Browse the repository at this point in the history
  • Loading branch information
alexgoff committed Dec 9, 2024
1 parent 7205784 commit d04b864
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ Primary.args = {
},
sources: [
{
src: "https://rubin.canto.com/direct/image/9u18e5a58t17t372gj0eepo80c/A9NWRljpJ8XF4R4q91q1d0ubEuA/original?content-type=image%2Fjpeg&name=Eye-Bayer+filter+comparison+V2-100.jpg",
srcSet: generateCantoSrcSet(
"https://rubin.canto.com/direct/image/9u18e5a58t17t372gj0eepo80c/DN9LDOXn0jmgoGTOJP8agB55AHE/m800/",
823
Expand Down
11 changes: 6 additions & 5 deletions packages/epo-react-lib/src/atomic/Picture/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ type AlternateSource = {
width: number;
height?: number;
mediaCondition?: string;
srcSet: Array<srcType>;
src: string;
srcSet: string | Array<srcType>;
};

export type PictureProps = {
Expand All @@ -25,13 +24,15 @@ const Picture: FunctionComponent<PictureProps> = ({
}) => {
return (
<picture {...{ className }}>
{sources.map(({ src, srcSet, mediaCondition, width, ...props }, i) => {
{sources.map(({ srcSet, mediaCondition, ...props }, i) => {
return (
<source
key={i}
srcSet={stringifySrcSet([...srcSet, { src, size: width }])}
srcSet={
Array.isArray(srcSet) ? stringifySrcSet([...srcSet]) : srcSet
}
media={mediaCondition}
{...{ width, ...props }}
{...{ ...props }}
/>
);
})}
Expand Down

0 comments on commit d04b864

Please sign in to comment.