-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.jsx
62 lines (58 loc) · 1.65 KB
/
index.jsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import Button from './src/components/button/Button';
import Input from './src/components/input/Input';
import Select from './src/components/select/Select';
import Checkbox from './src/components/checkbox/Checkbox';
import RadioButton from './src/components/radio-button/RadioButton';
import Dropdown from './src/components/dropdown/Dropdown';
import FormField from './src/components/form-field/FormField';
import NavBar from './src/components/nav-bar/NavBar';
import Terminal from './src/components/terminal/Terminal';
import Code from './src/components/code/Code';
import Page from './src/components/page/Page';
import Hero from './src/components/hero/Hero';
import Textarea from './src/components/textarea/Textarea';
import Footer from './src/components/footer/Footer';
import './design-system/index.scss';
const handleErrors = (setError, err) => {
const errors = [];
if (err && err.response && err.response.data && err.response.data.errors) {
// eslint-disable-next-line no-unused-vars
for (const key in err.response.data.errors) {
// eslint-disable-next-line no-unused-vars
for (const error of err.response.data.errors[key]) {
errors.push({
name: key,
message: error.message,
});
}
}
} // At the moment this sets just one error for the key, so we will
setError(errors);
};
const applyWebpackConfig = (test = /\.jsx/) => {
return (config, options) => {
config.module.rules.push({
test,
use: [options.defaultLoaders.babel],
});
return config;
};
};
export {
Button,
Input,
Select,
Checkbox,
RadioButton,
Dropdown,
FormField,
NavBar,
Terminal,
Code,
Page,
Hero,
Footer,
Textarea,
applyWebpackConfig,
handleErrors,
};