-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathHint.js
45 lines (40 loc) · 1.05 KB
/
Hint.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
import React from 'react';
const Hint = ({ children, isOpen = false, theme = Hint.theme }) => {
return (
<div className={theme.base}>
<div className={theme.questionMark}>?</div>
<div className={isOpen ? theme.visibleContent : theme.hiddenContent}>
{children}
</div>
</div>
);
};
Hint.theme = {
base: undefined,
questionMark: undefined,
visibleContent: undefined,
hiddenContent: undefined,
};
/* Alternative class based implementation */
// class Hint extends React.Component {
//
// static theme = {
// base: undefined,
// questionMark: undefined,
// visibleContent: undefined,
// hiddenContent: undefined,
// };
//
// render() {
// const {children, isOpen = false, theme = Hint.theme} = this.props;
// return (
// <div className={theme.base}>
// <div className={theme.questionMark}>?</div>
// <div className={isOpen ? theme.visibleContent : theme.hiddenContent}>
// {this.props.children}
// </div>
// </div>
// );
// }
// };
export default Hint;