Skip to content

Commit b5e9661

Browse files
authored
feat: allow background for image-card with url (#1020)
1 parent da48367 commit b5e9661

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

src/sub-blocks/ImageCard/ImageCard.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ const ImageCard = (props: ImageCardProps) => {
8080
rel={target === '_blank' ? 'noopener noreferrer' : undefined}
8181
className={b({border, 'with-content': hasContent, direction})}
8282
title={urlTitle}
83+
style={{backgroundColor}}
8384
extraProps={{
8485
draggable: false,
8586
onDragStart: (e: React.DragEvent<HTMLAnchorElement>) => e.preventDefault(),

src/sub-blocks/ImageCard/__stories__/ImageCard.stories.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,13 +159,15 @@ export const DirectionReverse = MultipleTemplate.bind({});
159159
export const Content = ContentTemplate.bind({});
160160
export const BackgroundColor = MultipleTemplate.bind({});
161161
export const WithUrl = MultipleTemplate.bind({});
162+
export const WithUrlAndBackgroundColor = BorderTemplate.bind({});
162163
export const Border = BorderTemplate.bind({});
163164
export const BorderRadius = BorderRadiusTemplate.bind({});
164165
export const ControlPosition = ControlPositionTemplate.bind({});
165166

166167
DirectionReverse.args = {direction: 'reverse'} as Partial<ImageCardProps>;
167168
BackgroundColor.args = {...data.backgroundColor.content};
168169
WithUrl.args = {...data.withUrl.content};
170+
WithUrlAndBackgroundColor.args = {...data.withUrlAndBackgroundColor.content};
169171
ControlPosition.args = undefined;
170172
ControlPosition.argTypes = {
171173
title: {table: {disable: true}},

src/sub-blocks/ImageCard/__stories__/data.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,12 @@
5353
"url": "https://example.com"
5454
}
5555
},
56+
"withUrlAndBackgroundColor": {
57+
"content": {
58+
"url": "https://example.com",
59+
"backgroundColor": "#ccf0d2"
60+
}
61+
},
5662
"content": {
5763
"url": "https://example.com",
5864
"links": [

0 commit comments

Comments
 (0)