From f8d4f9f0c6427c79708236a346488d4a34b1f970 Mon Sep 17 00:00:00 2001 From: mrholek Date: Wed, 15 Nov 2023 11:31:41 +0100 Subject: [PATCH] refactor: improve responsive behavior --- src/components/AppContent.js | 2 +- src/views/dashboard/Dashboard.js | 76 ++++++++------ src/views/theme/colors/Colors.js | 2 +- src/views/widgets/Widgets.js | 146 ++++++++++----------------- src/views/widgets/WidgetsBrand.js | 25 ++--- src/views/widgets/WidgetsDropdown.js | 23 +++-- 6 files changed, 123 insertions(+), 151 deletions(-) diff --git a/src/components/AppContent.js b/src/components/AppContent.js index b72cc6bd6..b9a39ef50 100644 --- a/src/components/AppContent.js +++ b/src/components/AppContent.js @@ -7,7 +7,7 @@ import routes from '../routes' const AppContent = () => { return ( - + }> {routes.map((route, idx) => { diff --git a/src/views/dashboard/Dashboard.js b/src/views/dashboard/Dashboard.js index da59f7818..5b0b61041 100644 --- a/src/views/dashboard/Dashboard.js +++ b/src/views/dashboard/Dashboard.js @@ -1,4 +1,5 @@ import React from 'react' +import classNames from 'classnames' import { CAvatar, @@ -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 }, @@ -106,12 +107,12 @@ 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 }, @@ -119,11 +120,11 @@ const Dashboard = () => { }, { 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 }, @@ -131,11 +132,11 @@ const Dashboard = () => { }, { 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 }, @@ -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 }, @@ -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 }, @@ -177,7 +178,7 @@ const Dashboard = () => { return ( <> - + @@ -185,7 +186,7 @@ const Dashboard = () => {

Traffic

-
January - July 2021
+
January - July 2023
@@ -208,22 +209,31 @@ const Dashboard = () => {
- - {progressExample.map((item, index) => ( - + + {progressExample.map((item, index, items) => ( +
{item.title}
- +
{item.value} ({item.percent}%) - +
))}
- - - + @@ -232,20 +242,21 @@ const Dashboard = () => { - +
-
New Clients
+
New Clients
9,123
- +
-
Recurring Clients
+
+ Recurring Clients +
22,643
-
{progressGroupExample1.map((item, index) => (
@@ -259,18 +270,17 @@ const Dashboard = () => {
))}
- - +
-
Pageviews
+
Pageviews
78,623
- +
-
Organic
+
Organic
49,123
@@ -314,7 +324,7 @@ const Dashboard = () => {
- + diff --git a/src/views/theme/colors/Colors.js b/src/views/theme/colors/Colors.js index 4a1570353..ef844e163 100644 --- a/src/views/theme/colors/Colors.js +++ b/src/views/theme/colors/Colors.js @@ -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' diff --git a/src/views/widgets/Widgets.js b/src/views/widgets/Widgets.js index c6be871f6..a9bf51e12 100644 --- a/src/views/widgets/Widgets.js +++ b/src/views/widgets/Widgets.js @@ -41,41 +41,37 @@ const Widgets = () => { Widgets - + - - - + + + - + - + - + { - - - + + + { text="Lorem ipsum dolor sit amet enim." /> - + { text="Lorem ipsum dolor sit amet enim." /> - + { text="Lorem ipsum dolor sit amet enim." /> - + { - - + + { }} /> } - className="mb-4" title="title" value="1,123" /> @@ -273,7 +264,6 @@ const Widgets = () => { }} /> } - className="mb-4" title="title" value="1,123" /> @@ -345,7 +335,6 @@ const Widgets = () => { }} /> } - className="mb-4" title="title" value="1,123" /> @@ -425,7 +414,6 @@ const Widgets = () => { }} /> } - className="mb-4" title="title" value="1,123" /> @@ -505,7 +493,6 @@ const Widgets = () => { }} /> } - className="mb-4" title="title" value="1,123" /> @@ -585,45 +572,40 @@ const Widgets = () => { }} /> } - className="mb-4" title="title" value="1,123" /> - - - + + + } title="income" value="$1.999,50" color="primary" /> - + } title="income" value="$1.999,50" color="info" /> - + } title="income" value="$1.999,50" color="warning" /> - + } title="income" value="$1.999,50" @@ -632,11 +614,10 @@ const Widgets = () => { - - - + + + } title="income" value="$1.999,50" @@ -654,9 +635,8 @@ const Widgets = () => { } /> - + } title="income" value="$1.999,50" @@ -674,9 +654,8 @@ const Widgets = () => { } /> - + } title="income" value="$1.999,50" @@ -694,9 +673,8 @@ const Widgets = () => { } /> - + } title="income" value="$1.999,50" @@ -716,11 +694,10 @@ const Widgets = () => { - - - + + + } padding={false} title="income" @@ -728,9 +705,8 @@ const Widgets = () => { color="primary" /> - + } padding={false} title="income" @@ -738,9 +714,8 @@ const Widgets = () => { color="info" /> - + } padding={false} title="income" @@ -748,9 +723,8 @@ const Widgets = () => { color="warning" /> - + } padding={false} title="income" @@ -760,13 +734,13 @@ const Widgets = () => { - + - + - + } @@ -800,67 +774,61 @@ const Widgets = () => { /> - - - + + + } value="87.500" title="Visitors" progress={{ color: 'info', value: 75 }} - className="mb-4" /> - + } value="385" title="New Clients" progress={{ color: 'success', value: 75 }} - className="mb-4" /> - + } value="1238" title="Products sold" progress={{ color: 'warning', value: 75 }} - className="mb-4" /> - + } value="28%" title="Returning Visitors" progress={{ color: 'primary', value: 75 }} - className="mb-4" /> - + } value="5:34:11" title="Avg. Time" progress={{ color: 'danger', value: 75 }} - className="mb-4" /> - + } value="972" - title="comments" + title="Comments" progress={{ color: 'info', value: 75 }} - className="mb-4" /> - - - + + + } @@ -868,10 +836,9 @@ const Widgets = () => { title="Visitors" inverse progress={{ value: 75 }} - className="mb-4" /> - + } @@ -879,10 +846,9 @@ const Widgets = () => { title="New Clients" inverse progress={{ value: 75 }} - className="mb-4" /> - + } @@ -890,10 +856,9 @@ const Widgets = () => { title="Products sold" inverse progress={{ value: 75 }} - className="mb-4" /> - + } @@ -901,10 +866,9 @@ const Widgets = () => { title="Returning Visitors" inverse progress={{ value: 75 }} - className="mb-4" /> - + } @@ -912,18 +876,16 @@ const Widgets = () => { title="Avg. Time" inverse progress={{ value: 75 }} - className="mb-4" /> - + } value="972" - title="comments" + title="Comments" inverse progress={{ value: 75 }} - className="mb-4" /> diff --git a/src/views/widgets/WidgetsBrand.js b/src/views/widgets/WidgetsBrand.js index b5eb528ac..f09393aae 100644 --- a/src/views/widgets/WidgetsBrand.js +++ b/src/views/widgets/WidgetsBrand.js @@ -5,7 +5,7 @@ import CIcon from '@coreui/icons-react' import { cibFacebook, cibLinkedin, cibTwitter, cilCalendar } from '@coreui/icons' import { CChart } from '@coreui/react-chartjs' -const WidgetsBrand = ({ withCharts }) => { +const WidgetsBrand = (props) => { const chartOptions = { elements: { line: { @@ -35,11 +35,10 @@ const WidgetsBrand = ({ withCharts }) => { } return ( - - + + { /> - + { /> - + { /> - + { } WidgetsBrand.propTypes = { + className: PropTypes.string, withCharts: PropTypes.bool, } diff --git a/src/views/widgets/WidgetsDropdown.js b/src/views/widgets/WidgetsDropdown.js index ed4174b23..85e2fc969 100644 --- a/src/views/widgets/WidgetsDropdown.js +++ b/src/views/widgets/WidgetsDropdown.js @@ -1,4 +1,6 @@ import React, { useEffect, useRef } from 'react' +import PropTypes from 'prop-types' + import { CRow, CCol, @@ -13,7 +15,7 @@ import { CChartBar, CChartLine } from '@coreui/react-chartjs' import CIcon from '@coreui/icons-react' import { cilArrowBottom, cilArrowTop, cilOptions } from '@coreui/icons' -const WidgetsDropdown = () => { +const WidgetsDropdown = (props) => { const widgetChartRef1 = useRef(null) const widgetChartRef2 = useRef(null) @@ -36,10 +38,9 @@ const WidgetsDropdown = () => { }, [widgetChartRef1, widgetChartRef2]) return ( - - + + @@ -128,9 +129,8 @@ const WidgetsDropdown = () => { } /> - + @@ -218,9 +218,8 @@ const WidgetsDropdown = () => { } /> - + @@ -291,9 +290,8 @@ const WidgetsDropdown = () => { } /> - + @@ -390,4 +388,9 @@ const WidgetsDropdown = () => { ) } +WidgetsDropdown.propTypes = { + className: PropTypes.string, + withCharts: PropTypes.bool, +} + export default WidgetsDropdown