Skip to content

Commit 522b11f

Browse files
authored
Merge pull request #23 from silinternational/feature/Tooltip-story
Tooltip story
2 parents 91ad543 + 6989aba commit 522b11f

File tree

3 files changed

+37
-2
lines changed

3 files changed

+37
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1010

1111
### Added
1212
- actions, isAboveMobile, isAboveTablet, setNotice to index.js so they can be imported directly
13-
- $$props.class to Fab, TextArea, Select, Checkbox, Datatable, Dialog.Simple, Dialog.Alert and List so they can accept global classes
13+
- $$props.class to Fab, TextArea, Select, Checkbox, Datatable, Dialog.Simple, Dialog.Alert, Tooltip and List so they can accept global classes
1414
- barColorProvided to Progress.Linear to allow bypass of bar-color class when no color is provided
1515
- bgColorIsVariant to TopAppBar to allow bypass of bg-color-variant if no color is provided
1616
- README: Theming, Drawer example, CSS utility classes and Storybook url.

components/mdc/Tooltip/Tooltip.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
</script>
3434

3535
<div bind:this={element} id={tooltipID} class="mdc-tooltip" role="tooltip" aria-hidden="true">
36-
<div class="mdc-tooltip__surface">
36+
<div class="mdc-tooltip__surface {$$props.class}">
3737
<slot></slot>
3838
</div>
3939
</div>

stories/Tooltip.stories.svelte

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<script>
2+
import { Meta, Template, Story } from "@storybook/addon-svelte-csf"
3+
import { Tooltip } from "../components/mdc"
4+
import { copyAndModifyArgs } from "./helpers.js"
5+
6+
const args = {
7+
tooltipID: '1',
8+
class: '', //only works for global classes
9+
}
10+
</script>
11+
12+
<Meta
13+
title="Atoms/Tooltip"
14+
component={Tooltip}
15+
/>
16+
17+
<Template let:args>
18+
<div class="flex justify-center my-4">
19+
<Tooltip.Wrapper ariaDescribedBy={args.tooltipID}>wrapper slot</Tooltip.Wrapper>
20+
</div>
21+
22+
<Tooltip {...args}>Tooltip main slot here</Tooltip>
23+
</Template>
24+
25+
<Story
26+
name="Default"
27+
{args}
28+
/>
29+
30+
<Story
31+
name="Position"
32+
args={
33+
copyAndModifyArgs(args, {positionX: 'start', positionY: 'above'})
34+
}
35+
/>

0 commit comments

Comments
 (0)