From 117d9d54e8c29b606e0221d3c59e3fc6c0226d8b Mon Sep 17 00:00:00 2001 From: Frank Waalkens Date: Mon, 11 Sep 2023 10:36:22 +0200 Subject: [PATCH] Experiments with Storybook. --- .../components/boxes/BatteriesOverview/BatteriesOverview.mdx | 4 +++- .../boxes/BatteriesOverview/BatteriesOverview.stories.tsx | 4 ++-- src/app/Marine2/components/boxes/Battery/Battery.mdx | 4 ++++ src/app/Marine2/components/boxes/Battery/Battery.tsx | 1 - src/app/Marine2/components/boxes/Charger/Charger.tsx | 4 ---- src/app/Marine2/components/boxes/EnergyAC/EnergyAC.tsx | 1 + 6 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/app/Marine2/components/boxes/BatteriesOverview/BatteriesOverview.mdx b/src/app/Marine2/components/boxes/BatteriesOverview/BatteriesOverview.mdx index 082b04b87..9c7ead7bb 100644 --- a/src/app/Marine2/components/boxes/BatteriesOverview/BatteriesOverview.mdx +++ b/src/app/Marine2/components/boxes/BatteriesOverview/BatteriesOverview.mdx @@ -5,4 +5,6 @@ import { Meta, Title } from "@storybook/blocks"; -## This component is not **__"Storybook-ready"__** +## Overview of multiple battery components ## +<br /> +> __Data:__ static diff --git a/src/app/Marine2/components/boxes/BatteriesOverview/BatteriesOverview.stories.tsx b/src/app/Marine2/components/boxes/BatteriesOverview/BatteriesOverview.stories.tsx index e588bf154..95c785fe0 100644 --- a/src/app/Marine2/components/boxes/BatteriesOverview/BatteriesOverview.stories.tsx +++ b/src/app/Marine2/components/boxes/BatteriesOverview/BatteriesOverview.stories.tsx @@ -7,8 +7,8 @@ const meta: Meta<typeof BatteriesOverview> = { component: BatteriesOverview, decorators: [ (Story) => ( - <MainLayout title="FAKE TITLE MAIN LAYOUT"> - <Story /> + <MainLayout title="Storybook"> + <Story globals={Story}/> </MainLayout> ) ] diff --git a/src/app/Marine2/components/boxes/Battery/Battery.mdx b/src/app/Marine2/components/boxes/Battery/Battery.mdx index 0c5f0a72e..8e75ba9e3 100644 --- a/src/app/Marine2/components/boxes/Battery/Battery.mdx +++ b/src/app/Marine2/components/boxes/Battery/Battery.mdx @@ -6,3 +6,7 @@ import { Meta, Title } from "@storybook/blocks"; <Title /> ## Displays a Battery box + +<br /> + +> __Data:__ static diff --git a/src/app/Marine2/components/boxes/Battery/Battery.tsx b/src/app/Marine2/components/boxes/Battery/Battery.tsx index 9c3c7d610..f54782c3d 100644 --- a/src/app/Marine2/components/boxes/Battery/Battery.tsx +++ b/src/app/Marine2/components/boxes/Battery/Battery.tsx @@ -58,7 +58,6 @@ const Battery = ({ battery }: Props) => { const [boxSize, setBoxSize] = useState<{ width: number; height: number }>({ width: 0, height: 0 }) - const isSimpleBattery = !(state || state === 0) if (isSimpleBattery) { diff --git a/src/app/Marine2/components/boxes/Charger/Charger.tsx b/src/app/Marine2/components/boxes/Charger/Charger.tsx index 652f4a1ed..51e474610 100644 --- a/src/app/Marine2/components/boxes/Charger/Charger.tsx +++ b/src/app/Marine2/components/boxes/Charger/Charger.tsx @@ -16,7 +16,6 @@ import RadioButton from "../../ui/RadioButton" import DeviceSettingModal from "../../ui/DeviceSettingModal/DeviceSettingModal" import ValueOverview from "../../ui/ValueOverview" -/** Component niet Storybook ready */ const Charger = ({ instanceId, componentMode = "compact", compactBoxSize }: Props) => { const chargerModeFormatter = (value: number) => { switch (value) { @@ -59,9 +58,6 @@ const Charger = ({ instanceId, componentMode = "compact", compactBoxSize }: Prop setModeForSubmission(Number(mode)) }, [mode]) - - console.log('Hallo Charger!', mode, currentLimit, instanceId) - const closeModeModal = () => { setIsModeModalOpen(false) setModeForSubmission(Number(mode)) diff --git a/src/app/Marine2/components/boxes/EnergyAC/EnergyAC.tsx b/src/app/Marine2/components/boxes/EnergyAC/EnergyAC.tsx index 984fc4c81..674fbee1a 100644 --- a/src/app/Marine2/components/boxes/EnergyAC/EnergyAC.tsx +++ b/src/app/Marine2/components/boxes/EnergyAC/EnergyAC.tsx @@ -6,6 +6,7 @@ import ValueBox from "../../ui/ValueBox" import ValueOverview from "../../ui/ValueOverview" const EnergyAC = ({ mode = "compact", acLoads, compactBoxSize }: Props) => { + const { current, power, phases, voltage } = acLoads const totalPower = power.reduce((total, power) => (power ? total + power : total))