Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

carbon capture modal #1979

Open
wants to merge 14 commits into
base: develop
Choose a base branch
from
1 change: 1 addition & 0 deletions .github/workflows/chromatic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ on:
- feature/storybook-update
- develop
- feature/redesign-explore-btn
- feature/carbon_capture_modal
# List of jobs
jobs:
chromatic-deployment:
Expand Down
13 changes: 11 additions & 2 deletions public/static/locales/en/projectDetails.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
{
"satelliteAnalysis": "Satellite Analysis"
}
"satelliteAnalysis": "Satellite Analysis",
"totalCO₂Captured": "Total CO₂ Captured",
"beforeIntervention": "Before intervention",
"before": "Before {{date}}",
"byProject": "By Project",
"since": "Since {{date}}",
"sitePotential": "Site Potential",
"seeMore": "See More",
"site": "Site({{area}})",
"entireProject": "Entire Project({{area}})"
}
163 changes: 163 additions & 0 deletions src/temp/CarbonCapture/CarbonCapture.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
.carbonCaptureMainContainer {
width: 100%;
display: flex;
flex-direction: column;
}

.carbonCaptureInfoContainer {
display: flex;
flex-direction: column;
gap: 12px;
}

.carbonCaptureLabelMainContainer {
width: 306px;
height: 17.7px;
margin-left: 15.5px;
font-size: 10px;
display: flex;
justify-content: space-between;
}

.carbonCaptureLabelContainer {
display: flex;
> .carbonCapture {
font-weight: 700;
}
.unit {
margin-left: 1px;
}
}

.carbonCatureDetailContainer {
border: 1px solid rgba(111, 207, 151, 0.02);
background: linear-gradient(
0deg,
rgba(33, 150, 83, 0.1) 0%,
rgba(33, 150, 83, 0.1) 100%
),
#fff;
width: 306px;
height: 93px;
margin-left: 15.5px;
border-radius: 12px;
}

