mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-17 18:51:10 +01:00
added some tooltip stories to test multiline
This commit is contained in:
@@ -32,24 +32,38 @@ import Button from "./buttons/Button";
|
|||||||
|
|
||||||
const Wrapper = styled.div`
|
const Wrapper = styled.div`
|
||||||
margin: 2rem;
|
margin: 2rem;
|
||||||
max-width: 400px;
|
width: 100%;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const Spacing = styled.div`
|
const Spacing = styled.div`
|
||||||
padding: 2em 6em;
|
padding: 2em 6em;
|
||||||
|
width: 50%;
|
||||||
|
margin: 0 auto;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const positions = ["right", "top", "left", "bottom"];
|
const positions = ["right", "top", "left", "bottom"];
|
||||||
|
|
||||||
const message = "Heart of Gold";
|
const message = "Heart of Gold";
|
||||||
|
|
||||||
|
const mutltiline = `Characters:
|
||||||
|
|
||||||
|
- Arthur Dent
|
||||||
|
- Ford Prefect
|
||||||
|
- Zaphod Beeblebrox
|
||||||
|
- Marvin the Paranoid Android
|
||||||
|
- Trillian
|
||||||
|
- Slartibartfast`;
|
||||||
|
|
||||||
|
const shortMultiline = `* a
|
||||||
|
* b
|
||||||
|
* c`;
|
||||||
|
|
||||||
const RoutingDecorator = (story: () => ReactNode) => <MemoryRouter initialEntries={["/"]}>{story()}</MemoryRouter>;
|
const RoutingDecorator = (story: () => ReactNode) => <MemoryRouter initialEntries={["/"]}>{story()}</MemoryRouter>;
|
||||||
|
|
||||||
storiesOf("Tooltip", module)
|
storiesOf("Tooltip", module)
|
||||||
.addDecorator(RoutingDecorator)
|
.addDecorator(RoutingDecorator)
|
||||||
.addDecorator(storyFn => <Wrapper>{storyFn()}</Wrapper>)
|
|
||||||
.add("Default", () => (
|
.add("Default", () => (
|
||||||
<div>
|
<Wrapper>
|
||||||
{positions.map(position => (
|
{positions.map(position => (
|
||||||
<Spacing>
|
<Spacing>
|
||||||
<Tooltip message={message} location={position}>
|
<Tooltip message={message} location={position}>
|
||||||
@@ -57,5 +71,27 @@ storiesOf("Tooltip", module)
|
|||||||
</Tooltip>
|
</Tooltip>
|
||||||
</Spacing>
|
</Spacing>
|
||||||
))}
|
))}
|
||||||
</div>
|
</Wrapper>
|
||||||
|
))
|
||||||
|
.add("Multiline", () => (
|
||||||
|
<Wrapper>
|
||||||
|
{positions.map(position => (
|
||||||
|
<Spacing>
|
||||||
|
<Tooltip message={mutltiline} location={position}>
|
||||||
|
<Button label={position} color="info" />{" "}
|
||||||
|
</Tooltip>
|
||||||
|
</Spacing>
|
||||||
|
))}
|
||||||
|
</Wrapper>
|
||||||
|
))
|
||||||
|
.add("Short Multiline", () => (
|
||||||
|
<Wrapper>
|
||||||
|
{positions.map(position => (
|
||||||
|
<Spacing>
|
||||||
|
<Tooltip message={shortMultiline} location={position}>
|
||||||
|
<Button label={position} color="info" />{" "}
|
||||||
|
</Tooltip>
|
||||||
|
</Spacing>
|
||||||
|
))}
|
||||||
|
</Wrapper>
|
||||||
));
|
));
|
||||||
|
|||||||
Reference in New Issue
Block a user