Skip to content

Commit f8d4f9f

Browse files
committed
refactor: improve responsive behavior
1 parent 8f55012 commit f8d4f9f

File tree

6 files changed

+123
-151
lines changed

6 files changed

+123
-151
lines changed

src/components/AppContent.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import routes from '../routes'
77

88
const AppContent = () => {
99
return (
10-
<CContainer class="px-4" lg>
10+
<CContainer className="px-4" lg>
1111
<Suspense fallback={<CSpinner color="primary" />}>
1212
<Routes>
1313
{routes.map((route, idx) => {

src/views/dashboard/Dashboard.js

Lines changed: 43 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import React from 'react'
2+
import classNames from 'classnames'
23

34
import {
45
CAvatar,
@@ -90,12 +91,12 @@ const Dashboard = () => {
9091
user: {
9192
name: 'Yiorgos Avraamu',
9293
new: true,
93-
registered: 'Jan 1, 2021',
94+
registered: 'Jan 1, 2023',
9495
},
9596
country: { name: 'USA', flag: cifUs },
9697
usage: {
9798
value: 50,
98-
period: 'Jun 11, 2021 - Jul 10, 2021',
99+
period: 'Jun 11, 2023 - Jul 10, 2023',
99100
color: 'success',
100101
},
101102
payment: { name: 'Mastercard', icon: cibCcMastercard },
@@ -106,36 +107,36 @@ const Dashboard = () => {
106107
user: {
107108
name: 'Avram Tarasios',
108109
new: false,
109-
registered: 'Jan 1, 2021',
110+
registered: 'Jan 1, 2023',
110111
},
111112
country: { name: 'Brazil', flag: cifBr },
112113
usage: {
113114
value: 22,
114-
period: 'Jun 11, 2021 - Jul 10, 2021',
115+
period: 'Jun 11, 2023 - Jul 10, 2023',
115116
color: 'info',
116117
},
117118
payment: { name: 'Visa', icon: cibCcVisa },
118119
activity: '5 minutes ago',
119120
},
120121
{
121122
avatar: { src: avatar3, status: 'warning' },
122-
user: { name: 'Quintin Ed', new: true, registered: 'Jan 1, 2021' },
123+
user: { name: 'Quintin Ed', new: true, registered: 'Jan 1, 2023' },
123124
country: { name: 'India', flag: cifIn },
124125
usage: {
125126
value: 74,
126-
period: 'Jun 11, 2021 - Jul 10, 2021',
127+
period: 'Jun 11, 2023 - Jul 10, 2023',
127128
color: 'warning',
128129
},
129130
payment: { name: 'Stripe', icon: cibCcStripe },
130131
activity: '1 hour ago',
131132
},
132133
{
133134
avatar: { src: avatar4, status: 'secondary' },
134-
user: { name: 'Enéas Kwadwo', new: true, registered: 'Jan 1, 2021' },
135+
user: { name: 'Enéas Kwadwo', new: true, registered: 'Jan 1, 2023' },
135136
country: { name: 'France', flag: cifFr },
136137
usage: {
137138
value: 98,
138-
period: 'Jun 11, 2021 - Jul 10, 2021',
139+
period: 'Jun 11, 2023 - Jul 10, 2023',
139140
color: 'danger',
140141
},
141142
payment: { name: 'PayPal', icon: cibCcPaypal },
@@ -146,12 +147,12 @@ const Dashboard = () => {
146147
user: {
147148
name: 'Agapetus Tadeáš',
148149
new: true,
149-
registered: 'Jan 1, 2021',
150+
registered: 'Jan 1, 2023',
150151
},
151152
country: { name: 'Spain', flag: cifEs },
152153
usage: {
153154
value: 22,
154-
period: 'Jun 11, 2021 - Jul 10, 2021',
155+
period: 'Jun 11, 2023 - Jul 10, 2023',
155156
color: 'primary',
156157
},
157158
payment: { name: 'Google Wallet', icon: cibCcApplePay },
@@ -162,12 +163,12 @@ const Dashboard = () => {
162163
user: {
163164
name: 'Friderik Dávid',
164165
new: true,
165-
registered: 'Jan 1, 2021',
166+
registered: 'Jan 1, 2023',
166167
},
167168
country: { name: 'Poland', flag: cifPl },
168169
usage: {
169170
value: 43,
170-
period: 'Jun 11, 2021 - Jul 10, 2021',
171+
period: 'Jun 11, 2023 - Jul 10, 2023',
171172
color: 'success',
172173
},
173174
payment: { name: 'Amex', icon: cibCcAmex },
@@ -177,15 +178,15 @@ const Dashboard = () => {
177178

178179
return (
179180
<>
180-
<WidgetsDropdown />
181+
<WidgetsDropdown className="mb-4" />
181182
<CCard className="mb-4">
182183
<CCardBody>
183184
<CRow>
184185
<CCol sm={5}>
185186
<h4 id="traffic" className="card-title mb-0">
186187
Traffic
187188
</h4>
188-
<div className="small text-body-secondary">January - July 2021</div>
189+
<div className="small text-body-secondary">January - July 2023</div>
189190
</CCol>
190191
<CCol sm={7} className="d-none d-md-block">
191192
<CButton color="primary" className="float-end">
@@ -208,22 +209,31 @@ const Dashboard = () => {
208209
<MainChart />
209210
</CCardBody>
210211
<CCardFooter>
211-
<CRow xs={{ cols: 1 }} md={{ cols: 5 }} className="text-center">
212-
{progressExample.map((item, index) => (
213-
<CCol className="mb-sm-2 mb-0" key={index}>
212+
<CRow
213+
xs={{ cols: 1, gutter: 4 }}
214+
sm={{ cols: 2 }}
215+
lg={{ cols: 4 }}
216+
xl={{ cols: 5 }}
217+
className="mb-2 text-center"
218+
>
219+
{progressExample.map((item, index, items) => (
220+
<CCol
221+
className={classNames({
222+
'd-none d-xl-block': index + 1 === items.length,
223+
})}
224+
key={index}
225+
>
214226
<div className="text-body-secondary">{item.title}</div>
215-
<strong>
227+
<div className="fw-semibold text-truncate">
216228
{item.value} ({item.percent}%)
217-
</strong>
229+
</div>
218230
<CProgress thin className="mt-2" color={item.color} value={item.percent} />
219231
</CCol>
220232
))}
221233
</CRow>
222234
</CCardFooter>
223235
</CCard>
224-
225-
<WidgetsBrand withCharts />
226-
236+
<WidgetsBrand className="mb-4" withCharts />
227237
<CRow>
228238
<CCol xs>
229239
<CCard className="mb-4">
@@ -232,20 +242,21 @@ const Dashboard = () => {
232242
<CRow>
233243
<CCol xs={12} md={6} xl={6}>
234244
<CRow>
235-
<CCol sm={6}>
245+
<CCol xs={6}>
236246
<div className="border-start border-start-4 border-start-info py-1 px-3">
237-
<div className="text-body-secondary small">New Clients</div>
247+
<div className="text-body-secondary text-truncate xsall">New Clients</div>
238248
<div className="fs-5 fw-semibold">9,123</div>
239249
</div>
240250
</CCol>
241-
<CCol sm={6}>
251+
<CCol xs={6}>
242252
<div className="border-start border-start-4 border-start-danger py-1 px-3 mb-3">
243-
<div className="text-body-secondary small">Recurring Clients</div>
253+
<div className="text-body-secondary text-truncate small">
254+
Recurring Clients
255+
</div>
244256
<div className="fs-5 fw-semibold">22,643</div>
245257
</div>
246258
</CCol>
247259
</CRow>
248-
249260
<hr className="mt-0" />
250261
{progressGroupExample1.map((item, index) => (
251262
<div className="progress-group mb-4" key={index}>
@@ -259,18 +270,17 @@ const Dashboard = () => {
259270
</div>
260271
))}
261272
</CCol>
262-
263273
<CCol xs={12} md={6} xl={6}>
264274
<CRow>
265-
<CCol sm={6}>
275+
<CCol xs={6}>
266276
<div className="border-start border-start-4 border-start-warning py-1 px-3 mb-3">
267-
<div className="text-body-secondary small">Pageviews</div>
277+
<div className="text-body-secondary text-truncate small">Pageviews</div>
268278
<div className="fs-5 fw-semibold">78,623</div>
269279
</div>
270280
</CCol>
271-
<CCol sm={6}>
281+
<CCol xs={6}>
272282
<div className="border-start border-start-4 border-start-success py-1 px-3 mb-3">
273-
<div className="text-body-secondary small">Organic</div>
283+
<div className="text-body-secondary text-truncate small">Organic</div>
274284
<div className="fs-5 fw-semibold">49,123</div>
275285
</div>
276286
</CCol>
@@ -314,7 +324,7 @@ const Dashboard = () => {
314324
<br />
315325

316326
<CTable align="middle" className="mb-0 border" hover responsive>
317-
<CTableHead>
327+
<CTableHead className="text-nowrap">
318328
<CTableRow>
319329
<CTableHeaderCell className="bg-body-tertiary text-center">
320330
<CIcon icon={cilPeople} />

src/views/theme/colors/Colors.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import PropTypes from 'prop-types'
21
import React, { useEffect, useState, createRef } from 'react'
2+
import PropTypes from 'prop-types'
33
import classNames from 'classnames'
44
import { CRow, CCol, CCard, CCardHeader, CCardBody } from '@coreui/react'
55
import { rgbToHex } from '@coreui/utils'

0 commit comments

Comments
 (0)