From 9490166d2c171f1bf8b74935dcd1cb8017487fdf Mon Sep 17 00:00:00 2001 From: RubenSmn Date: Sun, 30 Oct 2022 11:42:47 +0100 Subject: [PATCH 1/2] refactor: add size property to improve responsiveness for mobile --- src/components/common/CustomIcon.js | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/components/common/CustomIcon.js b/src/components/common/CustomIcon.js index a76e5d735..9f7f65ecc 100644 --- a/src/components/common/CustomIcon.js +++ b/src/components/common/CustomIcon.js @@ -1,6 +1,16 @@ import SvgIcon from '@mui/material/SvgIcon'; -function CustomIcon({ icon, height = '1em', width = '1em', sx = {}, color }) { +function CustomIcon({ icon, size = '1em', sx = {}, color }) { + let formattedSize; + + if (typeof size === 'string') { + formattedSize = [`calc(0.75 * ${size})`, size]; + } else if (typeof size === 'number') { + formattedSize = [`calc(0.75 * ${size}px)`, `${size}px`]; + } else if (size instanceof Array) { + formattedSize = size; + } + return ( From 703063b614460675803ada28353cf590ffeb640f Mon Sep 17 00:00:00 2001 From: RubenSmn Date: Sun, 30 Oct 2022 12:02:38 +0100 Subject: [PATCH 2/2] refactor: update icons with new size property --- src/components/ImpactSection.js | 5 ++++- src/components/LeaderBoard.js | 14 +++----------- src/components/Timeline.js | 2 +- src/components/TreeInfoDialog.js | 6 ++---- src/components/common/CustomCard.js | 2 +- src/components/common/Info.js | 13 +++++++------ src/pages/organizations/[organizationid].js | 3 +-- src/pages/planters/[planterid].js | 3 +-- src/pages/tokens/[tokenid].js | 3 +-- src/pages/top.js | 3 +-- 10 files changed, 22 insertions(+), 32 deletions(-) diff --git a/src/components/ImpactSection.js b/src/components/ImpactSection.js index 8c5178852..07a41c1a5 100644 --- a/src/components/ImpactSection.js +++ b/src/components/ImpactSection.js @@ -70,7 +70,10 @@ function ImpactSection() { mb: 6, }} > - + - ); +function TreeImage() { + return ; } function LeaderBoard(props) { @@ -170,7 +162,7 @@ function LeaderBoard(props) { > TREES CAPTURED - + diff --git a/src/components/Timeline.js b/src/components/Timeline.js index ff3652ffd..76859863e 100644 --- a/src/components/Timeline.js +++ b/src/components/Timeline.js @@ -137,7 +137,7 @@ function Timeline() { > palette.primary.main, diff --git a/src/components/TreeInfoDialog.js b/src/components/TreeInfoDialog.js index 568f4c91b..8dcac92c3 100644 --- a/src/components/TreeInfoDialog.js +++ b/src/components/TreeInfoDialog.js @@ -143,7 +143,7 @@ export default function TreeInfoDialog(props) { }, }} > - +