-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
/
Copy pathDocsExample.js
43 lines (38 loc) · 1.2 KB
/
DocsExample.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
import PropTypes from 'prop-types'
import React from 'react'
import { CNav, CNavItem, CNavLink, CTabContent, CTabPane } from '@coreui/react'
import CIcon from '@coreui/icons-react'
import { cilCode, cilMediaPlay } from '@coreui/icons'
const DocsExample = (props) => {
const { children, href, tabContentClassName } = props
const _href = `https://coreui.io/react/docs/${href}`
return (
<div className="example">
<CNav variant="underline-border">
<CNavItem>
<CNavLink href="#" active>
<CIcon icon={cilMediaPlay} className="me-2" />
Preview
</CNavLink>
</CNavItem>
<CNavItem>
<CNavLink href={_href} target="_blank">
<CIcon icon={cilCode} className="me-2" />
Code
</CNavLink>
</CNavItem>
</CNav>
<CTabContent className={`rounded-bottom ${tabContentClassName ? tabContentClassName : ''}`}>
<CTabPane className="p-3 preview" visible>
{children}
</CTabPane>
</CTabContent>
</div>
)
}
DocsExample.propTypes = {
children: PropTypes.node,
href: PropTypes.string,
tabContentClassName: PropTypes.string,
}
export default React.memo(DocsExample)