-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat!: refactor components to use Floating UI API (#1979)
Co-authored-by: oynikishin <[email protected]> Co-authored-by: oynikishin <[email protected]>
- Loading branch information
1 parent
b41e9ce
commit 8f218d8
Showing
64 changed files
with
1,674 additions
and
1,709 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 51 additions & 11 deletions
62
src/components/ActionTooltip/__stories__/ActionTooltip.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,62 @@ | ||
import type {StoryFn} from '@storybook/react'; | ||
import {FloppyDisk} from '@gravity-ui/icons'; | ||
import type {Meta, StoryObj} from '@storybook/react'; | ||
|
||
import {Button} from '../../Button'; | ||
import {Icon} from '../../Icon'; | ||
import {ActionTooltip} from '../ActionTooltip'; | ||
import type {ActionTooltipProps} from '../ActionTooltip'; | ||
|
||
export default { | ||
const meta: Meta<typeof ActionTooltip> = { | ||
title: 'Components/Overlays/ActionTooltip', | ||
component: ActionTooltip, | ||
parameters: { | ||
layout: 'centered', | ||
a11y: { | ||
element: '#storybook-root', | ||
config: { | ||
rules: [ | ||
{ | ||
id: 'button-name', | ||
// We set aria-attributes dynamically | ||
enabled: false, | ||
}, | ||
], | ||
}, | ||
}, | ||
}, | ||
}; | ||
|
||
const DefaultTemplate: StoryFn<ActionTooltipProps> = (args) => <ActionTooltip {...args} />; | ||
export default meta; | ||
|
||
export const Default = DefaultTemplate.bind({}); | ||
type Story = StoryObj<typeof ActionTooltip>; | ||
|
||
Default.args = { | ||
title: 'Tooltip text', | ||
hotkey: 'mod+s', | ||
description: | ||
'Lorem ipsum is placeholder text commonly used in the graphic, print, and publishing industries for previewing layouts and visual mockups.', | ||
children: <Button>Hover to see tooltip</Button>, | ||
export const Default: Story = { | ||
render: (args) => { | ||
return ( | ||
<ActionTooltip {...args}> | ||
<Button> | ||
<Icon data={FloppyDisk} size={16} /> | ||
</Button> | ||
</ActionTooltip> | ||
); | ||
}, | ||
args: { | ||
title: 'Save', | ||
}, | ||
}; | ||
|
||
export const Hotkey: Story = { | ||
...Default, | ||
args: { | ||
...Default.args, | ||
hotkey: 'mod+s', | ||
}, | ||
}; | ||
|
||
export const Description: Story = { | ||
...Default, | ||
args: { | ||
...Default.args, | ||
description: | ||
'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua', | ||
}, | ||
}; |
Oops, something went wrong.