summaryrefslogtreecommitdiffstats
path: root/uidev
diff options
context:
space:
mode:
authorLibravatar Markus Hatvan <markus_hatvan@aon.at>2021-07-30 10:54:54 +0200
committerLibravatar GitHub <noreply@github.com>2021-07-30 14:24:54 +0530
commitf4b4416ea52d564bc2dbe543a82084ed98843ccc (patch)
tree7ca6b23571c86458a6b799746c91a7191de02715 /uidev
parent5.6.1-nightly.8 [skip ci] (diff)
downloadferdium-app-f4b4416ea52d564bc2dbe543a82084ed98843ccc.tar.gz
ferdium-app-f4b4416ea52d564bc2dbe543a82084ed98843ccc.tar.zst
ferdium-app-f4b4416ea52d564bc2dbe543a82084ed98843ccc.zip
chore: migrate from tslint to @typescript-eslint (#1706)
- update .eslintrc to work for .js and .ts - update devDependencies - lint properly both root /src and nested /packages - update webhint recommended setting for tsconfig.json to shrink output - Manage all eslint rules from the repo root - escape single quotes in scripts to please windows build Co-authored-by: Vijay A <avijayr@protonmail.com>
Diffstat (limited to 'uidev')
-rw-r--r--uidev/src/app.tsx2
-rw-r--r--uidev/src/stores/stories.ts2
-rw-r--r--uidev/src/stories/button.stories.tsx72
-rw-r--r--uidev/src/stories/headline.stories.tsx3
-rw-r--r--uidev/src/stories/infobox.stories.tsx10
-rw-r--r--uidev/src/stories/input.stories.tsx4
-rw-r--r--uidev/src/stories/loader.stories.tsx3
-rw-r--r--uidev/src/stories/select.stories.tsx2
-rw-r--r--uidev/src/stories/textarea.stories.tsx2
-rw-r--r--uidev/src/stories/toggle.stories.tsx19
-rw-r--r--uidev/src/withTheme/index.tsx16
-rw-r--r--uidev/tslint.json3
12 files changed, 67 insertions, 71 deletions
diff --git a/uidev/src/app.tsx b/uidev/src/app.tsx
index 41930e805..ecc7020c1 100644
--- a/uidev/src/app.tsx
+++ b/uidev/src/app.tsx
@@ -5,6 +5,7 @@ import DevTools from 'mobx-react-devtools';
5import React from 'react'; 5import React from 'react';
6import injectSheet from 'react-jss'; 6import injectSheet from 'react-jss';
7 7
8import { theme, ThemeType } from '@meetfranz/theme';
8import { WithTheme } from './withTheme'; 9import { WithTheme } from './withTheme';
9 10
10import './stories/badge.stories'; 11import './stories/badge.stories';
@@ -20,7 +21,6 @@ import './stories/toggle.stories';
20 21
21import { store } from './stores'; 22import { store } from './stores';
22 23
23import { theme, ThemeType } from '@meetfranz/theme';
24const defaultTheme = theme(ThemeType.default); 24const defaultTheme = theme(ThemeType.default);
25 25
26const styles = { 26const styles = {
diff --git a/uidev/src/stores/stories.ts b/uidev/src/stores/stories.ts
index 6a98c9fd3..12bacdd59 100644
--- a/uidev/src/stores/stories.ts
+++ b/uidev/src/stores/stories.ts
@@ -1,5 +1,3 @@
1import { store } from './index';
2
3export type StorySectionName = string; 1export type StorySectionName = string;
4export type StoryName = string; 2export type StoryName = string;
5export type StoryComponent = () => JSX.Element; 3export type StoryComponent = () => JSX.Element;
diff --git a/uidev/src/stories/button.stories.tsx b/uidev/src/stories/button.stories.tsx
index 5c1c9246d..5ca657238 100644
--- a/uidev/src/stories/button.stories.tsx
+++ b/uidev/src/stories/button.stories.tsx
@@ -27,20 +27,18 @@ const styles = {
27 }, 27 },
28}; 28};
29 29
30const createStore = (args?: any) => { 30const createStore = (args?: any) => observable({ ...defaultProps, ...args });
31 return observable(Object.assign({}, defaultProps, args));
32};
33 31
34const WithStoreButton = observer(({ store }: { store: any }) => ( 32const WithStoreButton = observer(({ store }: { store: any }) => (
35 <> 33 <>
36 <Button 34 <Button
37 {...Object.assign({}, defaultProps, store)} 35 {...({ ...defaultProps, ...store })}
38 onClick={!store.onClick ? () => { 36 onClick={!store.onClick ? () => {
39 store.busy = !store.busy; 37 store.busy = !store.busy;
40 38
41 window.setTimeout(() => { 39 window.setTimeout(() => {
42 store.busy = !store.busy; 40 store.busy = !store.busy;
43 }, 1000); 41 }, 1000);
44 } : store.onClick} 42 } : store.onClick}
45 /> 43 />
46 </> 44 </>
@@ -53,58 +51,69 @@ storiesOf('Button')
53 .add('Secondary', () => ( 51 .add('Secondary', () => (
54 <WithStoreButton store={createStore({ 52 <WithStoreButton store={createStore({
55 buttonType: 'secondary', 53 buttonType: 'secondary',
56 })} /> 54 })}
55 />
57 )) 56 ))
58 .add('Success', () => ( 57 .add('Success', () => (
59 <WithStoreButton store={createStore({ 58 <WithStoreButton store={createStore({
60 buttonType: 'success', 59 buttonType: 'success',
61 })} /> 60 })}
61 />
62 )) 62 ))
63 .add('Warning', () => ( 63 .add('Warning', () => (
64 <WithStoreButton store={createStore({ 64 <WithStoreButton store={createStore({
65 buttonType: 'warning', 65 buttonType: 'warning',
66 })} /> 66 })}
67 />
67 )) 68 ))
68 .add('Danger', () => ( 69 .add('Danger', () => (
69 <WithStoreButton store={createStore({ 70 <WithStoreButton store={createStore({
70 buttonType: 'danger', 71 buttonType: 'danger',
71 })} /> 72 })}
73 />
72 )) 74 ))
73 .add('Inverted', () => ( 75 .add('Inverted', () => (
74 <WithStoreButton store={createStore({ 76 <WithStoreButton store={createStore({
75 buttonType: 'inverted', 77 buttonType: 'inverted',
76 })} /> 78 })}
79 />
77 )) 80 ))
78 .add('Full width', () => ( 81 .add('Full width', () => (
79 <WithStoreButton store={createStore({ 82 <WithStoreButton store={createStore({
80 stretch: true, 83 stretch: true,
81 })} /> 84 })}
85 />
82 )) 86 ))
83 .add('Disabled', () => ( 87 .add('Disabled', () => (
84 <WithStoreButton store={createStore({ 88 <WithStoreButton store={createStore({
85 disabled: true, 89 disabled: true,
86 })} /> 90 })}
91 />
87 )) 92 ))
88 .add('With loader', () => ( 93 .add('With loader', () => (
89 <WithStoreButton store={createStore({ 94 <WithStoreButton store={createStore({
90 busy: true, 95 busy: true,
91 })} /> 96 })}
97 />
92 )) 98 ))
93 .add('With icon', () => ( 99 .add('With icon', () => (
94 <WithStoreButton store={createStore({ 100 <WithStoreButton store={createStore({
95 icon: mdiInformation, 101 icon: mdiInformation,
96 })} /> 102 })}
103 />
97 )) 104 ))
98 .add('As link', () => ( 105 .add('As link', () => (
99 <WithStoreButton store={createStore({ 106 <WithStoreButton store={createStore({
100 href: 'https://meetfranz.com', 107 href: 'https://meetfranz.com',
101 })} /> 108 })}
109 />
102 )) 110 ))
103 .add('As link (target=_blank)', () => ( 111 .add('As link (target=_blank)', () => (
104 <WithStoreButton store={createStore({ 112 <WithStoreButton store={createStore({
105 href: 'https://meetfranz.com', 113 href: 'https://meetfranz.com',
106 target: '_blank', 114 target: '_blank',
107 })} /> 115 })}
116 />
108 )) 117 ))
109 .add('As link (with onClick)', () => ( 118 .add('As link (with onClick)', () => (
110 <WithStoreButton store={createStore({ 119 <WithStoreButton store={createStore({
@@ -113,26 +122,27 @@ storiesOf('Button')
113 e.preventDefault(); 122 e.preventDefault();
114 alert('Click event'); 123 alert('Click event');
115 }, 124 },
116 })}/> 125 })}
126 />
117 )) 127 ))
118 .add('Long multi-line button', () => ( 128 .add('Long multi-line button', () => (
119 <WithStoreButton store={createStore({ 129 <WithStoreButton store={createStore({
120 label: 'But there is something that I must say to my people, who stand on the warm threshold which leads into the palace of justice: In the process of gaining our rightful place, we must not be guilty of wrongful deeds. Let us not seek to satisfy our thirst for freedom by drinking from the cup of bitterness and hatred. We must forever conduct our struggle on the high plane of dignity and discipline. We must not allow our creative protest to degenerate into physical violence. Again and again, we must rise to the majestic heights of meeting physical force with soul force.', 130 label: 'But there is something that I must say to my people, who stand on the warm threshold which leads into the palace of justice: In the process of gaining our rightful place, we must not be guilty of wrongful deeds. Let us not seek to satisfy our thirst for freedom by drinking from the cup of bitterness and hatred. We must forever conduct our struggle on the high plane of dignity and discipline. We must not allow our creative protest to degenerate into physical violence. Again and again, we must rise to the majestic heights of meeting physical force with soul force.',
121 })} /> 131 })}
132 />
122 )) 133 ))
123 .add('Button with Input', injectSheet(styles)(observer(({ classes }: { classes: Classes }) => ( 134 .add('Button with Input', injectSheet(styles)(observer(({ classes }: { classes: Classes }) => (
124 <div className={classes.combinedElements}> 135 <div className={classes.combinedElements}>
125 <Input showLabel={false} className={classes.input} noMargin /> 136 <Input showLabel={false} className={classes.input} noMargin />
126 <WithStoreButton store={createStore({})} /> 137 <WithStoreButton store={createStore({})} />
127 </div> 138 </div>
128 )), 139 ))))
129 ))
130 .add('Icon Button with Input', injectSheet(styles)(observer(({ classes }: { classes: Classes }) => ( 140 .add('Icon Button with Input', injectSheet(styles)(observer(({ classes }: { classes: Classes }) => (
131 <div className={classes.combinedElements}> 141 <div className={classes.combinedElements}>
132 <Input showLabel={false} className={classes.input} noMargin /> 142 <Input showLabel={false} className={classes.input} noMargin />
133 <WithStoreButton store={createStore({ 143 <WithStoreButton store={createStore({
134 icon: mdiInformation, 144 icon: mdiInformation,
135 })} /> 145 })}
136 </div> 146 />
137 )), 147 </div>
138 )); 148 ))));
diff --git a/uidev/src/stories/headline.stories.tsx b/uidev/src/stories/headline.stories.tsx
index f42771cae..320ac832f 100644
--- a/uidev/src/stories/headline.stories.tsx
+++ b/uidev/src/stories/headline.stories.tsx
@@ -1,7 +1,4 @@
1import { observable } from 'mobx';
2import { observer } from 'mobx-react';
3import React from 'react'; 1import React from 'react';
4import uuid from 'uuid/v4';
5 2
6import { H1, H2, H3, H4 } from '@meetfranz/ui'; 3import { H1, H2, H3, H4 } from '@meetfranz/ui';
7import { storiesOf } from '../stores/stories'; 4import { storiesOf } from '../stores/stories';
diff --git a/uidev/src/stories/infobox.stories.tsx b/uidev/src/stories/infobox.stories.tsx
index b0416b844..fe4aaab06 100644
--- a/uidev/src/stories/infobox.stories.tsx
+++ b/uidev/src/stories/infobox.stories.tsx
@@ -14,14 +14,11 @@ interface IStoreArgs {
14 className?: string; 14 className?: string;
15} 15}
16 16
17const createStore = (args?: IStoreArgs) => { 17const createStore = (args?: IStoreArgs) => observable({ type: 'primary',
18 return observable(Object.assign({
19 type: 'primary',
20 ctaOnClick: () => { 18 ctaOnClick: () => {
21 alert('on click handler'); 19 alert('on click handler');
22 }, 20 },
23 }, args)); 21...args });
24};
25 22
26const WithStoreInfobox = observer(({ store, children }: { store: any, children: string | React.ReactNode }) => ( 23const WithStoreInfobox = observer(({ store, children }: { store: any, children: string | React.ReactNode }) => (
27 <> 24 <>
@@ -130,7 +127,8 @@ storiesOf('Infobox')
130 .add('With className', () => ( 127 .add('With className', () => (
131 <WithStoreInfobox store={createStore({ 128 <WithStoreInfobox store={createStore({
132 className: 'franz-is-awesome', 129 className: 'franz-is-awesome',
133 })}> 130 })}
131 >
134 Welcome to the world of tomorrow 132 Welcome to the world of tomorrow
135 </WithStoreInfobox> 133 </WithStoreInfobox>
136 )); 134 ));
diff --git a/uidev/src/stories/input.stories.tsx b/uidev/src/stories/input.stories.tsx
index af5e791d0..889539266 100644
--- a/uidev/src/stories/input.stories.tsx
+++ b/uidev/src/stories/input.stories.tsx
@@ -10,7 +10,7 @@ const defaultProps = () => {
10 label: 'Label', 10 label: 'Label',
11 id: `test-${id}`, 11 id: `test-${id}`,
12 name: `test-${id}`, 12 name: `test-${id}`,
13 onChange: (e: React.ChangeEvent<HTMLInputElement>) => console.log('changed event', e), 13 onChange: (e: React.ChangeEvent<HTMLInputElement>) => console.log('changed event', e),
14 }; 14 };
15}; 15};
16 16
@@ -21,7 +21,7 @@ const defaultPasswordProps = () => {
21 id: `test-${id}`, 21 id: `test-${id}`,
22 name: `test-${id}`, 22 name: `test-${id}`,
23 type: 'password', 23 type: 'password',
24 onChange: (e: React.ChangeEvent<HTMLInputElement>) => console.log('changed event', e), 24 onChange: (e: React.ChangeEvent<HTMLInputElement>) => console.log('changed event', e),
25 }; 25 };
26}; 26};
27 27
diff --git a/uidev/src/stories/loader.stories.tsx b/uidev/src/stories/loader.stories.tsx
index 84e813c04..50eb7b9e1 100644
--- a/uidev/src/stories/loader.stories.tsx
+++ b/uidev/src/stories/loader.stories.tsx
@@ -1,7 +1,4 @@
1import { observable } from 'mobx';
2import { observer } from 'mobx-react';
3import React from 'react'; 1import React from 'react';
4import uuid from 'uuid/v4';
5 2
6import { Loader } from '@meetfranz/ui'; 3import { Loader } from '@meetfranz/ui';
7import { storiesOf } from '../stores/stories'; 4import { storiesOf } from '../stores/stories';
diff --git a/uidev/src/stories/select.stories.tsx b/uidev/src/stories/select.stories.tsx
index 81f7f08a6..51ec6ed88 100644
--- a/uidev/src/stories/select.stories.tsx
+++ b/uidev/src/stories/select.stories.tsx
@@ -282,7 +282,7 @@ const defaultProps = () => {
282 }, 282 },
283 actionText: 'Select country', 283 actionText: 'Select country',
284 // defaultValue: 'AT', 284 // defaultValue: 'AT',
285 onChange: (e: React.ChangeEvent<HTMLInputElement>) => console.log('changed event', e), 285 onChange: (e: React.ChangeEvent<HTMLInputElement>) => console.log('changed event', e),
286 }; 286 };
287}; 287};
288 288
diff --git a/uidev/src/stories/textarea.stories.tsx b/uidev/src/stories/textarea.stories.tsx
index c2dd74e24..1ab21820b 100644
--- a/uidev/src/stories/textarea.stories.tsx
+++ b/uidev/src/stories/textarea.stories.tsx
@@ -11,7 +11,7 @@ const defaultProps = () => {
11 id: `test-${id}`, 11 id: `test-${id}`,
12 name: `test-${id}`, 12 name: `test-${id}`,
13 rows: 5, 13 rows: 5,
14 onChange: (e: React.ChangeEvent<HTMLInputElement>) => console.log('changed event', e), 14 onChange: (e: React.ChangeEvent<HTMLInputElement>) => console.log('changed event', e),
15 }; 15 };
16}; 16};
17 17
diff --git a/uidev/src/stories/toggle.stories.tsx b/uidev/src/stories/toggle.stories.tsx
index 091342496..af6b282bc 100644
--- a/uidev/src/stories/toggle.stories.tsx
+++ b/uidev/src/stories/toggle.stories.tsx
@@ -16,17 +16,14 @@ interface IStoreArgs {
16 error?: string; 16 error?: string;
17} 17}
18 18
19const createStore = (args?: IStoreArgs) => { 19const createStore = (args?: IStoreArgs) => observable({ id: `element-${uuid()}`,
20 return observable(Object.assign({
21 id: `element-${uuid()}`,
22 name: 'toggle', 20 name: 'toggle',
23 label: 'Label', 21 label: 'Label',
24 value: true, 22 value: true,
25 checked: false, 23 checked: false,
26 disabled: false, 24 disabled: false,
27 error: '', 25 error: '',
28 }, args)); 26...args });
29};
30 27
31const WithStoreToggle = observer(({ store }: { store: any }) => ( 28const WithStoreToggle = observer(({ store }: { store: any }) => (
32 <> 29 <>
@@ -50,21 +47,25 @@ storiesOf('Toggle')
50 .add('Checked', () => ( 47 .add('Checked', () => (
51 <WithStoreToggle store={createStore({ 48 <WithStoreToggle store={createStore({
52 checked: true, 49 checked: true,
53 })} /> 50 })}
51 />
54 )) 52 ))
55 .add('Disabled', () => ( 53 .add('Disabled', () => (
56 <WithStoreToggle store={createStore({ 54 <WithStoreToggle store={createStore({
57 checked: true, 55 checked: true,
58 disabled: true, 56 disabled: true,
59 })} /> 57 })}
58 />
60 )) 59 ))
61 .add('Long label', () => ( 60 .add('Long label', () => (
62 <WithStoreToggle store={createStore({ 61 <WithStoreToggle store={createStore({
63 label: 'Hello world, this is an insanely long label for this toggle. We need to make sure that it will be displayed correctly.', 62 label: 'Hello world, this is an insanely long label for this toggle. We need to make sure that it will be displayed correctly.',
64 })} /> 63 })}
64 />
65 )) 65 ))
66 .add('With error', () => ( 66 .add('With error', () => (
67 <WithStoreToggle store={createStore({ 67 <WithStoreToggle store={createStore({
68 error: 'Something went wrong', 68 error: 'Something went wrong',
69 })} /> 69 })}
70 />
70 )); 71 ));
diff --git a/uidev/src/withTheme/index.tsx b/uidev/src/withTheme/index.tsx
index 17a1074d3..4ef649367 100644
--- a/uidev/src/withTheme/index.tsx
+++ b/uidev/src/withTheme/index.tsx
@@ -37,14 +37,12 @@ const Container = injectSheet(styles)(({ name, classes, story }: { name: string,
37 </article> 37 </article>
38)); 38));
39 39
40export const WithTheme = ({ children }: {children: React.ReactChild}) => { 40export const WithTheme = ({ children }: { children: React.ReactChild }) => (
41 return ( 41 <>
42 <> 42 {themes.map((theme, key) => (
43 {themes.map((theme, key) => ( 43 <ThemeProvider key={key} theme={theme.variables}>
44 <ThemeProvider key={key} theme={theme.variables}> 44 <Container story={children} name={theme.name} />
45 <Container story={children} name={theme.name} /> 45 </ThemeProvider>
46 </ThemeProvider>
47 ))} 46 ))}
48 </> 47 </>
49 ); 48 );
50};
diff --git a/uidev/tslint.json b/uidev/tslint.json
deleted file mode 100644
index ec365f164..000000000
--- a/uidev/tslint.json
+++ /dev/null
@@ -1,3 +0,0 @@
1{
2 "extends": "../tslint.json"
3}