Skip to content

Commit 4042db2

Browse files
authored
Merge pull request #19 from silinternational/feature/progress-story
Progress story
2 parents a7a45a5 + 358dc19 commit 4042db2

File tree

6 files changed

+57
-3
lines changed

6 files changed

+57
-3
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1111
### Added
1212
- actions, isAboveMobile, isAboveTablet, setNotice to index.js so they can be imported directly
1313
- $$props.class to Fab, TextArea, Select, Checkbox and List so they can accept global classes
14+
- barColorProvided to Progress.Linear to allow bypass of bar-color class when no color is provided
1415
- README: Theming, Drawer example and Storybook url.
1516
- Storybook for showcasing components at https://silinternational.github.io/ui-components/
1617

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ List (twoLine, avatar) [
6969
]
7070

7171
Progress [
72-
Progress.Circular, Progress.Linear (indeterminate, value)
72+
Progress.Circular, Progress.Linear (indeterminate, value, barColorProvided)
7373
]
7474

7575
Select (options, width, disabled, selectedID)

components/mdc/Progress/Linear.svelte

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { onMount } from 'svelte'
55
66
export let indeterminate = false
77
export let value = 0
8+
export let barColorProvided = true
89
910
let element = {}
1011
let mdcProgress
@@ -24,7 +25,7 @@ onMount(() => {
2425
<div class="mdc-linear-progress__buffer-bar"></div>
2526
<div class="mdc-linear-progress__buffer-dots"></div>
2627
</div>
27-
<div class="mdc-linear-progress__bar mdc-linear-progress__primary-bar bar-color">
28+
<div class="mdc-linear-progress__bar mdc-linear-progress__primary-bar" class:bar-color={barColorProvided}>
2829
<span class="mdc-linear-progress__bar-inner"></span>
2930
</div>
3031
<div class="mdc-linear-progress__bar mdc-linear-progress__secondary-bar">

components/mdc/Progress/_index.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44
@include linear-progress.core-styles;
55

66
.bar-color {
7-
@include linear-progress.bar-color(var(--sil-primary-blue));
7+
@include linear-progress.bar-color(var(--sil-primary-blue)); //TODO change variable name to something more generic, fallback to primary theme color?
88
}

stories/Circular.stories.svelte

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<script>
2+
import { Meta, Template, Story } from "@storybook/addon-svelte-csf"
3+
import { Progress } from "../components/mdc"
4+
5+
const args = {
6+
class: '', //only works for global classes
7+
}
8+
</script>
9+
10+
<Meta
11+
title="Atoms/Progress.Circular"
12+
component={Progress.Circular}
13+
/>
14+
15+
<Template let:args>
16+
<Progress.Circular {...args}/>
17+
</Template>
18+
19+
<Story
20+
name="Default"
21+
{args}
22+
/>

stories/Linear.stories.svelte

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<script>
2+
import { Meta, Template, Story } from "@storybook/addon-svelte-csf"
3+
import { Progress } from "../components/mdc"
4+
import { copyAndModifyArgs } from "./helpers.js"
5+
6+
const args = {
7+
class: '', //only works for global classes
8+
value: .5,
9+
barColorProvided: false
10+
}
11+
</script>
12+
13+
<Meta
14+
title="Atoms/Progress.Linear"
15+
component={Progress.Linear}
16+
/>
17+
18+
<Template let:args>
19+
<Progress.Linear {...args}/>
20+
</Template>
21+
22+
<Story
23+
name="Determinate"
24+
{args}
25+
/>
26+
27+
<Story
28+
name="Indeterminate"
29+
args={copyAndModifyArgs(args, {indeterminate: true})}
30+
/>

0 commit comments

Comments
 (0)