Skip to content

Commit 372649b

Browse files
committed
Add storybook for license chart
1 parent e036f94 commit 372649b

File tree

2 files changed

+41
-1
lines changed

2 files changed

+41
-1
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import type { Meta, StoryObj } from "@storybook/react";
2+
import { LicenseSeatConsumptionChart } from "./LicenseSeatConsumptionChart";
3+
4+
const meta: Meta<typeof LicenseSeatConsumptionChart> = {
5+
title:
6+
"pages/DeploymentSettingsPage/LicensesSettingsPage/LicenseSeatConsumptionChart",
7+
component: LicenseSeatConsumptionChart,
8+
args: {
9+
limit: 220,
10+
data: [
11+
{ date: "1/1/2024", users: 150 },
12+
{ date: "1/2/2024", users: 165 },
13+
{ date: "1/3/2024", users: 180 },
14+
{ date: "1/4/2024", users: 155 },
15+
{ date: "1/5/2024", users: 190 },
16+
{ date: "1/6/2024", users: 200 },
17+
{ date: "1/7/2024", users: 210 },
18+
],
19+
},
20+
};
21+
22+
export default meta;
23+
type Story = StoryObj<typeof LicenseSeatConsumptionChart>;
24+
25+
export const Loaded: Story = {};
26+
27+
export const Empty: Story = {
28+
args: {
29+
data: [],
30+
},
31+
};
32+
33+
export const Loading: Story = {
34+
args: {
35+
data: undefined,
36+
},
37+
};

site/src/pages/DeploymentSettingsPage/LicensesSettingsPage/LicenseSeatConsumptionChart.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,8 @@ export const LicenseSeatConsumptionChart: FC<
146146
}
147147
/>
148148
<YAxis
149+
// Adds space on Y to show always show the reference line without overflowing it.
150+
domain={[0, limit ? "dataMax + 10" : "auto"]}
149151
dataKey="users"
150152
tickLine={false}
151153
axisLine={false}
@@ -199,8 +201,9 @@ export const LicenseSeatConsumptionChart: FC<
199201
/>
200202
{limit && (
201203
<ReferenceLine
204+
isFront
202205
ifOverflow="extendDomain"
203-
y={70}
206+
y={limit}
204207
label={{
205208
value: "license seat limit",
206209
position: "insideBottomRight",

0 commit comments

Comments
 (0)