Skip to content

Commit

Permalink
feat: allow background for image-card with url (#1020)
Browse files Browse the repository at this point in the history
  • Loading branch information
niktverd authored Sep 19, 2024
1 parent da48367 commit b5e9661
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/sub-blocks/ImageCard/ImageCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ const ImageCard = (props: ImageCardProps) => {
rel={target === '_blank' ? 'noopener noreferrer' : undefined}
className={b({border, 'with-content': hasContent, direction})}
title={urlTitle}
style={{backgroundColor}}
extraProps={{
draggable: false,
onDragStart: (e: React.DragEvent<HTMLAnchorElement>) => e.preventDefault(),
Expand Down
2 changes: 2 additions & 0 deletions src/sub-blocks/ImageCard/__stories__/ImageCard.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -159,13 +159,15 @@ export const DirectionReverse = MultipleTemplate.bind({});
export const Content = ContentTemplate.bind({});
export const BackgroundColor = MultipleTemplate.bind({});
export const WithUrl = MultipleTemplate.bind({});
export const WithUrlAndBackgroundColor = BorderTemplate.bind({});
export const Border = BorderTemplate.bind({});
export const BorderRadius = BorderRadiusTemplate.bind({});
export const ControlPosition = ControlPositionTemplate.bind({});

DirectionReverse.args = {direction: 'reverse'} as Partial<ImageCardProps>;
BackgroundColor.args = {...data.backgroundColor.content};
WithUrl.args = {...data.withUrl.content};
WithUrlAndBackgroundColor.args = {...data.withUrlAndBackgroundColor.content};
ControlPosition.args = undefined;
ControlPosition.argTypes = {
title: {table: {disable: true}},
Expand Down
6 changes: 6 additions & 0 deletions src/sub-blocks/ImageCard/__stories__/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@
"url": "https://example.com"
}
},
"withUrlAndBackgroundColor": {
"content": {
"url": "https://example.com",
"backgroundColor": "#ccf0d2"
}
},
"content": {
"url": "https://example.com",
"links": [
Expand Down

0 comments on commit b5e9661

Please sign in to comment.