Skip to content

Commit ed0ca44

Browse files
author
Andre Asselin
committed
Add FoProgress component
1 parent c07f84d commit ed0ca44

File tree

10 files changed

+233
-22
lines changed

10 files changed

+233
-22
lines changed

components/FoProgress.vue

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
<template>
2+
<!--
3+
Copyright (c) 2016-2017 PointSource, LLC.
4+
MIT Licensed
5+
-->
6+
7+
<div class="progress" role="progressbar"
8+
:aria-valuenow="ariaValuenow"
9+
:aria-valuemin="ariaValuemin"
10+
:aria-valuetext="ariaValuetext"
11+
:aria-valuemax="ariaValuemax">
12+
<div class="progress-meter" :style="{width: value / (max-min) * 100 + '%'}">
13+
<p class="progress-meter-text"><slot></slot></p>
14+
</div>
15+
</div>
16+
</template>
17+
18+
<script>
19+
export default {
20+
name: 'fo-progress',
21+
22+
props: {
23+
value: {
24+
type: [String, Number],
25+
required: true
26+
},
27+
min: {
28+
type: [String, Number],
29+
default: 0
30+
},
31+
max: {
32+
type: [String, Number],
33+
default: 100
34+
},
35+
ariaValuenow: {
36+
type: String,
37+
default: function() {
38+
return String(this.value);
39+
}
40+
},
41+
ariaValuemin: {
42+
type: String,
43+
default: function() {
44+
return String(this.min);
45+
}
46+
},
47+
ariaValuemax: {
48+
type: String,
49+
default: function() {
50+
return String(this.max);
51+
}
52+
},
53+
ariaValuetext: {
54+
type: String
55+
}
56+
}
57+
}
58+
</script>