.carbonCaptureIndicator {
width: 274px;
height: 21px;
margin-top: 13.87px;
margin-left: 16.5px;
display: flex;
border-radius: 3px;

.beforeIntervationIndicator {
width: 107px;
background: linear-gradient(
0deg,
rgba(33, 150, 83, 0.4) 0%,
rgba(33, 150, 83, 0.4) 100%
),
#fff;
height: inherit;
border-top-left-radius: 3px;
border-bottom-left-radius: 3px;
}
.byProjectIndicator {
width: 51px;
background: linear-gradient(0deg, #219653 0%, #219653 100%), #fff;
height: inherit;
}
.projectPotential {
width: 116px;
background: #fff;
height: inherit;
border-top-right-radius: 3px;
border-bottom-right-radius: 3px;
}
}

.carbonCaptureDataContainer {
display: flex;
padding-left: 16px;
padding-top: 4px;
.beforeIntervationData {
color: rgba(33, 150, 83, 1);
font-size: 8px;
font-weight: 700;
}
.beforeIntervationLabel {
font-size: 8px;
font-weight: 600;
}
.beforeIntervationDate {
font-size: 6px;
color: #828282;
}
.byProjectMainConatiner {
margin-left: 40px;
}
.byProjectData {
color: rgba(33, 150, 83, 1);
font-size: 8px;
font-weight: 700;
}
.byProjectLabel {
font-size: 8px;
font-weight: 600;
}
.byProjectDate {
font-size: 6px;
color: #828282;
}
.sitePotentialDataContainer {
margin-left: 70px;
.sitePotentialData {
color: rgba(33, 150, 83, 1);
font-size: 8px;
font-weight: bold;
}
.sitePotentialLabel {
font-size: 8px;
font-weight: 600;
}
}
}

.carbonCaptureModal {
width: 338px;
border-radius: 16px;
overflow: hidden;
background-color: #fff;
}

.infoIconContainer {
cursor: pointer;
}

.seeMoreButton {
background: linear-gradient(0deg, #219653 0%, #219653 100%), #fff;
width: 100%;
height: 27px;
margin-top: 24px;
display: flex;
justify-content: center;
align-items: center;
cursor: pointer;
}

.seeMoreLabel {
font-size: 8px;
font-weight: 700;
color: #fff;
}

.downArrow {
margin-left: 5px;
margin-bottom: 5px;
}

.horizontalLine {
position: relative;
top: -8px;
}
192 changes: 192 additions & 0 deletions src/temp/CarbonCapture/CarbonCapture.tsx
prachigarg19 marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,192 @@
import Tabs from '@mui/material/Tabs';
import Tab from '@mui/material/Tab';
import React from 'react';
import style from './CarbonCapture.module.scss';
import InfoIcon from '../icons/InfoIcon';
import DownArrow from '../icons/DownArrow';
import { useTranslation } from 'next-i18next';

interface TabPanelProps {
index: number;
value: number;
beforeIntervation: string;
byProject: string;
sitePotential: string;
}

type carbonCapture = Omit<TabPanelProps, 'index' | 'value'>;

function CustomTabPanel(props: TabPanelProps) {
const {
value,
index,
beforeIntervation,
byProject,
sitePotential,
...other
} = props;
const { t } = useTranslation(['projectDetails']);
return (
<div
role="tabpanel"
hidden={value !== index}
id={`simple-tabpanel-${index}`}
aria-labelledby={`simple-tab-${index}`}
className={style.carbonCaptureMainContainer}
{...other}
>
{value === index && (
<>
<div className={style.carbonCaptureInfoContainer}>
<div className={style.carbonCaptureLabelMainContainer}>
<div className={style.carbonCaptureLabelContainer}>
<div className={style.carbonCapture}>
{t('projectDetails:totalCO₂Captured')}
</div>
<div className={style.unit}>(tons)</div>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to translate tons as well. There is already a key present for this.

</div>
<div className={style.infoIconContainer}>
<InfoIcon />
</div>
</div>
<div className={style.carbonCatureDetailContainer}>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why have you provided static width here, won't this be dependent on the values received from api?

<div className={style.carbonCaptureIndicator}>
<div className={style.beforeIntervationIndicator} />
<div className={style.byProjectIndicator} />
<div className={style.projectPotential} />
</div>
<div className={style.carbonCaptureDataContainer}>
<div>
<p className={style.beforeIntervationData}>
{beforeIntervation}
</p>
<p className={style.beforeIntervationLabel}>
{t('projectDetails:beforeIntervention')}
</p>
<p className={style.beforeIntervationDate}>
{t('projectDetails:before', {
date: 2018,
})}
</p>
</div>
<div className={style.byProjectMainConatiner}>
<p className={style.byProjectData}>{byProject}</p>
<p className={style.byProjectLabel}>
{t('projectDetails:byProject')}
</p>
<p className={style.byProjectDate}>
{t('projectDetails:since', {
date: 2018,
})}
</p>
</div>
<div className={style.sitePotentialDataContainer}>
<p className={style.sitePotentialData}>{sitePotential}</p>
<p className={style.sitePotentialLabel}>
{t('projectDetails:sitePotential')}
</p>
</div>
</div>
</div>
</div>
<button className={style.seeMoreButton}>
sunilsabatp marked this conversation as resolved.
Show resolved Hide resolved
<div className={style.seeMoreLabel}>
{t('projectDetails:seeMore')}
</div>
<div className={style.downArrow}>
<DownArrow />
</div>
</button>
</>
)}
</div>
);
}
const customStyle = {
'.MuiTabs-flexContainer': {
justifyContent: 'center',
marginTop: '24px',
gap: '30px',
},
'.MuiButtonBase-root': {
textTransform: 'none',
fontSize: '12px',
fontWeight: '700',
color: '#2F3336',
},
'.MuiButtonBase-root-MuiTab-root.Mui-selected': {
color: '#007A49',
prachigarg19 marked this conversation as resolved.
Show resolved Hide resolved
},
'.MuiTabs-indicator': {
backgroundColor: '#007A49',
},
'.MuiTab-root.Mui-selected': {
color: '#007A49',
},
'.MuiTab-root': {
minHeight: '0px',
padding: '0px 0px',
},
};

const CarbonCapture = ({
beforeIntervation,
byProject,
sitePotential,
}: carbonCapture) => {
const [value, setValue] = React.useState(0);
const { t } = useTranslation(['projectDetails']);
function a11yProps(index: number) {
return {
id: `simple-tab-${index}`,
'aria-controls': `simple-tabpanel-${index}`,
};
}

const handleChange = (event: React.SyntheticEvent, newValue: number) => {
setValue(newValue);
};
return (
<div className={style.carbonCaptureModal}>
<Tabs
value={value}
onChange={handleChange}
aria-label="basic tabs example"
sx={customStyle}
>
<Tab
label={t('projectDetails:site', {
area: `12ha`,
})}
{...a11yProps(0)}
className="tab"
/>
<Tab
label={t('projectDetails:entireProject', {
area: `623ha`,
})}
{...a11yProps(1)}
className="tab"
/>
</Tabs>
<hr className={style.horizontalLine} />
<CustomTabPanel
beforeIntervation={beforeIntervation}
byProject={byProject}
sitePotential={sitePotential}
value={value}
index={0}
/>

<CustomTabPanel
beforeIntervation={beforeIntervation}
byProject={byProject}
sitePotential={sitePotential}
value={value}
index={1}
/>
</div>
);
};

export default CarbonCapture;
17 changes: 17 additions & 0 deletions src/temp/icons/DownArrow.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
const DownArrow = () => {
return (
<svg
xmlns="http://www.w3.org/2000/svg"
width="7"
height="4"
viewBox="0 0 7 4"
fill="none"
>
<path
d="M7 0.628351C7 0.281196 6.70848 0.000385723 6.34809 0.000385723C6.1751 0.000385723 6.00852 0.066731 5.88679 0.183992L3.5002 2.48293L1.11361 0.183992C0.858933 -0.0613308 0.445684 -0.0613308 0.191007 0.183992C-0.0636691 0.429315 -0.0636691 0.827387 0.191007 1.07271L3.0389 3.81601C3.29358 4.06133 3.70682 4.06133 3.9615 3.81601L6.80939 1.07271C6.93113 0.955448 7 0.794986 7 0.628351Z"
fill="white"
/>
</svg>
);
};
export default DownArrow;
Loading