Skip to content

Commit 7ee008a

Browse files
committed
feat(#178): multiple lines support on @dsvgui/line component
1 parent 9c67dfc commit 7ee008a

File tree

2 files changed

+325
-187
lines changed

2 files changed

+325
-187
lines changed

lib/@dsvgui/components/line/index.stories.tsx

+88-14
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,11 @@ const meta: Meta<typeof Line> = {
55
title: "Line",
66
component: Line,
77
argTypes: {
8-
leftTitle: { control: "text" },
9-
leftSubtitle: { control: "text" },
10-
rightTitle: { control: "text" },
11-
rightSubtitle: { control: "text" },
12-
period: { control: "radio", options: ["month", "weekday", "day", null] },
13-
points: { control: "array" },
14-
lineColor: { control: "color" },
8+
items: {
9+
control: {
10+
type: "object",
11+
},
12+
},
1513
},
1614
};
1715
export default meta;
@@ -28,12 +26,88 @@ const randomPoints = (length: number) => {
2826

2927
export const Base: Story = {
3028
args: {
31-
leftTitle: "Line",
32-
leftSubtitle: "Last 30 Days",
33-
rightTitle: "124 hrs 48 mins",
34-
rightSubtitle: "since last week",
35-
period: "month",
36-
points: randomPoints(3),
37-
lineColor: "#000000",
29+
items: [
30+
{
31+
leftTitle: "Line",
32+
leftSubtitle: "Last 30 Days",
33+
points: randomPoints(10),
34+
},
35+
],
36+
},
37+
};
38+
39+
export const ColoredLines: Story = {
40+
args: {
41+
items: [
42+
{
43+
leftTitle: "Line",
44+
leftSubtitle: "Last 30 Days",
45+
points: randomPoints(10),
46+
lineColor: "#f0000f",
47+
},
48+
],
49+
},
50+
};
51+
52+
export const SecondaryTitle: Story = {
53+
args: {
54+
items: [
55+
{
56+
leftTitle: "Line",
57+
leftSubtitle: "Last 30 Days",
58+
rightTitle: "124 hrs 48 mins",
59+
rightSubtitle: "since last week",
60+
points: randomPoints(10),
61+
lineColor: "#000000",
62+
},
63+
],
64+
},
65+
};
66+
67+
export const PeriodLabels: Story = {
68+
args: {
69+
items: [
70+
{
71+
leftTitle: "Line",
72+
leftSubtitle: "Last 30 Days",
73+
points: randomPoints(10),
74+
lineColor: "#000000",
75+
period: "month",
76+
},
77+
],
78+
},
79+
};
80+
81+
export const MultipleLines: Story = {
82+
args: {
83+
items: [
84+
{
85+
leftTitle: "Line",
86+
leftSubtitle: "Last 30 Days",
87+
rightTitle: "124 hrs",
88+
rightSubtitle: "since last week",
89+
points: randomPoints(10),
90+
lineColor: "#0000ff",
91+
period: "day",
92+
},
93+
{
94+
leftTitle: "Line 2",
95+
leftSubtitle: "Last 90 Days",
96+
rightTitle: "+$1.2k",
97+
rightSubtitle: "since last week",
98+
points: randomPoints(5),
99+
lineColor: "#55f155",
100+
period: "weekday",
101+
},
102+
{
103+
leftTitle: "Line 3",
104+
leftSubtitle: "Last 30 Days",
105+
rightTitle: "-$123",
106+
rightSubtitle: "since last week",
107+
points: randomPoints(15),
108+
lineColor: "#ff3333",
109+
period: "month",
110+
},
111+
],
38112
},
39113
};

0 commit comments

Comments
 (0)