Fix tooltip bugs
This commit is contained in:
parent
6398a01852
commit
c6eafbb8d5
16 changed files with 339 additions and 235 deletions
80
ts/components/Tooltip.stories.tsx
Normal file
80
ts/components/Tooltip.stories.tsx
Normal file
|
@ -0,0 +1,80 @@
|
|||
// Copyright 2020 Signal Messenger, LLC
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
import * as React from 'react';
|
||||
import { storiesOf } from '@storybook/react';
|
||||
import { select } from '@storybook/addon-knobs';
|
||||
|
||||
import { Tooltip, TooltipPlacement, PropsType } from './Tooltip';
|
||||
|
||||
const createProps = (overrideProps: Partial<PropsType> = {}): PropsType => ({
|
||||
content: overrideProps.content || 'Hello World',
|
||||
direction: select('direction', TooltipPlacement, overrideProps.direction),
|
||||
sticky: overrideProps.sticky,
|
||||
});
|
||||
|
||||
const story = storiesOf('Components/Tooltip', module);
|
||||
|
||||
const Trigger = (
|
||||
<span
|
||||
style={{
|
||||
display: 'inline-block',
|
||||
marginTop: 200,
|
||||
marginBottom: 200,
|
||||
marginLeft: 200,
|
||||
marginRight: 200,
|
||||
}}
|
||||
>
|
||||
Trigger
|
||||
</span>
|
||||
);
|
||||
|
||||
story.add('Top', () => (
|
||||
<Tooltip
|
||||
{...createProps({
|
||||
direction: TooltipPlacement.Top,
|
||||
})}
|
||||
>
|
||||
{Trigger}
|
||||
</Tooltip>
|
||||
));
|
||||
|
||||
story.add('Right', () => (
|
||||
<Tooltip
|
||||
{...createProps({
|
||||
direction: TooltipPlacement.Right,
|
||||
})}
|
||||
>
|
||||
{Trigger}
|
||||
</Tooltip>
|
||||
));
|
||||
|
||||
story.add('Bottom', () => (
|
||||
<Tooltip
|
||||
{...createProps({
|
||||
direction: TooltipPlacement.Bottom,
|
||||
})}
|
||||
>
|
||||
{Trigger}
|
||||
</Tooltip>
|
||||
));
|
||||
|
||||
story.add('Left', () => (
|
||||
<Tooltip
|
||||
{...createProps({
|
||||
direction: TooltipPlacement.Left,
|
||||
})}
|
||||
>
|
||||
{Trigger}
|
||||
</Tooltip>
|
||||
));
|
||||
|
||||
story.add('Sticky', () => (
|
||||
<Tooltip
|
||||
{...createProps({
|
||||
sticky: true,
|
||||
})}
|
||||
>
|
||||
{Trigger}
|
||||
</Tooltip>
|
||||
));
|
Loading…
Add table
Add a link
Reference in a new issue