coreui-free-react-admin-template
898 строк · 29.9 Кб
1import React from 'react'2import {3CCard,4CCardBody,5CCardGroup,6CCardHeader,7CCol,8CLink,9CRow,10CWidgetStatsB,11CWidgetStatsC,12CWidgetStatsE,13CWidgetStatsF,14} from '@coreui/react'15import { getStyle } from '@coreui/utils'16import CIcon from '@coreui/icons-react'17import {18cilArrowRight,19cilBasket,20cilBell,21cilChartPie,22cilMoon,23cilLaptop,24cilPeople,25cilSettings,26cilSpeech,27cilSpeedometer,28cilUser,29cilUserFollow,30} from '@coreui/icons'31import { CChartBar, CChartLine } from '@coreui/react-chartjs'32import { DocsExample } from 'src/components'33
34import WidgetsBrand from './WidgetsBrand'35import WidgetsDropdown from './WidgetsDropdown'36
37const Widgets = () => {38const random = (min, max) => Math.floor(Math.random() * (max - min + 1) + min)39
40return (41<CCard className="mb-4">42<CCardHeader>Widgets</CCardHeader>43<CCardBody>44<DocsExample href="components/widgets/#cwidgetstatsa">45<WidgetsDropdown />46</DocsExample>47<DocsExample href="components/widgets/#cwidgetstatsb">48<CRow xs={{ gutter: 4 }}>49<CCol xs={12} sm={6} xl={4} xxl={3}>50<CWidgetStatsB51progress={{ color: 'success', value: 89.9 }}52text="Lorem ipsum dolor sit amet enim."53title="Widget title"54value="89.9%"55/>56</CCol>57<CCol xs={12} sm={6} xl={4} xxl={3}>58<CWidgetStatsB59value="12.124"60title="Widget title"61progress={{ color: 'info', value: 89.9 }}62text="Lorem ipsum dolor sit amet enim."63/>64</CCol>65<CCol xs={12} sm={6} xl={4} xxl={3}>66<CWidgetStatsB67value="$98.111,00"68title="Widget title"69progress={{ color: 'warning', value: 89.9 }}70text="Lorem ipsum dolor sit amet enim."71/>72</CCol>73<CCol xs={12} sm={6} xl={4} xxl={3}>74<CWidgetStatsB75value="2 TB"76title="Widget title"77progress={{ color: 'primary', value: 89.9 }}78text="Lorem ipsum dolor sit amet enim."79/>80</CCol>81</CRow>82</DocsExample>83<DocsExample href="components/widgets/#cwidgetstatsb">84<CRow xs={{ gutter: 4 }}>85<CCol xs={12} sm={6} xl={4} xxl={3}>86<CWidgetStatsB87color="success"88inverse
89value="89.9%"90title="Widget title"91progress={{ value: 89.9 }}92text="Lorem ipsum dolor sit amet enim."93/>94</CCol>95<CCol xs={12} sm={6} xl={4} xxl={3}>96<CWidgetStatsB97color="info"98inverse
99value="12.124"100title="Widget title"101progress={{ value: 89.9 }}102text="Lorem ipsum dolor sit amet enim."103/>104</CCol>105<CCol xs={12} sm={6} xl={4} xxl={3}>106<CWidgetStatsB107color="warning"108inverse
109value="$98.111,00"110title="Widget title"111progress={{ value: 89.9 }}112text="Lorem ipsum dolor sit amet enim."113/>114</CCol>115<CCol xs={12} sm={6} xl={4} xxl={3}>116<CWidgetStatsB117color="primary"118inverse
119value="2 TB"120title="Widget title"121progress={{ value: 89.9 }}122text="Lorem ipsum dolor sit amet enim."123/>124</CCol>125</CRow>126</DocsExample>127<DocsExample href="components/widgets/#cwidgetstatse">128<CRow xs={{ gutter: 4 }}>129<CCol sm={4} md={3} xl={2}>130<CWidgetStatsE131chart={132<CChartBar133className="mx-auto"134style={{ height: '40px', width: '80px' }}135data={{136labels: [137'M',138'T',139'W',140'T',141'F',142'S',143'S',144'M',145'T',146'W',147'T',148'F',149'S',150'S',151'M',152],153datasets: [154{155backgroundColor: getStyle('--cui-danger'),156borderColor: 'transparent',157borderWidth: 1,158data: [159random(40, 100),160random(40, 100),161random(40, 100),162random(40, 100),163random(40, 100),164random(40, 100),165random(40, 100),166random(40, 100),167random(40, 100),168random(40, 100),169random(40, 100),170random(40, 100),171random(40, 100),172random(40, 100),173random(40, 100),174],175},176],177}}178options={{179maintainAspectRatio: false,180plugins: {181legend: {182display: false,183},184},185scales: {186x: {187display: false,188},189y: {190display: false,191},192},193}}194/>195}196title="title"197value="1,123"198/>199</CCol>200<CCol sm={4} md={3} xl={2}>201<CWidgetStatsE202chart={203<CChartBar204className="mx-auto"205style={{ height: '40px', width: '80px' }}206data={{207labels: [208'M',209'T',210'W',211'T',212'F',213'S',214'S',215'M',216'T',217'W',218'T',219'F',220'S',221'S',222'M',223],224datasets: [225{226backgroundColor: getStyle('--cui-primary'),227borderColor: 'transparent',228borderWidth: 1,229data: [230random(40, 100),231random(40, 100),232random(40, 100),233random(40, 100),234random(40, 100),235random(40, 100),236random(40, 100),237random(40, 100),238random(40, 100),239random(40, 100),240random(40, 100),241random(40, 100),242random(40, 100),243random(40, 100),244random(40, 100),245],246},247],248}}249options={{250maintainAspectRatio: false,251plugins: {252legend: {253display: false,254},255},256scales: {257x: {258display: false,259},260y: {261display: false,262},263},264}}265/>266}267title="title"268value="1,123"269/>270</CCol>271<CCol sm={4} md={3} xl={2}>272<CWidgetStatsE273chart={274<CChartBar275className="mx-auto"276style={{ height: '40px', width: '80px' }}277data={{278labels: [279'M',280'T',281'W',282'T',283'F',284'S',285'S',286'M',287'T',288'W',289'T',290'F',291'S',292'S',293'M',294],295datasets: [296{297backgroundColor: getStyle('--cui-success'),298borderColor: 'transparent',299borderWidth: 1,300data: [301random(40, 100),302random(40, 100),303random(40, 100),304random(40, 100),305random(40, 100),306random(40, 100),307random(40, 100),308random(40, 100),309random(40, 100),310random(40, 100),311random(40, 100),312random(40, 100),313random(40, 100),314random(40, 100),315random(40, 100),316],317},318],319}}320options={{321maintainAspectRatio: false,322plugins: {323legend: {324display: false,325},326},327scales: {328x: {329display: false,330},331y: {332display: false,333},334},335}}336/>337}338title="title"339value="1,123"340/>341</CCol>342<CCol sm={4} md={3} xl={2}>343<CWidgetStatsE344chart={345<CChartLine346className="mx-auto"347style={{ height: '40px', width: '80px' }}348data={{349labels: [350'M',351'T',352'W',353'T',354'F',355'S',356'S',357'M',358'T',359'W',360'T',361'F',362'S',363'S',364'M',365],366datasets: [367{368backgroundColor: 'transparent',369borderColor: getStyle('--cui-danger'),370borderWidth: 2,371data: [372random(40, 100),373random(40, 100),374random(40, 100),375random(40, 100),376random(40, 100),377random(40, 100),378random(40, 100),379random(40, 100),380random(40, 100),381random(40, 100),382random(40, 100),383random(40, 100),384random(40, 100),385random(40, 100),386random(40, 100),387],388},389],390}}391options={{392maintainAspectRatio: false,393elements: {394line: {395tension: 0.4,396},397point: {398radius: 0,399},400},401plugins: {402legend: {403display: false,404},405},406scales: {407x: {408display: false,409},410y: {411display: false,412},413},414}}415/>416}417title="title"418value="1,123"419/>420</CCol>421<CCol sm={4} md={3} xl={2}>422<CWidgetStatsE423chart={424<CChartLine425className="mx-auto"426style={{ height: '40px', width: '80px' }}427data={{428labels: [429'M',430'T',431'W',432'T',433'F',434'S',435'S',436'M',437'T',438'W',439'T',440'F',441'S',442'S',443'M',444],445datasets: [446{447backgroundColor: 'transparent',448borderColor: getStyle('--cui-success'),449borderWidth: 2,450data: [451random(40, 100),452random(40, 100),453random(40, 100),454random(40, 100),455random(40, 100),456random(40, 100),457random(40, 100),458random(40, 100),459random(40, 100),460random(40, 100),461random(40, 100),462random(40, 100),463random(40, 100),464random(40, 100),465random(40, 100),466],467},468],469}}470options={{471maintainAspectRatio: false,472elements: {473line: {474tension: 0.4,475},476point: {477radius: 0,478},479},480plugins: {481legend: {482display: false,483},484},485scales: {486x: {487display: false,488},489y: {490display: false,491},492},493}}494/>495}496title="title"497value="1,123"498/>499</CCol>500<CCol sm={4} md={3} xl={2}>501<CWidgetStatsE502chart={503<CChartLine504className="mx-auto"505style={{ height: '40px', width: '80px' }}506data={{507labels: [508'M',509'T',510'W',511'T',512'F',513'S',514'S',515'M',516'T',517'W',518'T',519'F',520'S',521'S',522'M',523],524datasets: [525{526backgroundColor: 'transparent',527borderColor: getStyle('--cui-info'),528borderWidth: 2,529data: [530random(40, 100),531random(40, 100),532random(40, 100),533random(40, 100),534random(40, 100),535random(40, 100),536random(40, 100),537random(40, 100),538random(40, 100),539random(40, 100),540random(40, 100),541random(40, 100),542random(40, 100),543random(40, 100),544random(40, 100),545],546},547],548}}549options={{550maintainAspectRatio: false,551elements: {552line: {553tension: 0.4,554},555point: {556radius: 0,557},558},559plugins: {560legend: {561display: false,562},563},564scales: {565x: {566display: false,567},568y: {569display: false,570},571},572}}573/>574}575title="title"576value="1,123"577/>578</CCol>579</CRow>580</DocsExample>581<DocsExample href="components/widgets/#cwidgetstatsf">582<CRow xs={{ gutter: 4 }}>583<CCol xs={12} sm={6} xl={4} xxl={3}>584<CWidgetStatsF585icon={<CIcon width={24} icon={cilSettings} size="xl" />}586title="income"587value="$1.999,50"588color="primary"589/>590</CCol>591<CCol xs={12} sm={6} xl={4} xxl={3}>592<CWidgetStatsF593icon={<CIcon width={24} icon={cilUser} size="xl" />}594title="income"595value="$1.999,50"596color="info"597/>598</CCol>599<CCol xs={12} sm={6} xl={4} xxl={3}>600<CWidgetStatsF601icon={<CIcon width={24} icon={cilMoon} size="xl" />}602title="income"603value="$1.999,50"604color="warning"605/>606</CCol>607<CCol xs={12} sm={6} xl={4} xxl={3}>608<CWidgetStatsF609icon={<CIcon width={24} icon={cilBell} size="xl" />}610title="income"611value="$1.999,50"612color="danger"613/>614</CCol>615</CRow>616</DocsExample>617<DocsExample href="components/widgets/#cwidgetstatsf">618<CRow xs={{ gutter: 4 }}>619<CCol xs={12} sm={6} xl={4} xxl={3}>620<CWidgetStatsF621icon={<CIcon width={24} icon={cilSettings} size="xl" />}622title="income"623value="$1.999,50"624color="primary"625footer={626<CLink627className="font-weight-bold font-xs text-body-secondary"628href="https://coreui.io/"629rel="noopener norefferer"630target="_blank"631>632View more
633<CIcon icon={cilArrowRight} className="float-end" width={16} />634</CLink>635}636/>637</CCol>638<CCol xs={12} sm={6} xl={4} xxl={3}>639<CWidgetStatsF640icon={<CIcon width={24} icon={cilLaptop} size="xl" />}641title="income"642value="$1.999,50"643color="info"644footer={645<CLink646className="font-weight-bold font-xs text-body-secondary"647href="https://coreui.io/"648rel="noopener norefferer"649target="_blank"650>651View more
652<CIcon icon={cilArrowRight} className="float-end" width={16} />653</CLink>654}655/>656</CCol>657<CCol xs={12} sm={6} xl={4} xxl={3}>658<CWidgetStatsF659icon={<CIcon width={24} icon={cilMoon} size="xl" />}660title="income"661value="$1.999,50"662color="warning"663footer={664<CLink665className="font-weight-bold font-xs text-body-secondary"666href="https://coreui.io/"667rel="noopener norefferer"668target="_blank"669>670View more
671<CIcon icon={cilArrowRight} className="float-end" width={16} />672</CLink>673}674/>675</CCol>676<CCol xs={12} sm={6} xl={4} xxl={3}>677<CWidgetStatsF678icon={<CIcon width={24} icon={cilBell} size="xl" />}679title="income"680value="$1.999,50"681color="danger"682footer={683<CLink684className="font-weight-bold font-xs text-body-secondary"685href="https://coreui.io/"686rel="noopener norefferer"687target="_blank"688>689View more
690<CIcon icon={cilArrowRight} className="float-end" width={16} />691</CLink>692}693/>694</CCol>695</CRow>696</DocsExample>697<DocsExample href="components/widgets/#cwidgetstatsf">698<CRow xs={{ gutter: 4 }}>699<CCol xs={12} sm={6} xl={4} xxl={3}>700<CWidgetStatsF701icon={<CIcon width={24} icon={cilSettings} size="xl" />}702padding={false}703title="income"704value="$1.999,50"705color="primary"706/>707</CCol>708<CCol xs={12} sm={6} xl={4} xxl={3}>709<CWidgetStatsF710icon={<CIcon width={24} icon={cilUser} size="xl" />}711padding={false}712title="income"713value="$1.999,50"714color="info"715/>716</CCol>717<CCol xs={12} sm={6} xl={4} xxl={3}>718<CWidgetStatsF719icon={<CIcon width={24} icon={cilMoon} size="xl" />}720padding={false}721title="income"722value="$1.999,50"723color="warning"724/>725</CCol>726<CCol xs={12} sm={6} xl={4} xxl={3}>727<CWidgetStatsF728icon={<CIcon width={24} icon={cilBell} size="xl" />}729padding={false}730title="income"731value="$1.999,50"732color="danger"733/>734</CCol>735</CRow>736</DocsExample>737<DocsExample href="components/widgets/#cwidgetstatsd">738<WidgetsBrand />739</DocsExample>740<DocsExample href="components/widgets/#cwidgetstatsd">741<WidgetsBrand withCharts />742</DocsExample>743<DocsExample href="components/widgets/#cwidgetstatsc">744<CCardGroup className="mb-4">745<CWidgetStatsC746icon={<CIcon icon={cilPeople} height={36} />}747value="87.500"748title="Visitors"749progress={{ color: 'info', value: 75 }}750/>751<CWidgetStatsC752icon={<CIcon icon={cilUserFollow} height={36} />}753value="385"754title="New Clients"755progress={{ color: 'success', value: 75 }}756/>757<CWidgetStatsC758icon={<CIcon icon={cilBasket} height={36} />}759value="1238"760title="Products sold"761progress={{ color: 'warning', value: 75 }}762/>763<CWidgetStatsC764icon={<CIcon icon={cilChartPie} height={36} />}765value="28%"766title="Returning Visitors"767progress={{ color: 'primary', value: 75 }}768/>769<CWidgetStatsC770icon={<CIcon icon={cilSpeedometer} height={36} />}771value="5:34:11"772title="Avg. Time"773progress={{ color: 'danger', value: 75 }}774/>775</CCardGroup>776</DocsExample>777<DocsExample href="components/widgets/#cwidgetstatsc">778<CRow xs={{ gutter: 4 }}>779<CCol xs={6} lg={4} xxl={2}>780<CWidgetStatsC781icon={<CIcon icon={cilPeople} height={36} />}782value="87.500"783title="Visitors"784progress={{ color: 'info', value: 75 }}785/>786</CCol>787<CCol xs={6} lg={4} xxl={2}>788<CWidgetStatsC789icon={<CIcon icon={cilUserFollow} height={36} />}790value="385"791title="New Clients"792progress={{ color: 'success', value: 75 }}793/>794</CCol>795<CCol xs={6} lg={4} xxl={2}>796<CWidgetStatsC797icon={<CIcon icon={cilBasket} height={36} />}798value="1238"799title="Products sold"800progress={{ color: 'warning', value: 75 }}801/>802</CCol>803<CCol xs={6} lg={4} xxl={2}>804<CWidgetStatsC805icon={<CIcon icon={cilChartPie} height={36} />}806value="28%"807title="Returning Visitors"808progress={{ color: 'primary', value: 75 }}809/>810</CCol>811<CCol xs={6} lg={4} xxl={2}>812<CWidgetStatsC813icon={<CIcon icon={cilSpeedometer} height={36} />}814value="5:34:11"815title="Avg. Time"816progress={{ color: 'danger', value: 75 }}817/>818</CCol>819<CCol xs={6} lg={4} xxl={2}>820<CWidgetStatsC821icon={<CIcon icon={cilSpeech} height={36} />}822value="972"823title="Comments"824progress={{ color: 'info', value: 75 }}825/>826</CCol>827</CRow>828</DocsExample>829<DocsExample href="components/widgets/#cwidgetstatsc">830<CRow xs={{ gutter: 4 }}>831<CCol xs={6} lg={4} xxl={2}>832<CWidgetStatsC833color="info"834icon={<CIcon icon={cilPeople} height={36} />}835value="87.500"836title="Visitors"837inverse
838progress={{ value: 75 }}839/>840</CCol>841<CCol xs={6} lg={4} xxl={2}>842<CWidgetStatsC843color="success"844icon={<CIcon icon={cilUserFollow} height={36} />}845value="385"846title="New Clients"847inverse
848progress={{ value: 75 }}849/>850</CCol>851<CCol xs={6} lg={4} xxl={2}>852<CWidgetStatsC853color="warning"854icon={<CIcon icon={cilBasket} height={36} />}855value="1238"856title="Products sold"857inverse
858progress={{ value: 75 }}859/>860</CCol>861<CCol xs={6} lg={4} xxl={2}>862<CWidgetStatsC863color="primary"864icon={<CIcon icon={cilChartPie} height={36} />}865value="28%"866title="Returning Visitors"867inverse
868progress={{ value: 75 }}869/>870</CCol>871<CCol xs={6} lg={4} xxl={2}>872<CWidgetStatsC873color="danger"874icon={<CIcon icon={cilSpeedometer} height={36} />}875value="5:34:11"876title="Avg. Time"877inverse
878progress={{ value: 75 }}879/>880</CCol>881<CCol xs={6} lg={4} xxl={2}>882<CWidgetStatsC883color="info"884icon={<CIcon icon={cilSpeech} height={36} />}885value="972"886title="Comments"887inverse
888progress={{ value: 75 }}889/>890</CCol>891</CRow>892</DocsExample>893</CCardBody>894</CCard>895)896}
897
898export default Widgets899