forked from SoftwareBrothers/better-docs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcomponent.jsx
55 lines (50 loc) · 947 Bytes
/
component.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
import React from 'react'
import PropTypes from 'prop-types'
import styled from 'styled-components'
const Bold = styled.div`
background: red;
color: #fff;
padding: 5px;
`
/**
* Some documented component
*
* @component
* @example <caption>Default example</caption>
* const text = 'Meva'
* return (
* <Documented2>
* <Documented text={text} />
* </Documented2>
* )
*
* @example <caption>Ala ma kota</caption>
* const text = 'some example text 2'
* return (
* <Documented2>
* <Documented text={text} header={'sime'} />
* </Documented2>
* )
*/
const Documented = (props) => {
const { text, header } = props
return (
<p>
{header}
<Bold>
{text}
</Bold>
</p>
)
}
Documented.propTypes = {
/**
* Text is a text
*/
text: PropTypes.string,
header: PropTypes.string.isRequired,
}
Documented.defaultProps = {
text: 'Hello World',
}
export default Documented