Skip to content

Commit 2e21c2c

Browse files
committed
chore: add plate & timeAgo stories
1 parent 2fb46e7 commit 2e21c2c

2 files changed

Lines changed: 79 additions & 0 deletions

File tree

stories/plate.story.ts

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import plate from "../src/modules/plate/index";
2+
3+
const Template = (args: any) => ({
4+
components: { plate },
5+
setup() {
6+
return {
7+
val: args.val
8+
};
9+
},
10+
template: `<div><plate :number=val v-slot="{ info, isValid }">
11+
<div>
12+
<h3>plate info:</h3>
13+
<p>type: <b>{{ info.type }}</b></p>
14+
<p>template: <b>{{ info.template }}</b></p>
15+
<p>details: <b>{{ info.details }}</b></p>
16+
<p>province: <b>{{ info.province }}</b></p>
17+
<p>category: <b>{{ info.category }}</b></p>
18+
</div>
19+
<br />
20+
<span>is plate valid: <b>{{ isValid }}</b></span>
21+
</plate></div>`
22+
});
23+
24+
export const Default = Template.bind({});
25+
Default.args = { val: "12D45147" };
26+
27+
export default {
28+
title: "Modules/plate",
29+
component: plate,
30+
argTypes: {
31+
val: {
32+
name: "number",
33+
type: { name: "string", required: true },
34+
defaultValue: null,
35+
description: "plate number",
36+
table: {
37+
type: { summary: "string" },
38+
defaultValue: { summary: "null" }
39+
},
40+
control: {
41+
type: "text"
42+
}
43+
}
44+
}
45+
};

stories/timeAgo.story.ts

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import timeAgo from "../src/modules/timeAgo/index";
2+
3+
const Template = (args: any) => ({
4+
components: { timeAgo },
5+
setup() {
6+
return {
7+
val: args.val
8+
};
9+
},
10+
template: `<div><timeAgo :date=val v-slot="{ time }">{{ time }}</timeAgo></div>`
11+
});
12+
13+
export const Default = Template.bind({});
14+
Default.args = { val: "1400/04/07 18:00:00" };
15+
16+
export default {
17+
title: "Modules/timeAgo",
18+
component: timeAgo,
19+
argTypes: {
20+
val: {
21+
name: "date",
22+
type: { name: "string", required: true },
23+
defaultValue: null,
24+
description: "a date string in yyyy/mm/dd hh:mm:ss format",
25+
table: {
26+
type: { summary: "string" },
27+
defaultValue: { summary: "null" }
28+
},
29+
control: {
30+
type: "text"
31+
}
32+
}
33+
}
34+
};

0 commit comments

Comments
 (0)