-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #20 from InseeFr/develop
Develop
- Loading branch information
Showing
9 changed files
with
836 additions
and
221 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,63 +1,21 @@ | ||
// import React from 'react'; | ||
import source from "./source.json"; | ||
import data from "./data.json"; | ||
import { ComponentStory, ComponentMeta } from "@storybook/react"; | ||
import defaultArgTypes from "../utils/default-arg-types"; | ||
import { Dropdown } from "../../"; | ||
import Orchestrator from "../utils/Orchestrator"; | ||
import * as custom from "../../"; | ||
|
||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
const options = source.components[0].options.map((option: any) => ({ | ||
value: option.value, | ||
label: { | ||
props: { | ||
expression: option.label.value, | ||
}, | ||
}, | ||
})); | ||
const stories = { | ||
title: "Components/Dropdown", | ||
component: Dropdown, | ||
component: Orchestrator, | ||
argTypes: defaultArgTypes, | ||
} as ComponentMeta<typeof Dropdown>; | ||
} as ComponentMeta<typeof Orchestrator>; | ||
|
||
export default stories; | ||
|
||
const Template: ComponentStory<typeof Dropdown> = args => ( | ||
<> | ||
<Dropdown | ||
{...args} | ||
options={options} | ||
state="default" | ||
stateRelatedMessage={source.components[0].controls.stateRelatedMessage.default} | ||
/> | ||
</> | ||
); | ||
|
||
const TemplateError: ComponentStory<typeof Dropdown> = args => ( | ||
<> | ||
<Dropdown | ||
{...args} | ||
options={options} | ||
state="error" | ||
stateRelatedMessage={source.components[0].controls.stateRelatedMessage.error} | ||
/> | ||
</> | ||
); | ||
|
||
const TemplateSuccess: ComponentStory<typeof Dropdown> = args => ( | ||
<> | ||
<Dropdown | ||
{...args} | ||
options={options} | ||
state="success" | ||
stateRelatedMessage={source.components[0].controls.stateRelatedMessage.success} | ||
/> | ||
</> | ||
); | ||
const Template: ComponentStory<typeof Orchestrator> = args => <Orchestrator {...args} custom={custom} />; | ||
|
||
export const Default = Template.bind({}); | ||
export const Error = TemplateError.bind({}); | ||
export const Success = TemplateSuccess.bind({}); | ||
|
||
Default.args = {}; | ||
Error.args = {}; | ||
Success.args = {}; | ||
Default.args = { source, data }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.