diff --git a/assets/js/components/ChargingPlans/Arrival.vue b/assets/js/components/ChargingPlans/Arrival.vue index 549f9a163..82cfe338e 100644 --- a/assets/js/components/ChargingPlans/Arrival.vue +++ b/assets/js/components/ChargingPlans/Arrival.vue @@ -59,11 +59,13 @@ - diff --git a/assets/js/components/ChargingPlans/ChargingPlan.stories.js b/assets/js/components/ChargingPlans/ChargingPlan.stories.js deleted file mode 100644 index ed5452e8f..000000000 --- a/assets/js/components/ChargingPlans/ChargingPlan.stories.js +++ /dev/null @@ -1,55 +0,0 @@ -import ChargingPlan from "./ChargingPlan.vue"; - -const hoursFromNow = (hours) => { - const now = new Date(); - now.setHours(now.getHours() + hours); - return now.toISOString(); -}; - -export default { - title: "ChargingPlans/ChargingPlan", - component: ChargingPlan, - parameters: { - layout: "centered", - }, - argTypes: { - id: { control: "text" }, - effectivePlanTime: { control: "text" }, - effectivePlanSoc: { control: "number" }, - planEnergy: { control: "number" }, - socBasedCharging: { control: "boolean" }, - socBasedPlanning: { control: "boolean" }, - vehicleSoc: { control: "number" }, - }, -}; - -const Template = (args) => ({ - components: { ChargingPlan }, - setup() { - return { args }; - }, - template: '', -}); - -export const None = Template.bind({}); -None.args = { - id: "1", -}; - -export const SocBasedCharging = Template.bind({}); -SocBasedCharging.args = { - id: "1", - effectivePlanTime: hoursFromNow(4), - effectivePlanSoc: 77, - socBasedCharging: true, - socBasedPlanning: true, -}; - -export const EnergyBasedCharging = Template.bind({}); -EnergyBasedCharging.args = { - id: "1", - effectivePlanTime: hoursFromNow(12), - planEnergy: 77, - socBasedCharging: false, - socBasedPlanning: false, -}; diff --git a/assets/js/components/ChargingPlans/ChargingPlan.stories.ts b/assets/js/components/ChargingPlans/ChargingPlan.stories.ts new file mode 100644 index 000000000..945d57676 --- /dev/null +++ b/assets/js/components/ChargingPlans/ChargingPlan.stories.ts @@ -0,0 +1,56 @@ +import ChargingPlan from "./ChargingPlan.vue"; +import type { Meta, StoryFn } from "@storybook/vue3"; + +const hoursFromNow = (hours: number) => { + const now = new Date(); + now.setHours(now.getHours() + hours); + return now.toISOString(); +}; + +export default { + title: "ChargingPlans/ChargingPlan", + component: ChargingPlan, + parameters: { + layout: "centered", + }, + argTypes: { + id: { control: "text" }, + effectivePlanTime: { control: "text" }, + effectivePlanSoc: { control: "number" }, + planEnergy: { control: "number" }, + socBasedCharging: { control: "boolean" }, + socBasedPlanning: { control: "boolean" }, + vehicleSoc: { control: "number" }, + }, +} as Meta; + +const Template: StoryFn = (args) => ({ + components: { ChargingPlan }, + setup() { + return { args }; + }, + template: '', +}); + +export const None = Template.bind({}); +None.args = { + id: "1", +}; + +export const SocBasedCharging = Template.bind({}); +SocBasedCharging.args = { + id: "1", + effectivePlanTime: hoursFromNow(4), + effectivePlanSoc: 77, + socBasedCharging: true, + socBasedPlanning: true, +}; + +export const EnergyBasedCharging = Template.bind({}); +EnergyBasedCharging.args = { + id: "1", + effectivePlanTime: hoursFromNow(12), + planEnergy: 77, + socBasedCharging: false, + socBasedPlanning: false, +}; diff --git a/assets/js/components/ChargingPlans/ChargingPlan.vue b/assets/js/components/ChargingPlans/ChargingPlan.vue index b6cd3f5f9..579b53eff 100644 --- a/assets/js/components/ChargingPlans/ChargingPlan.vue +++ b/assets/js/components/ChargingPlans/ChargingPlan.vue @@ -102,7 +102,7 @@ -