import BatteryBoostButton from "./BatteryBoostButton.vue"; import { CHARGE_MODE } from "@/types/evcc"; import type { Meta, StoryFn } from "@storybook/vue3"; export default { title: "Loadpoints/BatteryBoostButton", component: BatteryBoostButton, argTypes: { batteryBoost: { control: "boolean" }, batteryBoostLimit: { control: { type: "range", min: 0, max: 100, step: 5 } }, batterySoc: { control: { type: "range", min: 0, max: 100, step: 5 } }, mode: { control: "select", options: Object.values(CHARGE_MODE) }, }, parameters: { layout: "centered", }, } as Meta; const socLevels = [0, 20, 40, 60, 80, 100]; interface RowConfig { label: string; batteryBoost: boolean; batteryBoostLimit: number; mode: CHARGE_MODE; } const rows: RowConfig[] = [ { label: "Ready (limit 0)", batteryBoost: false, batteryBoostLimit: 0, mode: CHARGE_MODE.PV }, { label: "Enabled (limit 0)", batteryBoost: true, batteryBoostLimit: 0, mode: CHARGE_MODE.PV }, { label: "Ready (limit 50)", batteryBoost: false, batteryBoostLimit: 50, mode: CHARGE_MODE.PV }, { label: "Enabled (limit 50)", batteryBoost: true, batteryBoostLimit: 50, mode: CHARGE_MODE.PV }, { label: "Disabled", batteryBoost: false, batteryBoostLimit: 50, mode: CHARGE_MODE.OFF }, ]; export const AllStates: StoryFn = () => ({ components: { BatteryBoostButton }, setup() { return { socLevels, rows }; }, template: `
{{ soc }}%
`, }); AllStates.storyName = "All States (grid overview)"; const Template: StoryFn = (args) => ({ components: { BatteryBoostButton }, setup() { return { args }; }, template: '', }); export const Playground = Template.bind({}); Playground.args = { batteryBoost: false, batteryBoostLimit: 50, batterySoc: 75, mode: CHARGE_MODE.PV, };