Skip to content

Commit 05cbb82

Browse files
committed
refactor: update examples
1 parent 0f6f87b commit 05cbb82

File tree

3 files changed

+42
-2
lines changed

3 files changed

+42
-2
lines changed

src/reusable/DocsCallout.js

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import PropTypes from 'prop-types'
2+
import React from 'react'
3+
import { CCallout, CLink } from '@coreui/react'
4+
5+
import packageJson from '../../package.json'
6+
7+
const DocsCallout = (props) => {
8+
const { href, name } = props
9+
10+
const plural = name.slice(-1) === 's' ? true : false
11+
12+
const _href = `https://coreui.io/react/docs/${packageJson.config.coreui_library_short_version}/${href}`
13+
14+
return (
15+
<CCallout color="info" className="bg-white">
16+
A React {name} component {plural ? 'have' : 'has'} been created as a native React.js version
17+
of Bootstrap {name}. {name} {plural ? 'are' : 'is'} delivered with some new features,
18+
variants, and unique design that matches CoreUI Design System requirements.
19+
<br />
20+
<br />
21+
For more information please visit our official{' '}
22+
<CLink href={_href} target="_blank">
23+
documentation of CoreUI Components Library for React.js
24+
</CLink>
25+
.
26+
</CCallout>
27+
)
28+
}
29+
30+
DocsCallout.propTypes = {
31+
href: PropTypes.string,
32+
name: PropTypes.string,
33+
}
34+
35+
export default React.memo(DocsCallout)

src/reusable/Example.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,13 @@ import React from 'react'
33
import { CNav, CNavItem, CNavLink, CTabContent, CTabPane } from '@coreui/react'
44
import CIcon from '@coreui/icons-react'
55

6+
import packageJson from '../../package.json'
7+
68
const Example = (props) => {
79
const { children, href } = props
810

11+
const _href = `https://coreui.io/react/docs/${packageJson.config.coreui_library_short_version}/${href}`
12+
913
return (
1014
<div className="example">
1115
<CNav variant="tabs">
@@ -16,7 +20,7 @@ const Example = (props) => {
1620
</CNavLink>
1721
</CNavItem>
1822
<CNavItem>
19-
<CNavLink href={href} target="_blank">
23+
<CNavLink href={_href} target="_blank">
2024
<CIcon name="cil-code" className="me-2" />
2125
Code
2226
</CNavLink>

src/reusable/index.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1+
import DocsCallout from './DocsCallout'
12
import DocsLink from './DocsLink'
23
import Example from './Example'
34

4-
export { DocsLink, Example }
5+
export { DocsCallout, DocsLink, Example }

0 commit comments

Comments
 (0)