refactor: update examples

This commit is contained in:
Łukasz Holeczek 2021-10-20 21:44:56 +02:00
parent 0a4941e2e1
commit 1a6c3e13b0
5 changed files with 60 additions and 39 deletions

View File

@ -5,7 +5,7 @@ import { CCallout, CLink } from '@coreui/react'
import packageJson from '../../package.json' import packageJson from '../../package.json'
const DocsCallout = (props) => { const DocsCallout = (props) => {
const { href, name } = props const { content, href, name } = props
const plural = name.slice(-1) === 's' ? true : false const plural = name.slice(-1) === 's' ? true : false
@ -13,9 +13,13 @@ const DocsCallout = (props) => {
return ( return (
<CCallout color="info" className="bg-white"> <CCallout color="info" className="bg-white">
A React {name} component {plural ? 'have' : 'has'} been created as a native React.js version {content
of Bootstrap {name}. {name} {plural ? 'are' : 'is'} delivered with some new features, ? content
variants, and unique design that matches CoreUI Design System requirements. : `A React ${name} component ${
plural ? 'have' : 'has'
} been created as a native React.js version
of Bootstrap ${name}. ${name} ${plural ? 'are' : 'is'} delivered with some new features,
variants, and unique design that matches CoreUI Design System requirements.`}
<br /> <br />
<br /> <br />
For more information please visit our official{' '} For more information please visit our official{' '}
@ -28,6 +32,7 @@ const DocsCallout = (props) => {
} }
DocsCallout.propTypes = { DocsCallout.propTypes = {
content: PropTypes.string,
href: PropTypes.string, href: PropTypes.string,
name: PropTypes.string, name: PropTypes.string,
} }

View File

@ -8,19 +8,23 @@ import {
CChartPolarArea, CChartPolarArea,
CChartRadar, CChartRadar,
} from '@coreui/react-chartjs' } from '@coreui/react-chartjs'
import { DocsLink } from 'src/components' import { DocsCallout } from 'src/components'
const Charts = () => { const Charts = () => {
const random = () => Math.round(Math.random() * 100) const random = () => Math.round(Math.random() * 100)
return ( return (
<CRow> <CRow>
<CCol xs={12}>
<DocsCallout
name="Chart"
href="components/chart"
content="React wrapper component for Chart.js 3.0, the most popular charting library."
/>
</CCol>
<CCol xs={6}> <CCol xs={6}>
<CCard className="mb-4"> <CCard className="mb-4">
<CCardHeader> <CCardHeader>Bar Chart</CCardHeader>
Bar Chart
<DocsLink href="http://www.chartjs.org" />
</CCardHeader>
<CCardBody> <CCardBody>
<CChartBar <CChartBar
data={{ data={{

View File

@ -2,7 +2,7 @@ import React from 'react'
import { CCard, CCardBody, CCardHeader, CCol, CRow } from '@coreui/react' import { CCard, CCardBody, CCardHeader, CCol, CRow } from '@coreui/react'
import CIcon from '@coreui/icons-react' import CIcon from '@coreui/icons-react'
import { brandSet } from '@coreui/icons' import { brandSet } from '@coreui/icons'
import { DocsLink } from 'src/components' import { DocsCallout } from 'src/components'
const toKebabCase = (str) => { const toKebabCase = (str) => {
return str.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, '$1-$2').toLowerCase() return str.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, '$1-$2').toLowerCase()
@ -19,15 +19,19 @@ export const getIconsView = (iconset) => {
const CoreUIIcons = () => { const CoreUIIcons = () => {
return ( return (
<>
<DocsCallout
name="CoreUI Brand Icons"
href="components/chart"
content="CoreUI Brand Icons. CoreUI Icons package is delivered with more than 1500 icons in multiple formats SVG, PNG, and Webfonts. CoreUI Icons are beautifully crafted symbols for common actions and items. You can use them in your digital products for web or mobile app."
/>
<CCard className="mb-4"> <CCard className="mb-4">
<CCardHeader> <CCardHeader>Brand Icons</CCardHeader>
Brand Icons
<DocsLink href="https://github.com/coreui/coreui-icons" text="GitHub" />
</CCardHeader>
<CCardBody> <CCardBody>
<CRow className="text-center">{getIconsView(brandSet)}</CRow> <CRow className="text-center">{getIconsView(brandSet)}</CRow>
</CCardBody> </CCardBody>
</CCard> </CCard>
</>
) )
} }

View File

@ -2,19 +2,23 @@ import React from 'react'
import { CCard, CCardBody, CCardHeader, CRow } from '@coreui/react' import { CCard, CCardBody, CCardHeader, CRow } from '@coreui/react'
import { freeSet } from '@coreui/icons' import { freeSet } from '@coreui/icons'
import { getIconsView } from '../brands/Brands.js' import { getIconsView } from '../brands/Brands.js'
import { DocsLink } from 'src/components' import { DocsCallout } from 'src/components'
const CoreUIIcons = () => { const CoreUIIcons = () => {
return ( return (
<>
<DocsCallout
name="CoreUI Icons"
href="components/chart"
content="CoreUI Icons. CoreUI Icons package is delivered with more than 1500 icons in multiple formats SVG, PNG, and Webfonts. CoreUI Icons are beautifully crafted symbols for common actions and items. You can use them in your digital products for web or mobile app."
/>
<CCard className="mb-4"> <CCard className="mb-4">
<CCardHeader> <CCardHeader>Free Icons</CCardHeader>
Free Icons / as CIcon{' '}
<DocsLink href="https://github.com/coreui/coreui-icons" text="GitHub" />
</CCardHeader>
<CCardBody> <CCardBody>
<CRow className="text-center">{getIconsView(freeSet)}</CRow> <CRow className="text-center">{getIconsView(freeSet)}</CRow>
</CCardBody> </CCardBody>
</CCard> </CCard>
</>
) )
} }

View File

@ -2,19 +2,23 @@ import React from 'react'
import { CCard, CCardBody, CCardHeader, CRow } from '@coreui/react' import { CCard, CCardBody, CCardHeader, CRow } from '@coreui/react'
import { getIconsView } from '../brands/Brands.js' import { getIconsView } from '../brands/Brands.js'
import { flagSet } from '@coreui/icons' import { flagSet } from '@coreui/icons'
import { DocsLink } from 'src/components' import { DocsCallout } from 'src/components'
const CoreUIIcons = () => { const CoreUIIcons = () => {
return ( return (
<>
<DocsCallout
name="CoreUI Flag Icons"
href="components/chart"
content="CoreUI Flag Icons. CoreUI Icons package is delivered with more than 1500 icons in multiple formats SVG, PNG, and Webfonts. CoreUI Icons are beautifully crafted symbols for common actions and items. You can use them in your digital products for web or mobile app."
/>
<CCard className="mb-4"> <CCard className="mb-4">
<CCardHeader> <CCardHeader>Flag Icons</CCardHeader>
Flag Icons
<DocsLink href="https://github.com/coreui/coreui-icons" text="GitHub" />
</CCardHeader>
<CCardBody> <CCardBody>
<CRow className="text-center">{getIconsView(flagSet)}</CRow> <CRow className="text-center">{getIconsView(flagSet)}</CRow>
</CCardBody> </CCardBody>
</CCard> </CCard>
</>
) )
} }