Skip to content

Commit ed478ee

Browse files
authored
Merge pull request #210 from kbss-cvut/react_v18
[#209] React and React DOM upgraded to v18
2 parents 86a275f + 6e72ff8 commit ed478ee

15 files changed

+21052
-40699
lines changed

Diff for: .node-version

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
18

Diff for: .storybook/main.cjs

+4-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@ module.exports = {
44
"@storybook/addon-links",
55
"@storybook/addon-essentials",
66
"@storybook/addon-interactions",
7-
"@luigiminardim/storybook-addon-globals-controls",
87
"@storybook/addon-a11y",
98
],
10-
framework: "@storybook/react",
9+
framework: "@storybook/react-webpack5",
10+
core: {
11+
builder: "@storybook/builder-webpack5",
12+
},
1113
};

Diff for: .storybook/preview.js

+58-22
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import Constants from "../src/constants/Constants";
2-
import { addDecorator } from "@storybook/react";
32
import IntlContextProvider from "../src/contexts/IntlContextProvider";
43
import { FormGenContextProvider } from "../src/contexts/FormGenContext";
54
import { ConfigurationContextProvider } from "../src/contexts/ConfigurationContext";
@@ -24,37 +23,69 @@ export const globalTypes = {
2423
name: "Icon behavior",
2524
description: "Set the behavior for the icons",
2625
defaultValue: Constants.ICON_BEHAVIOR.ON_HOVER,
27-
options: [
28-
Constants.ICON_BEHAVIOR.ON_HOVER,
29-
Constants.ICON_BEHAVIOR.ENABLE,
30-
Constants.ICON_BEHAVIOR.DISABLE,
31-
],
32-
control: { type: "radio" },
26+
toolbar: {
27+
icon: "photo",
28+
items: [
29+
{ value: Constants.ICON_BEHAVIOR.ON_HOVER, title: "onHover" },
30+
{ value: Constants.ICON_BEHAVIOR.ENABLE, title: "Enabled" },
31+
{ value: Constants.ICON_BEHAVIOR.DISABLE, title: "Disabled" },
32+
],
33+
dynamicTitle: true,
34+
},
3335
},
3436
locale: {
35-
name: "Locale",
3637
description: "Internationalization locale",
3738
defaultValue: "en",
38-
options: ["en", "cs"],
39-
control: { type: "radio" },
39+
toolbar: {
40+
icon: "globe",
41+
items: [
42+
{ value: "en", right: "🇺🇸", title: "English" },
43+
{ value: "cs", right: "🇨🇿", title: "Česky" },
44+
],
45+
dynamicTitle: true,
46+
},
4047
},
4148
debugMode: {
4249
name: "Debug Mode",
4350
description: "Show irrelevant questions",
4451
defaultValue: false,
45-
control: { type: "boolean" },
52+
toolbar: {
53+
title: "Debug mode",
54+
icon: "beaker",
55+
items: [
56+
{ value: true, title: "On" },
57+
{ value: false, title: "Off" },
58+
],
59+
},
4660
},
4761
horizontalNavBar: {
4862
name: "Toggle Horizontal Navigation Bar",
4963
description: "Set the navigation bar to horizontal",
5064
defaultValue: false,
51-
control: { type: "boolean" },
65+
toolbar: {
66+
icon: "expandalt",
67+
items: [
68+
{ value: true, title: "On" },
69+
{ value: false, title: "Off" },
70+
],
71+
},
5272
},
5373
timeOut: {
5474
name: "Time Out (ms)",
5575
description: "Set time-out for possible values (in ms)",
5676
defaultValue: 1500,
57-
control: { type: "number", min: 0, max: 10000, step: 500 },
77+
toolbar: {
78+
title: "Time Out (ms)",
79+
icon: "timer",
80+
items: [
81+
{ value: 200, title: "200 ms" },
82+
{ value: 500, title: "500 ms" },
83+
{ value: 1000, title: "1000 ms" },
84+
{ value: 1500, title: "1500 ms" },
85+
{ value: 2000, title: "2000 ms" },
86+
{ value: 2500, title: "2500 ms" },
87+
],
88+
},
5889
},
5990
};
6091

@@ -104,12 +135,17 @@ const fetchTypeAheadValues = () => {
104135
);
105136
};
106137

107-
addDecorator((story) => (
108-
<ConfigurationContextProvider options={options}>
109-
<FormGenContextProvider fetchTypeAheadValues={fetchTypeAheadValues}>
110-
<IntlContextProvider locale={globalTypes.locale.defaultValue}>
111-
{story()}
112-
</IntlContextProvider>
113-
</FormGenContextProvider>
114-
</ConfigurationContextProvider>
115-
));
138+
const preview = {
139+
decorators: [
140+
(Story, context) => (
141+
<ConfigurationContextProvider options={options}>
142+
<FormGenContextProvider fetchTypeAheadValues={fetchTypeAheadValues}>
143+
<IntlContextProvider locale={context.globals.locale}>
144+
<Story />
145+
</IntlContextProvider>
146+
</FormGenContextProvider>
147+
</ConfigurationContextProvider>
148+
),
149+
],
150+
};
151+
export default preview;

0 commit comments

Comments
 (0)