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

[#209] React and React DOM upgraded to v18 #210

Merged
merged 7 commits into from
Jul 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions .node-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
18
6 changes: 4 additions & 2 deletions .storybook/main.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ module.exports = {
"@storybook/addon-links",
"@storybook/addon-essentials",
"@storybook/addon-interactions",
"@luigiminardim/storybook-addon-globals-controls",
"@storybook/addon-a11y",
],
framework: "@storybook/react",
framework: "@storybook/react-webpack5",
core: {
builder: "@storybook/builder-webpack5",
},
};
80 changes: 58 additions & 22 deletions .storybook/preview.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import Constants from "../src/constants/Constants";
import { addDecorator } from "@storybook/react";
import IntlContextProvider from "../src/contexts/IntlContextProvider";
import { FormGenContextProvider } from "../src/contexts/FormGenContext";
import { ConfigurationContextProvider } from "../src/contexts/ConfigurationContext";
Expand All @@ -24,37 +23,69 @@ export const globalTypes = {
name: "Icon behavior",
description: "Set the behavior for the icons",
defaultValue: Constants.ICON_BEHAVIOR.ON_HOVER,
options: [
Constants.ICON_BEHAVIOR.ON_HOVER,
Constants.ICON_BEHAVIOR.ENABLE,
Constants.ICON_BEHAVIOR.DISABLE,
],
control: { type: "radio" },
toolbar: {
icon: "photo",
items: [
{ value: Constants.ICON_BEHAVIOR.ON_HOVER, title: "onHover" },
{ value: Constants.ICON_BEHAVIOR.ENABLE, title: "Enabled" },
{ value: Constants.ICON_BEHAVIOR.DISABLE, title: "Disabled" },
],
dynamicTitle: true,
},
},
locale: {
name: "Locale",
description: "Internationalization locale",
defaultValue: "en",
options: ["en", "cs"],
control: { type: "radio" },
toolbar: {
icon: "globe",
items: [
{ value: "en", right: "🇺🇸", title: "English" },
{ value: "cs", right: "🇨🇿", title: "Česky" },
],
dynamicTitle: true,
},
},
debugMode: {
name: "Debug Mode",
description: "Show irrelevant questions",
defaultValue: false,
control: { type: "boolean" },
toolbar: {
title: "Debug mode",
icon: "beaker",
items: [
{ value: true, title: "On" },
{ value: false, title: "Off" },
],
},
},
horizontalNavBar: {
name: "Toggle Horizontal Navigation Bar",
description: "Set the navigation bar to horizontal",
defaultValue: false,
control: { type: "boolean" },
toolbar: {
icon: "expandalt",
items: [
{ value: true, title: "On" },
{ value: false, title: "Off" },
],
},
},
timeOut: {
name: "Time Out (ms)",
description: "Set time-out for possible values (in ms)",
defaultValue: 1500,
control: { type: "number", min: 0, max: 10000, step: 500 },
toolbar: {
title: "Time Out (ms)",
icon: "timer",
items: [
{ value: 200, title: "200 ms" },
{ value: 500, title: "500 ms" },
{ value: 1000, title: "1000 ms" },
{ value: 1500, title: "1500 ms" },
{ value: 2000, title: "2000 ms" },
{ value: 2500, title: "2500 ms" },
],
},
},
};

Expand Down Expand Up @@ -104,12 +135,17 @@ const fetchTypeAheadValues = () => {
);
};

addDecorator((story) => (
<ConfigurationContextProvider options={options}>
<FormGenContextProvider fetchTypeAheadValues={fetchTypeAheadValues}>
<IntlContextProvider locale={globalTypes.locale.defaultValue}>
{story()}
</IntlContextProvider>
</FormGenContextProvider>
</ConfigurationContextProvider>
));
const preview = {
decorators: [
(Story, context) => (
<ConfigurationContextProvider options={options}>
<FormGenContextProvider fetchTypeAheadValues={fetchTypeAheadValues}>
<IntlContextProvider locale={context.globals.locale}>
<Story />
</IntlContextProvider>
</FormGenContextProvider>
</ConfigurationContextProvider>
),
],
};
export default preview;
Loading