Skip to content

Commit 6798300

Browse files
authored
Merge pull request #34247 from storybookjs/add-pseudo-state-tailwind-hover-story
Addon-Pseudostates: Add story showing support for media hover syntax
2 parents 87733f1 + 7b98fdc commit 6798300

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

code/addons/pseudo-states/src/stories/Button.stories.tsx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import React, { type ComponentProps } from 'react';
22

33
import type { Meta, StoryObj } from '@storybook/react-vite';
4+
import { styled } from 'storybook/theming';
45

56
import { Button } from './Button';
67
import './grid.css';
@@ -54,6 +55,23 @@ export const Hover: Story = {
5455
},
5556
};
5657

58+
const StyledButton = styled(Button)`
59+
&:hover {
60+
@media (hover: hover) {
61+
background-color: limegreen !important;
62+
}
63+
}
64+
`;
65+
66+
export const HoverMediaQuery: Story = {
67+
parameters: {
68+
pseudo: { hover: true },
69+
},
70+
render: (args) => {
71+
return <StyledButton {...args}>Hover (hover: hover)</StyledButton>;
72+
},
73+
};
74+
5775
export const Focus: Story = {
5876
parameters: {
5977
pseudo: { focus: true },

0 commit comments

Comments
 (0)