Skip to content

Commit a227d77

Browse files
Valent1325Maksim MalofeevMaksim Malofeev
authored
chore(BasicCard): background color hover property update tests and schema (#1327)
* feat: add background color hover property for BasicCard * chore(BasicCard): update tests and schema --------- Co-authored-by: Maksim Malofeev <[email protected]> Co-authored-by: Maksim Malofeev <[email protected]>
1 parent e8ab9a2 commit a227d77

File tree

8 files changed

+23
-0
lines changed

8 files changed

+23
-0
lines changed

memory-bank/activeContext.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,14 @@ Recent development has focused on:
6565
8. **Performance Optimization**: Reducing bundle size and improving rendering performance
6666
9. **Documentation**: Expanding Storybook examples and documentation
6767

68+
10. **Hover Background Color Enhancement**: Added support for customizable hover background colors in BasicCard component:
69+
70+
- **Schema Support**: Added `hoverBackgroundColor` property to BasicCard schema as optional string field
71+
- **Component Implementation**: BasicCard component now accepts `hoverBackgroundColor` prop and applies it as CSS custom property `--hover-background-color`
72+
- **CSS Integration**: Uses existing `background-hover()` mixin in CardBase component that applies the custom property on hover
73+
- **Flexible Styling**: Allows any valid CSS color value (hex, rgb, rgba, named colors, etc.)
74+
- **Backward Compatibility**: Optional property that doesn't affect existing implementations
75+
6876
## Active Decisions and Considerations
6977

7078
### Architecture

src/sub-blocks/BasicCard/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,5 @@
1515
`buttons?: Button[]` — An array with button objects (see [Content blocks](?path=/docs/documentation-types--docs))
1616

1717
`border: 'shadow' | 'line' | 'none'` — Card border properties (defaults to `'shadow'`).
18+
19+
`hoverBackgroundColor?: string` - Card hover background color
Loading
Loading

src/sub-blocks/BasicCard/__stories__/BasicCard.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,6 @@ For a detailed usage guide of the BasicCard sub-block, see [BasicCard Usage](htt
4040

4141
`target?: '_blank' | '_parent' | '_top' | '_self'` — Target for the URL
4242

43+
`hoverBackgroundColor?: string` - Card hover background color
44+
4345
</StoryTemplate>

src/sub-blocks/BasicCard/__tests__/BasicCard.visual.test.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import {
44
ControlPosition,
55
Default,
66
GravityIcons,
7+
HoverEffects,
78
Sizes,
89
WithBorder,
910
WithContentList,
@@ -59,4 +60,10 @@ test.describe('BasicCard', () => {
5960
await defaultDelay();
6061
await expectScreenshot({skipTheme: 'dark'});
6162
});
63+
64+
test('render stories <HoverEffects>', async ({mount, expectScreenshot, defaultDelay}) => {
65+
await mount(<HoverEffects />);
66+
await defaultDelay();
67+
await expectScreenshot({skipTheme: 'dark'});
68+
});
6269
});

src/sub-blocks/BasicCard/__tests__/helpers.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,5 @@ export const {
1111
ControlPosition,
1212
Sizes,
1313
GravityIcons,
14+
HoverEffects,
1415
} = composeStories(BasicCardStories);

src/sub-blocks/BasicCard/schema.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ export const BasicCard = {
4040
type: 'string',
4141
enum: ['content', 'footer'],
4242
},
43+
hoverBackgroundColor: {
44+
type: 'string',
45+
},
4346
},
4447
},
4548
};

0 commit comments

Comments
 (0)