Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Improve switch examples

Benjamin Bädorf623da1588c5d
diff --git a/frontend/src/app/spot/components/switch/stories/Switch.stories.mdx b/frontend/src/app/spot/components/switch/stories/Switch.stories.mdx
index f64d706ab3c..605f9115837 100644
--- a/frontend/src/app/spot/components/switch/stories/Switch.stories.mdx
+++ b/frontend/src/app/spot/components/switch/stories/Switch.stories.mdx
@@ -30,14 +30,61 @@ This component describes only the actual switch, without the label. For the full
The selector field itself only has two states, *enabled* and *disabled*.
-export const Angular = ({ checked, disabled }) => ({
- props: { checked, disabled },
-});
+export const Template = ({ checked, disabled }) => {
+ return {
+ props: { checked, disabled },
+ parameters: {
+ layout: 'centered',
+ },
+ };
+};
<Canvas>
- <Story name="Angular component">
- {Angular.bind({ checked: true, disabled: false })}
+ <Story
+ name="Checked"
+ args={{
+ checked: true,
+ disabled: false,
+ }}
+ >
+ {Template.bind({})}
</Story>
</Canvas>
<ArgsTable of={SpotSwitchComponent} />
+
+<Canvas>
+ <Story
+ name="Unchecked"
+ args={{
+ checked: false,
+ disabled: false,
+ }}
+ >
+ {Template.bind({})}
+ </Story>
+</Canvas>
+
+<Canvas>
+ <Story
+ name="Disabled"
+ args={{
+ checked: false,
+ disabled: true,
+ }}
+ >
+ {Template.bind({})}
+ </Story>
+</Canvas>
+
+<Canvas>
+ <Story
+ name="Disabled checked"
+ args={{
+ checked: true,
+ disabled: true,
+ }}
+ >
+ {Template.bind({})}
+ </Story>
+</Canvas>