Skip to content

Commit 056c92f

Browse files
committed
Add documentation
1 parent 19a90ef commit 056c92f

File tree

4 files changed

+306
-13
lines changed

4 files changed

+306
-13
lines changed

README.md

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,17 @@
33
## Introduction
44
A simple timeline component similar to [Ant Timeline](https://www.antdv.com/components/timeline/) based on [Bootstrap-Vue](https://bootstrap-vue.org/).
55

6-
**Note**: This component assumes you use [Bootstrap-Vue (v4)](https://bootstrap-vue.org/) in your project and have installed [the dependencies](https://bootstrap-vue.org/docs).
7-
86
## Demo
97

108
Link: TBD
119

10+
## Dependencies
11+
12+
13+
* [Vue.js 2.6+](https://vuejs.org/2016/04/27/announcing-2.0/)
14+
* [Bootstrap-Vue (v2.21.2+)](https://bootstrap-vue.org/)
15+
* [Other Bootstrap-Vue dependencies](https://bootstrap-vue.org/docs).
16+
1217
## Installation
1318

1419
```bash
@@ -83,14 +88,22 @@ export default Vue.extend({
8388
- [x] Support item head color variants
8489
- [ ] Support custom icons
8590
- [ ] Refactor timeline and item into separate components
91+
- [ ] Emit events
8692

8793
## Component Reference
88-
### Properties
89-
TBD
94+
### Props
95+
96+
| Name | Type | Description |
97+
| ------------- | --------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
98+
| `items` | `Array` | A list of timeline items to display. Supported keys include: `timestamp`, `title`, `content`. |
99+
| `reverse` | `Boolean` | The component displays a vertical timeline in the order of the `items` prop. If `reserve` is set to false, it displays items in reverse order.<br/> Default: false. |
100+
| `loading` | `Boolean` | If true, display a loading spinner in the last item. |
101+
| `date-format` | `String` | Controls the date format in the tooltip when you hover the human friendly time. Default: 'yyyy-MM-dd HH:mm:ss' |
102+
| `variant` | `String` | Color variant. It supports [Bootstrap color variants](https://bootstrap-vue.org/docs/reference/color-variants#color-variants-and-css-class-mapping), including 'primary', 'success'. Default: 'primary' |
90103
### Slots
91-
TBD
104+
N/A
92105
### Events
93-
TBD
106+
N/A
94107

95108
## Development
96109

@@ -114,6 +127,11 @@ yarn serve
114127
yarn lint
115128
```
116129

130+
**Generate component documentation**:
131+
```bash
132+
yarn doc src/bootstrap-vue-timeline.vue
133+
```
134+
117135
## License
118136

119137
Released under the MIT [License](./LICENSE). Copyright (c) Bootstrap-vue-timeline.

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818
"build:es": "cross-env NODE_ENV=production rollup --config build/rollup.config.js --format es",
1919
"build:unpkg": "cross-env NODE_ENV=production rollup --config build/rollup.config.js --format iife",
2020
"lint": "vue-cli-service lint --fix && standard --fix",
21-
"test": "jest"
21+
"test": "jest",
22+
"doc": "vuedoc.md"
2223
},
2324
"dependencies": {
2425
"bootstrap-vue": "^2.21.2",
@@ -38,6 +39,8 @@
3839
"@vue/cli-plugin-unit-jest": "^4.5.13",
3940
"@vue/cli-service": "^4.5.10",
4041
"@vue/test-utils": "^1.2.0",
42+
"@vuedoc/md": "^3.2.0",
43+
"@vuedoc/parser": "^3.3.0",
4144
"cross-env": "^7.0.3",
4245
"eslint": "^6.7.2",
4346
"eslint-plugin-vue": "^6.2.2",

src/bootstrap-vue-timeline.vue

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,30 @@ Vue.component('b-spinner', BSpinner)
1111
export default /*#__PURE__*/{
1212
name: 'BootstrapVueTimeline',
1313
props: {
14+
/**
15+
* A list of timeline items to display. Supported keys include: `timestamp`, `title`, `content`.
16+
*/
1417
items: Array,
18+
/**
19+
* The component displays a vertical timeline in the order of the `items` prop.
20+
* If `reserve` is set to false, it displays items in reverse order.
21+
*
22+
* Default: false.
23+
*/
1524
reverse: Boolean,
25+
/**
26+
* If true, display a loading spinner in the last item.
27+
*/
1628
loading: Boolean,
29+
/**
30+
* Controls the date format in the tooltip when you hover the human friendly time.
31+
* Default: 'yyyy-MM-dd HH:mm:ss'
32+
*/
1733
dateFormat: String,
34+
/**
35+
* Color variant. It supports [Bootstrap color variants](https://bootstrap-vue.org/docs/reference/color-variants#color-variants-and-css-class-mapping), including 'primary', 'success'.
36+
* Default: 'primary'
37+
*/
1838
variant: String,
1939
},
2040
methods: {

0 commit comments

Comments
 (0)