-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathindex.js
executable file
·80 lines (64 loc) · 2.64 KB
/
index.js
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
import React from 'react';
import ReactDOM from 'react-dom';
import HintExample from './components/HintExample';
import HintJssExample from './components/HintJssExample';
import HintCssModulesExample from './components/HintCssModulesExample';
/* In this version each porperty of the importet theme can be overwritten. */
import Hint, { defaultTheme } from 'ui-lib/ModuleExport/Hint';
defaultTheme.questionMark = 'custom-class-for-question-mark-green';
defaultTheme.visibleContent = 'custom-class-visible-content';
/* In this variant the default theme can be overwritten by assigning a new object. */
import Hint2 from 'ui-lib/StaticProperty/Hint';
Hint2.theme = {
questionMark: 'custom-class-for-question-mark-red',
visibleContent: 'custom-class-visible-content',
};
/* It is also possible to just overwrite a single property. */
Hint2.theme.questionMark = 'custom-class-for-question-mark-red';
/* Context based theming */
import Hint3 from 'ui-lib/Context/Hint';
import Theme from 'ui-lib/Context/Theme';
const contextTheme = {
hint: {
questionMark: 'custom-class-for-question-mark-blue',
visibleContent: 'custom-class-visible-content',
},
};
/* Factory based theming
* also see /ui-lib/Factory/belle/Hint or /ui-lib/Factory/elemental/Hint
*/
import Hint4Unstyled from '../ui-lib/Factory/ui-core/Hint';
import createComponent from '../ui-lib/Factory/react-themeable/createComponent';
const theme = {
questionMark: 'custom-class-for-question-mark-gold',
visibleContent: 'custom-class-visible-content',
};
const Hint4 = createComponent(Hint, theme);
window.React = React;
const App = () => {
return (
<div style={{ width: 600, margin: '0 auto' }}>
<h2>JSS styled</h2>
<HintJssExample />
<h2>CSS Modules styled</h2>
<HintCssModulesExample />
<br /><br />
<h2>Unstyled (globally patched classNames)</h2>
<h3>Global theme as module export</h3>
<Hint>Basic closed hint without styling.</Hint>
<Hint isOpen>Basic open hint without styling.</Hint>
<h3>Global theme as static property</h3>
<Hint2>Basic closed hint without styling.</Hint2>
<Hint2 isOpen>Basic open hint without styling.</Hint2>
<h3>Global theme as Theme component leveraging context</h3>
<Theme theme={contextTheme}>
<Hint3>Basic closed hint without styling.</Hint3>
<Hint3 isOpen>Basic open hint without styling.</Hint3>
</Theme>
<h3>Factory to create Components with a provided Theme</h3>
<Hint4>Basic closed hint without styling.</Hint4>
<Hint4 isOpen>Basic open hint without styling.</Hint4>
</div>
);
};
ReactDOM.render(<App/>, document.getElementById('react'));