Skip to content

Commit

Permalink
Merge pull request #36 from CristianF09/statistics-responsive
Browse files Browse the repository at this point in the history
update responsive statistics
  • Loading branch information
Miro-wq authored Nov 7, 2024
2 parents b0b02b1 + 985be16 commit d42628b
Show file tree
Hide file tree
Showing 10 changed files with 62 additions and 31 deletions.
1 change: 1 addition & 0 deletions src/Pages/DashboardPage/DashboardPage.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
min-height: calc(100dvh - 104px);
padding-left: 32px;
padding-right: 32px;
overflow: auto;
}

.sharedSectionElements {
Expand Down
20 changes: 19 additions & 1 deletion src/Pages/Statistics/Statistics.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,22 @@
top: 7em;
display: flex;
gap: 3em;
}
}

@media screen and (max-width: 1280px) {
.staticAll {
position: relative;
gap: 4em;
justify-content: center;
width: 100vw;
}
}

@media screen and (max-width: 768px) {
.staticAll {
position: relative;
flex-direction: column;
align-items: center;
top: 40px;
}
}
3 changes: 2 additions & 1 deletion src/components/Chart/Chart.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { Doughnut } from 'react-chartjs-2';
import { Chart as ChartJS, ArcElement, Tooltip, Legend } from 'chart.js';
import { selectExpensesByCategory } from '../../redux/selectors/transactionsSelector';
import { getUserInfo } from '../../redux/operations/authOperations';
import styles from './Chart.module.css';

ChartJS.register(ArcElement, Tooltip, Legend);

Expand Down Expand Up @@ -66,7 +67,7 @@ const Chart = () => {
};

return (
<div style={{ position: 'relative', width: '300px', height: '300px' }}>
<div className={styles.chartContainer}>
<Doughnut data={data} options={options} />
<div
style={{
Expand Down
21 changes: 21 additions & 0 deletions src/components/Chart/Chart.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
.chartContainer {
width: 300px;
height: 300px;
position: relative;
}

@media screen and (max-width: 1280px) {
.chartContainer {
width: 400px;
height: 400px;
position: relative;
}
}

@media screen and (max-width: 768px) {
.chartContainer {
width: 300px;
height: 300px;
position: relative;
}
}
1 change: 0 additions & 1 deletion src/components/Chart/Chart.modules.css

This file was deleted.

6 changes: 6 additions & 0 deletions src/components/CustomDropdown/CustomDropdown.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,9 @@
background-color: #5a5a6e;
border-radius: 8px;
}

@media screen and (max-width: 768px) {
.dropdown {
width: 20em;
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* DashboardComponent.module.css */
.mainDiv {
/* .mainDiv {
display: flex;
flex-direction: column;
gap: 20px;
Expand Down Expand Up @@ -27,4 +27,4 @@
max-width: 213px;
gap: 32px;
}
}
} */
3 changes: 2 additions & 1 deletion src/components/StatisticsDashboard/StatisticsDashboard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
setSelectedMonth,
setSelectedYear,
} from '../../redux/Statistics/slice';
import styles from './StatisticsDashboard.module.css';

const StatisticsDashboard = () => {
const dispatch = useDispatch();
Expand Down Expand Up @@ -53,7 +54,7 @@ const StatisticsDashboard = () => {
};

return (
<div style={{ display: 'flex', gap: '20px' }}>
<div className={styles.statisticsDashboard}>
<CustomDropdown
options={months}
selectedValue={selectedMonth}
Expand Down
31 changes: 6 additions & 25 deletions src/components/StatisticsDashboard/StatisticsDashboard.module.css
Original file line number Diff line number Diff line change
@@ -1,30 +1,11 @@
.chartContainer {
width: 100%;
height: 400px;
padding: 20px;
background-color: #f9f9f9;
border-radius: 8px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
.statisticsDashboard {
display: flex;
justify-content: center;
align-items: center;
gap: 20px;
}

.chartTitle {
text-align: center;
font-size: 1.5em;
margin-bottom: 20px;
color: #333;
}

.chartError {
color: red;
font-weight: bold;
text-align: center;
@media screen and (max-width: 768px) {
.statisticsDashboard {
flex-direction: column;
}
}

.statisticsDashboard {
display: flex;
align-items: center;
gap: 20px;
}
3 changes: 3 additions & 0 deletions src/components/StatisticsTable/StatisticsTable.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -94,3 +94,6 @@
font-weight: bold;
color: #ffffff;
}

@media screen and (max-width: 1280px) {
}

0 comments on commit d42628b

Please sign in to comment.