Skip to content

Commit

Permalink
refactor: improve responsive behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
mrholek committed Nov 15, 2023
1 parent 8f55012 commit f8d4f9f
Show file tree
Hide file tree
Showing 6 changed files with 123 additions and 151 deletions.
2 changes: 1 addition & 1 deletion src/components/AppContent.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import routes from '../routes'

const AppContent = () => {
return (
<CContainer class="px-4" lg>
<CContainer className="px-4" lg>
<Suspense fallback={<CSpinner color="primary" />}>
<Routes>
{routes.map((route, idx) => {
Expand Down
76 changes: 43 additions & 33 deletions src/views/dashboard/Dashboard.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React from 'react'
import classNames from 'classnames'

import {
CAvatar,
Expand Down Expand Up @@ -90,12 +91,12 @@ const Dashboard = () => {
user: {
name: 'Yiorgos Avraamu',
new: true,
registered: 'Jan 1, 2021',
registered: 'Jan 1, 2023',
},
country: { name: 'USA', flag: cifUs },
usage: {
value: 50,
period: 'Jun 11, 2021 - Jul 10, 2021',
period: 'Jun 11, 2023 - Jul 10, 2023',
color: 'success',
},
payment: { name: 'Mastercard', icon: cibCcMastercard },
Expand All @@ -106,36 +107,36 @@ const Dashboard = () => {
user: {
name: 'Avram Tarasios',
new: false,
registered: 'Jan 1, 2021',
registered: 'Jan 1, 2023',
},
country: { name: 'Brazil', flag: cifBr },
usage: {
value: 22,
period: 'Jun 11, 2021 - Jul 10, 2021',
period: 'Jun 11, 2023 - Jul 10, 2023',
color: 'info',
},
payment: { name: 'Visa', icon: cibCcVisa },
activity: '5 minutes ago',
},
{
avatar: { src: avatar3, status: 'warning' },
user: { name: 'Quintin Ed', new: true, registered: 'Jan 1, 2021' },
user: { name: 'Quintin Ed', new: true, registered: 'Jan 1, 2023' },
country: { name: 'India', flag: cifIn },
usage: {
value: 74,
period: 'Jun 11, 2021 - Jul 10, 2021',
period: 'Jun 11, 2023 - Jul 10, 2023',
color: 'warning',
},
payment: { name: 'Stripe', icon: cibCcStripe },
activity: '1 hour ago',
},
{
avatar: { src: avatar4, status: 'secondary' },
user: { name: 'Enéas Kwadwo', new: true, registered: 'Jan 1, 2021' },
user: { name: 'Enéas Kwadwo', new: true, registered: 'Jan 1, 2023' },
country: { name: 'France', flag: cifFr },
usage: {
value: 98,
period: 'Jun 11, 2021 - Jul 10, 2021',
period: 'Jun 11, 2023 - Jul 10, 2023',
color: 'danger',
},
payment: { name: 'PayPal', icon: cibCcPaypal },
Expand All @@ -146,12 +147,12 @@ const Dashboard = () => {
user: {
name: 'Agapetus Tadeáš',
new: true,
registered: 'Jan 1, 2021',
registered: 'Jan 1, 2023',
},
country: { name: 'Spain', flag: cifEs },
usage: {
value: 22,
period: 'Jun 11, 2021 - Jul 10, 2021',
period: 'Jun 11, 2023 - Jul 10, 2023',
color: 'primary',
},
payment: { name: 'Google Wallet', icon: cibCcApplePay },
Expand All @@ -162,12 +163,12 @@ const Dashboard = () => {
user: {
name: 'Friderik Dávid',
new: true,
registered: 'Jan 1, 2021',
registered: 'Jan 1, 2023',
},
country: { name: 'Poland', flag: cifPl },
usage: {
value: 43,
period: 'Jun 11, 2021 - Jul 10, 2021',
period: 'Jun 11, 2023 - Jul 10, 2023',
color: 'success',
},
payment: { name: 'Amex', icon: cibCcAmex },
Expand All @@ -177,15 +178,15 @@ const Dashboard = () => {

return (
<>
<WidgetsDropdown />
<WidgetsDropdown className="mb-4" />
<CCard className="mb-4">
<CCardBody>
<CRow>
<CCol sm={5}>
<h4 id="traffic" className="card-title mb-0">
Traffic
</h4>
<div className="small text-body-secondary">January - July 2021</div>
<div className="small text-body-secondary">January - July 2023</div>
</CCol>
<CCol sm={7} className="d-none d-md-block">
<CButton color="primary" className="float-end">
Expand All @@ -208,22 +209,31 @@ const Dashboard = () => {
<MainChart />
</CCardBody>
<CCardFooter>
<CRow xs={{ cols: 1 }} md={{ cols: 5 }} className="text-center">
{progressExample.map((item, index) => (
<CCol className="mb-sm-2 mb-0" key={index}>
<CRow
xs={{ cols: 1, gutter: 4 }}
sm={{ cols: 2 }}
lg={{ cols: 4 }}
xl={{ cols: 5 }}
className="mb-2 text-center"
>
{progressExample.map((item, index, items) => (
<CCol
className={classNames({
'd-none d-xl-block': index + 1 === items.length,
})}
key={index}
>
<div className="text-body-secondary">{item.title}</div>
<strong>
<div className="fw-semibold text-truncate">
{item.value} ({item.percent}%)
</strong>
</div>
<CProgress thin className="mt-2" color={item.color} value={item.percent} />
</CCol>
))}
</CRow>
</CCardFooter>
</CCard>

<WidgetsBrand withCharts />

<WidgetsBrand className="mb-4" withCharts />
<CRow>
<CCol xs>
<CCard className="mb-4">
Expand All @@ -232,20 +242,21 @@ const Dashboard = () => {
<CRow>
<CCol xs={12} md={6} xl={6}>
<CRow>
<CCol sm={6}>
<CCol xs={6}>
<div className="border-start border-start-4 border-start-info py-1 px-3">
<div className="text-body-secondary small">New Clients</div>
<div className="text-body-secondary text-truncate xsall">New Clients</div>
<div className="fs-5 fw-semibold">9,123</div>
</div>
</CCol>
<CCol sm={6}>
<CCol xs={6}>
<div className="border-start border-start-4 border-start-danger py-1 px-3 mb-3">
<div className="text-body-secondary small">Recurring Clients</div>
<div className="text-body-secondary text-truncate small">
Recurring Clients
</div>
<div className="fs-5 fw-semibold">22,643</div>
</div>
</CCol>
</CRow>

<hr className="mt-0" />
{progressGroupExample1.map((item, index) => (
<div className="progress-group mb-4" key={index}>
Expand All @@ -259,18 +270,17 @@ const Dashboard = () => {
</div>
))}
</CCol>

<CCol xs={12} md={6} xl={6}>
<CRow>
<CCol sm={6}>
<CCol xs={6}>
<div className="border-start border-start-4 border-start-warning py-1 px-3 mb-3">
<div className="text-body-secondary small">Pageviews</div>
<div className="text-body-secondary text-truncate small">Pageviews</div>
<div className="fs-5 fw-semibold">78,623</div>
</div>
</CCol>
<CCol sm={6}>
<CCol xs={6}>
<div className="border-start border-start-4 border-start-success py-1 px-3 mb-3">
<div className="text-body-secondary small">Organic</div>
<div className="text-body-secondary text-truncate small">Organic</div>
<div className="fs-5 fw-semibold">49,123</div>
</div>
</CCol>
Expand Down Expand Up @@ -314,7 +324,7 @@ const Dashboard = () => {
<br />

<CTable align="middle" className="mb-0 border" hover responsive>
<CTableHead>
<CTableHead className="text-nowrap">
<CTableRow>
<CTableHeaderCell className="bg-body-tertiary text-center">
<CIcon icon={cilPeople} />
Expand Down
2 changes: 1 addition & 1 deletion src/views/theme/colors/Colors.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import PropTypes from 'prop-types'
import React, { useEffect, useState, createRef } from 'react'
import PropTypes from 'prop-types'
import classNames from 'classnames'
import { CRow, CCol, CCard, CCardHeader, CCardBody } from '@coreui/react'
import { rgbToHex } from '@coreui/utils'
Expand Down
Loading

0 comments on commit f8d4f9f

Please sign in to comment.