-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathBudgetCard.stories.jsx
More file actions
75 lines (71 loc) · 2.19 KB
/
Copy pathBudgetCard.stories.jsx
File metadata and controls
75 lines (71 loc) · 2.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
import BudgetCard from "./BudgetCard";
export default {
title: "UI/Cards/BudgetCard",
component: BudgetCard,
parameters: {
docs: {
description: {
component:
"CAN-level budget summary card. Displays the remaining available budget with a striped " +
"two-segment bar showing spending vs. remaining. Shows an **Over Budget** warning tag and " +
"switches the bar to red when `totalSpending` exceeds `totalFunding`. Bar is hidden when " +
"both values are `0`. Typically used in a grid alongside other CAN cards."
}
}
},
argTypes: {
title: {
control: "text",
description: "Card heading — typically includes the fiscal year"
},
totalSpending: {
control: { type: "number", min: 0, step: 50_000 },
description: "Sum of all BLs in Planned, Executing, and Obligated status"
},
totalFunding: {
control: { type: "number", min: 0, step: 50_000 },
description: "Total available budget"
},
cardId: {
control: false,
description: "Used for `data-cy` test targeting — not visually relevant"
}
}
};
/**
* Normal state — spending is within budget.
* "Available" tag and striped bar visible.
* Use **Controls** to adjust spending and funding live.
*/
export const Default = {
args: {
cardId: 2025,
title: "FY 2025 CANs Available Budget",
totalSpending: 875_000,
totalFunding: 1_500_000
}
};
/**
* Spending exceeds total funding.
* Bar turns solid red, "Over Budget" warning tag replaces "Available".
*/
export const OverBudget = {
args: {
cardId: 2025,
title: "FY 2025 CANs Available Budget",
totalSpending: 1_750_000,
totalFunding: 1_500_000
}
};
/**
* Both values are zero — bar is hidden, "Available" tag is absent.
* Card still renders the heading and $0 cleanly.
*/
export const ZeroBudget = {
args: {
cardId: 2025,
title: "FY 2025 CANs Available Budget",
totalSpending: 0,
totalFunding: 0
}
};