doc/config/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ module.exports = {
55
build: {
66
env: require('./prod.env'),
77
index: path.resolve(__dirname, '../dist/index.html'),
8-
assetsRoot: path.resolve(__dirname, '../dist'),
8+
assetsRoot: path.resolve(__dirname, '../../docs'),
99
assetsSubDirectory: 'static',
1010
assetsPublicPath: '',
1111
productionSourceMap: false,

doc/src/componentList.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import buttonGroup from './buttonGroup';
99
import offCanvas from './offCanvas';
1010
import titleBar from './titleBar';
1111
import topBar from './topBar';
12+
import progress from './progress';
1213

1314
export default [
1415
{
@@ -67,4 +68,12 @@ export default [
6768
content: topBar
6869
}
6970
},
71+
{
72+
name: 'progress',
73+
displayName: 'Progress Bar',
74+
path: '/progress',
75+
components: {
76+
content: progress
77+
}
78+
},
7079
];

doc/src/progress.vue

Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
<template lang="md">
2+
3+
<div class="markdown-body">
4+
5+
# Progress Bar
6+
7+
Show your progress. A simple way to add progress bars to your layouts.
8+
9+
## Basics
10+
11+
Use the `<fo-progress>` component to display a progress bar.
12+
13+
```html
14+
<fo-progress tabindex="0" value="0">
15+
</fo-progress>
16+
```
17+
18+
</div>
19+
<div class="example">
20+
21+
<fo-progress tabindex="0" value="0">
22+
</fo-progress>
23+
24+
</div>
25+
<div class="markdown-body">
26+
27+
Add a `value` prop to the component to fill the progress bar.
28+
29+
```html
30+
<fo-progress tabindex="0" value="50" aria-valuetext="50 percent">
31+
</fo-progress>
32+
```
33+
34+
</div>
35+
<div class="example">
36+
37+
<fo-progress tabindex="0" value="50" aria-valuetext="50 percent">
38+
</fo-progress>
39+
40+
</div>
41+
<div class="markdown-body">
42+
43+
---
44+
45+
## Colors
46+
47+
A progress bar can be styled with the `.secondary`, `.success`, `.warning`, and `.alert` colors.
48+
49+
```html
50+
<fo-progress class="secondary" tabindex="0" value="25" aria-valuetext="25 percent">
51+
</fo-progress>
52+
53+
<fo-progress class="success" value="50">
54+
</fo-progress>
55+
56+
<fo-progress class="warning" value="50">
57+
</fo-progress>
58+
59+
<fo-progress class="alert" value="75">
60+
</fo-progress>
61+
```
62+
63+
</div>
64+
<div class="example">
65+
66+
<fo-progress class="secondary" tabindex="0" value="25" aria-valuetext="25 percent">
67+
</fo-progress>
68+
69+
<fo-progress class="success" value="50">
70+
</fo-progress>
71+
72+
<fo-progress class="warning" value="50">
73+
</fo-progress>
74+
75+
<fo-progress class="alert" value="75">
76+
</fo-progress>
77+
78+
</div>
79+
<div class="markdown-body">
80+
81+
---
82+
83+
## With Text
84+
85+
You can add text inside the meter of a progress bar. You can specify alternative text for a screen reader using the `aria-valuetext` prop.
86+
87+
```html
88+
<fo-progress tabindex="0" value="25" aria-valuetext="25 percent">
89+
25%
90+
</fo-progress>
91+
```
92+
93+
</div>
94+
<div class="example">
95+
96+
<fo-progress tabindex="0" value="25" aria-valuetext="25 percent">
97+
25%
98+
</fo-progress>
99+
100+
</div>
101+
<div class="markdown-body">
102+
103+
## Sass Reference
104+
105+
See the [Foundation documentation](http://foundation.zurb.com/sites/docs/progress-bar.html#sass-reference) for a complete reference to the Sass variables and mixins available to customize this component.
106+
107+
## Component Reference
108+
109+
### \<fo-progress>
110+
111+
#### Props
112+
113+
|Property|Type|Required|Description
114+
|---|---|---|---
115+
|value|String \| Number|Yes|The current value of the progress meter. Will fill in the appropriate percentage of the meter based on the `min` and `max` values.
116+
|min|String \| Number|No|The minimum value of the progress meter. Defaults to 0.
117+
|max|String \| Number|No|The maximum value of the progress meter. Defaults to 100.
118+
|aria-valuenow|String|No|Value to use for the `aria-valuenow` attribute. Defaults to `value`.
119+
|aria-valuemin|String|No|Value to use for the `aria-valuemin` attribute. Defaults to `min`.
120+
|aria-valuemax|String|No|Value to use for the `aria-valuemax` attribute. Defaults to `max`.
121+
|aria-valuetext|String|No|Value to use for the `aria-valuetext` attribute, which should include a human-readable version of the bar's value. If not present, the attribute will not be present in the DOM.
122+
123+
#### Events
124+
125+
This component does not emit any events.
126+
127+
#### Slots
128+
129+
|Slot|Required|Description
130+
|---|---|---
131+
default|No|The text to display inside the progress meter.
132+
133+
</div>
134+
135+
</template>
136+
137+
<script>
138+
import FoProgress from 'focomponents/FoProgress';
139+
140+
module.exports = {
141+
components: {
142+
FoProgress
143+
}
144+
}
145+
</script>

docs/static/js/app.046b76c3a42df1543f3e.js

Lines changed: 18 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/static/js/app.57f7946c3bca732a3f6b.js

Lines changed: 0 additions & 18 deletions
This file was deleted.

docs/static/js/manifest.482a09a044f010d6d7e1.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/static/js/manifest.4ac15701bfb6c646bbdf.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

docs/static/js/manifest.e56e56e7b54e48e3e4fe.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vue2-foundation",
3-
"version": "1.0.0",
3+
"version": "1.1.0",
44
"description": "Vue 2.x component wrappers for Foundation 6 widgets",
55
"copyright": "Copyright (c) 2016-2017 PointSource LLC. All rights reserved.",
66
"license": "MIT",

0 commit comments

Comments
 (0)