forked from storybookjs/storybook
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Container.js
40 lines (37 loc) 路 838 Bytes
/
Container.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
import React from 'react';
import PropTypes from 'prop-types';
const Container = ({ children, title, age, isAmazing }) => (
<div title={title}>
{children}
{isAmazing ? '!!!' : ''}
{age.isOld ? <div>age = {age.value}</div> : null}
</div>
);
Container.propTypes = {
/**
* The nodes to be rendered in the button
*
* Example value:
*
* ```
* <h1>Node 1</h1>
* <h2>Node 2</h2>
* ```
*/
children: PropTypes.node.isRequired,
/** Show exclamation marks */
isAmazing: PropTypes.bool,
/** Show age prop */
age: PropTypes.shape({
isOld: PropTypes.bool,
value: PropTypes.number,
}),
/** Main title */
title: PropTypes.string,
};
Container.defaultProps = {
isAmazing: false,
age: { isOld: false, value: 0 },
title: 'the best container ever',
};
export default Container;