Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: migrate stories to use LiveEdit, add TS inner types to those stories #2080

Merged
Merged
Show file tree
Hide file tree
Changes from 33 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
fed340a
feat(withLiveEdit): apply decorators from within self CSF module of a…
YossiSaadi Apr 21, 2024
41eb4b9
feat(withLiveEdit): parse render attribute with ast instead of with r…
YossiSaadi Apr 21, 2024
a43f69f
feat(CanvasWrapper): allow hiding source from Canvas (also for storie…
YossiSaadi Apr 21, 2024
7fa3109
docs(Catalog): align story's TS, hide source code from Canvas
YossiSaadi Apr 21, 2024
0986d68
docs(Catalog): allow LiveEdit
YossiSaadi Apr 21, 2024
17a746b
docs(Button): align story's TS
YossiSaadi Apr 21, 2024
dc6536f
docs(Button): allow LiveEdit
YossiSaadi Apr 21, 2024
8fb1777
feat(withLiveEdit): allow common React hooks to automatically be insi…
YossiSaadi Apr 21, 2024
19b3783
docs(ButtonGroup): align story's TS
YossiSaadi Apr 21, 2024
6512c36
docs(ButtonGroup): allow LiveEdit
YossiSaadi Apr 21, 2024
867ba31
docs(IconButton): align story's TS
YossiSaadi Apr 21, 2024
aab9278
docs(IconButton): allow LiveEdit
YossiSaadi Apr 21, 2024
6c6b98b
docs(MenuButton): align story's TS
YossiSaadi Apr 21, 2024
6956330
docs(MenuButton): allow LiveEdit
YossiSaadi Apr 21, 2024
f82c99e
docs(Checkbox): align story's TS
YossiSaadi Apr 21, 2024
52c2777
docs(MenuButton): allow LiveEdit (excluding one story `SingleCheckbox`)
YossiSaadi Apr 21, 2024
15b96a6
docs(Combobox): allow LiveEdit
YossiSaadi Apr 21, 2024
b2ec928
docs(Dropdown): allow LiveEdit
YossiSaadi Apr 21, 2024
c60e54c
docs(EditableHeading): allow LiveEdit
YossiSaadi Apr 21, 2024
a6efb5e
docs(EditableText): allow LiveEdit
YossiSaadi Apr 21, 2024
4ec8f80
docs: remove name overview
YossiSaadi Apr 21, 2024
ab67b9e
docs(RadioButton): allow LiveEdit
YossiSaadi Apr 21, 2024
b0c70f8
fix(withLiveEdit): user scope should have highest hierarchy
YossiSaadi Apr 21, 2024
f8409c7
docs(Search): allow LiveEdit
YossiSaadi Apr 21, 2024
e71393a
docs(Slider): allow LiveEdit
YossiSaadi Apr 21, 2024
3bf53b9
docs(TextField): align story's TS
YossiSaadi Apr 22, 2024
e4b7eb2
docs(TextField): allow LiveEdit
YossiSaadi Apr 22, 2024
373ef2d
docs(Toggle): align story's TS
YossiSaadi Apr 22, 2024
0cb609e
docs(Toggle): allow LiveEdit
YossiSaadi Apr 22, 2024
9e61494
Merge branch 'master' into docs/yossi/Align-all-TS-stories--allow-Liv…
YossiSaadi Apr 22, 2024
d753be0
docs(BaseInput): align story's TS
YossiSaadi Apr 30, 2024
227facf
docs: retain original name if name is different than Storybook's star…
YossiSaadi Apr 30, 2024
3c73ab8
Merge branch 'master' into docs/yossi/Align-all-TS-stories--allow-Liv…
YossiSaadi Apr 30, 2024
ee689fc
build: lint
YossiSaadi Apr 30, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import { createStoryMetaSettingsDecorator } from "../../../storybook";
import { createComponentTemplate } from "vibe-storybook-components";
import BaseInput from "../BaseInput";
import { Meta, StoryObj } from "@storybook/react";

type Story = StoryObj<typeof BaseInput>;

const metaSettings = createStoryMetaSettingsDecorator({
component: BaseInput
Expand All @@ -12,10 +15,10 @@ export default {
argTypes: metaSettings.argTypes,
decorators: metaSettings.decorators,
tags: ["internal"]
};
} satisfies Meta<typeof BaseInput>;

const baseInputTemplate = createComponentTemplate(BaseInput);

export const Overview = {
export const Overview: Story = {
render: baseInputTemplate.bind({})
};
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Button from "../Button";
import { Canvas, Meta } from "@storybook/blocks";
import { Meta } from "@storybook/blocks";
import {
BUTTON_GROUP,
BADGE,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ import { Add, Calendar, Check, Remove } from "../../Icon/Icons";
import { createStoryMetaSettingsDecorator } from "../../../storybook/functions/createStoryMetaSettingsDecorator";
import Button from "../Button";
import "./button.stories.scss";
import { Meta, StoryObj } from "@storybook/react";

type Story = StoryObj<typeof Button>;

const metaSettings = createStoryMetaSettingsDecorator({
component: Button,
Expand All @@ -17,43 +20,46 @@ export default {
component: Button,
argTypes: metaSettings.argTypes,
decorators: metaSettings.decorators
};
} satisfies Meta<typeof Button>;

const buttonTemplate = createComponentTemplate(Button);

export const Overview = {
export const Overview: Story = {
render: buttonTemplate.bind({}),
name: "Overview",
args: {
children: "Button"
},
parameters: {
docs: {
liveEdit: {
isEnabled: false
}
}
}
};

export const ButtonKinds = {
export const ButtonKinds: Story = {
render: () => (
<>
<Button>Primary</Button>
<Button kind={Button.kinds.SECONDARY}>Secondary</Button>
<Button kind={Button.kinds.TERTIARY}>Tertiary</Button>
</>
),

name: "Button kinds"
};

export const Sizes = {
export const Sizes: Story = {
render: () => (
<>
<Button size={Button.sizes.LARGE}>Large</Button>
<Button size={Button.sizes.MEDIUM}>Medium</Button>
<Button size={Button.sizes.SMALL}>Small</Button>
</>
),

name: "Sizes"
)
};

export const Disabled = {
export const Disabled: Story = {
render: () => (
<>
<Button disabled>Primary</Button>
Expand All @@ -64,45 +70,45 @@ export const Disabled = {
Tertiary
</Button>
</>
),

name: "Disabled"
)
};

export const States = {
export const States: Story = {
render: () => (
<>
<Button>Regular</Button>
<Button active>Active</Button>
</>
),

name: "States"
)
};

export const PositiveAndNegative = {
export const PositiveAndNegative: Story = {
render: () => (
<>
<Button color={Button.colors.POSITIVE}>Positive</Button>
<Button color={Button.colors.NEGATIVE}>Negative</Button>
</>
),

name: "Positive and Negative"
};

export const Icons = {
export const Icons: Story = {
render: () => (
<>
<Button rightIcon={Calendar}>Right icon</Button>
<Button leftIcon={Calendar}>Left icon</Button>
</>
),

name: "Icons"
parameters: {
docs: {
liveEdit: {
scope: { Calendar }
}
}
}
};

export const LoadingState = {
export const LoadingState: Story = {
render: () => {
const [loading, setLoading] = useState(false);
const onClick = useCallback(() => {
Expand All @@ -114,11 +120,10 @@ export const LoadingState = {
</Button>
);
},

name: "Loading state"
};

export const SuccessState = {
export const SuccessState: Story = {
render: () => {
const [success, setSuccess] = useState(false);
const onClick = useCallback(() => {
Expand All @@ -130,11 +135,17 @@ export const SuccessState = {
</Button>
);
},

parameters: {
docs: {
liveEdit: {
scope: { Check }
}
}
},
name: "Success state"
};

export const OnColorStates = {
export const OnColorStates: Story = {
render: () => (
<>
<div style={{ display: "flex", flexDirection: "column" }}>
Expand Down Expand Up @@ -166,11 +177,10 @@ export const OnColorStates = {
</div>
</>
),

name: "On color states"
};

export const AdjacentButtons = {
export const AdjacentButtons: Story = {
render: () => (
<div>
<Button kind={Button.kinds.SECONDARY} size={Button.sizes.SMALL} ariaLabel="decrease zoom level" rightFlat>
Expand All @@ -181,6 +191,12 @@ export const AdjacentButtons = {
</Button>
</div>
),

parameters: {
docs: {
liveEdit: {
scope: { Remove, Add }
}
}
},
name: "Adjacent buttons"
};
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Canvas, Meta } from "@storybook/blocks";
import { Link } from "vibe-storybook-components";
import { Meta } from "@storybook/blocks";
import ButtonGroup from "../ButtonGroup";
import { Mobile } from "../../Icon/Icons";
import { BREADCRUBMS, BUTTON, TABS } from "../../../storybook/components/related-components/component-description-map";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ import ButtonGroup from "../ButtonGroup";
import { createStoryMetaSettingsDecorator } from "../../../storybook";
import { createComponentTemplate } from "vibe-storybook-components";
import "./buttonGroup.stories.scss";
import { Meta, StoryObj } from "@storybook/react";

type Story = StoryObj<typeof ButtonGroup>;

const metaSettings = createStoryMetaSettingsDecorator({
component: ButtonGroup,
Expand All @@ -16,11 +19,10 @@ export default {
component: ButtonGroup,
argTypes: metaSettings.argTypes,
decorators: metaSettings.decorators
};
} satisfies Meta<typeof ButtonGroup>;

export const Overview = {
export const Overview: Story = {
render: buttonGroupTemplate.bind({}),
name: "Overview",

args: {
options: [
Expand All @@ -43,10 +45,17 @@ export const Overview = {
],

value: 1
},
parameters: {
docs: {
liveEdit: {
isEnabled: false
}
}
}
};

export const Default = {
export const Default: Story = {
render: () => (
<ButtonGroup
groupAriaLabel="button group aria label"
Expand All @@ -70,12 +79,10 @@ export const Default = {
}
]}
/>
),

name: "Default"
)
};

export const Tertiary = {
export const Tertiary: Story = {
render: () => (
<ButtonGroup
groupAriaLabel="button group aria label"
Expand All @@ -100,12 +107,10 @@ export const Tertiary = {
}
]}
/>
),

name: "Tertiary"
)
};

export const Disabled = {
export const Disabled: Story = {
render: () => (
<ButtonGroup
disabled
Expand All @@ -129,12 +134,10 @@ export const Disabled = {
}
]}
/>
),

name: "Disabled"
)
};

export const DisabledSingeButton = {
export const DisabledSingeButton: Story = {
render: () => (
<ButtonGroup
groupAriaLabel="button group aria label"
Expand All @@ -160,11 +163,10 @@ export const DisabledSingeButton = {
]}
/>
),

name: "Disabled - Singe Button"
};

export const Size = {
export const Size: Story = {
render: () => (
<>
<div className="monday-storybook-button-group_column">
Expand Down Expand Up @@ -196,12 +198,10 @@ export const Size = {
/>
</div>
</>
),

name: "Size"
)
};

export const ButtonGroupInSettings = {
export const ButtonGroupInSettings: Story = {
render: () => (
<div className="monday-storybook-button-group_column">
Function
Expand Down Expand Up @@ -230,11 +230,10 @@ export const ButtonGroupInSettings = {
/>
</div>
),

name: "Button group in settings"
};

export const ButtonGroupAsToggle = {
export const ButtonGroupAsToggle: Story = {
render: () => (
<ButtonGroup
groupAriaLabel="button group aria label"
Expand All @@ -251,6 +250,5 @@ export const ButtonGroupAsToggle = {
]}
/>
),

name: "Button group as toggle"
};
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Canvas, Meta } from "@storybook/blocks";
import { Meta } from "@storybook/blocks";
import Checkbox from "../Checkbox";
import { createComponentTemplate, Link } from "vibe-storybook-components";
import { createStoryMetaSettingsDecorator } from "../../../storybook";
Expand Down
Loading
Loading