-
Notifications
You must be signed in to change notification settings - Fork 16
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
New explore dropdown UI #2336
base: develop
Are you sure you want to change the base?
New explore dropdown UI #2336
Changes from 9 commits
ccb9213
60ab7d6
e0c3ae7
58456f8
ea978bb
b9074b8
732b4ab
d5dda28
1cddf29
fbd4cc7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,26 +9,117 @@ | |
|
||
.exploreMainContainer { | ||
max-width: 182px; | ||
background-color: $backgroundColor; | ||
background-color: #fff; | ||
border-radius: 12px; | ||
margin-top: 10px; | ||
padding: 14px 16px; | ||
padding: 12px; | ||
box-shadow: 0px 6px 10px rgba(0, 0, 0, 0.12); | ||
max-height: 485px; | ||
|
||
&::-webkit-scrollbar { | ||
display: none; | ||
} | ||
|
||
@include xsPhoneView { | ||
position: absolute; | ||
max-height: max-content; | ||
min-width: 293px; | ||
border-radius: unset; | ||
right: 0px; | ||
top: -10px; | ||
} | ||
} | ||
|
||
.exploreContainer { | ||
width: 150px; | ||
.exploreItemsContainer { | ||
max-height: 400px; | ||
overflow-y: auto; | ||
|
||
&::-webkit-scrollbar { | ||
display: none; | ||
} | ||
|
||
@include xsPhoneView { | ||
max-height: max-content; | ||
} | ||
} | ||
|
||
.exploreFeatureMobileHeader { | ||
display: flex; | ||
justify-content: space-between; | ||
padding: 3px 4px 18px; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There are minor differences from the designed spacing, any reason for that? As per the design, total spacing of the contents of this component from the top/side is 16px, and bottom is 20px. To achieve that, we would use |
||
|
||
.exploreLabel { | ||
display: flex; | ||
gap: 8px; | ||
|
||
p { | ||
font-size: 14px; | ||
font-weight: 700; | ||
gap: 8px; | ||
} | ||
} | ||
|
||
svg { | ||
width: 16px; | ||
} | ||
} | ||
|
||
.exploreItemSection { | ||
background: rgba(0, 122, 73, 0.05); | ||
border-radius: 8px; | ||
padding: 8px 9px; | ||
font-size: 12px; | ||
margin-bottom: 10px; | ||
|
||
h2 { | ||
font-weight: 600; | ||
margin-bottom: 14px; | ||
} | ||
} | ||
|
||
.layerSwitchContainer { | ||
display: flex; | ||
justify-content: space-between; | ||
align-items: center; | ||
|
||
.mapLayer { | ||
cursor: pointer; | ||
} | ||
|
||
hr { | ||
border-top: 1px dashed rgba(189, 189, 189, 1); | ||
margin-top: 0px; | ||
margin-bottom: 0px; | ||
} | ||
} | ||
|
||
.layerInfoPopupContainer { | ||
display: flex; | ||
flex-direction: column; | ||
gap: 8px; | ||
max-width: 189px; | ||
background: #fff; | ||
padding: 12px; | ||
font-size: 10px; | ||
|
||
.label { | ||
font-weight: 600; | ||
color: rgba(130, 130, 130, 1); | ||
text-transform: uppercase; | ||
} | ||
.source { | ||
color: $primaryDarkColor; | ||
} | ||
} | ||
|
||
.toggleMainContainer { | ||
padding: 15px 9px; | ||
height: 14px; | ||
display: flex; | ||
align-items: center; | ||
justify-content: space-between; | ||
background: rgba(0, 122, 73, 0.05); | ||
border-radius: 8px; | ||
} | ||
|
||
.toggleContainer { | ||
|
@@ -86,11 +177,8 @@ | |
} | ||
|
||
.exploreDescription { | ||
padding: 8px; | ||
height: fit-content; | ||
margin-top: 14px; | ||
background-color: rgba(var(--explore-description-background-color-new), 1); | ||
font-size: $fontXXSmall; | ||
font-size: var(--font-xx-extra-small); | ||
border-radius: 6px; | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,99 @@ | ||
import type { ChangeEvent, FC } from 'react'; | ||
import type { FC } from 'react'; | ||
import type { MapOptions } from '../../ProjectsMapContext'; | ||
import type { SetState } from '../../../common/types/common'; | ||
|
||
import styles from './MapFeatureExplorer.module.scss'; | ||
import { MapLayerToggle } from '.'; | ||
// // import { MapLayerToggle } from '.'; | ||
// import InfoIcon from '../../../../../public/assets/images/icons/projectV2/InfoIcon'; | ||
import { StyledSwitch } from './CustomSwitch'; | ||
// import { StyledSwitch } from './CustomSwitch'; | ||
// import { YearRangeSlider } from '.'; | ||
import { useTranslations } from 'next-intl'; | ||
// import themeProperties from '../../../../theme/themeProperties'; | ||
import MapLayerControlPanel from './microComponents/MapLayerControlPanel'; | ||
import ExploreDropdownHeaderMobile from './microComponents/ExploreDropdownHeaderMobile'; | ||
|
||
type MapSettingsProps = { | ||
mapOptions: MapOptions; | ||
updateMapOption: (option: keyof MapOptions, value: boolean) => void; | ||
isMobile?: boolean; | ||
setIsOpen?: SetState<boolean>; | ||
}; | ||
|
||
const MapSettings: FC<MapSettingsProps> = ({ mapOptions, updateMapOption }) => { | ||
const MapSettings: FC<MapSettingsProps> = ({ | ||
mapOptions, | ||
updateMapOption, | ||
isMobile, | ||
setIsOpen, | ||
}) => { | ||
const tAllProjects = useTranslations('AllProjects'); | ||
const tMaps = useTranslations('Maps'); | ||
/* const { | ||
primaryColorNew, | ||
restorationToggleColorNew, | ||
deforestrationToggleColorNew, | ||
} = themeProperties; */ | ||
|
||
// const { primaryColorNew } = themeProperties; | ||
// const forestConfig = [ | ||
// { | ||
// label: tMaps('layers.forestLayers.canopyHeight'), | ||
// color: undefined, | ||
// showDivider: true, | ||
// shouldRender: true, | ||
// additionalInfo: { | ||
// dataYears: 2018, | ||
// resolution: '1m', | ||
// description: 'Global canopy height between year 2018-2020', | ||
// underlyingData: | ||
// 'Global Canopy Height Maps based on AI model (DinoV2) and remote sensing data (MAXAR and GEDI) by Meta', | ||
// source: | ||
// 'https://sustainability.atmeta.com/blog/2024/04/22/using-artificial-intelligence-to-map-the-earths-forests/', | ||
// covariates: 'Tolan et al. 2024', | ||
// }, | ||
// }, | ||
// { | ||
// label: tMaps('layers.forestLayers.deforestation'), | ||
// color: primaryColorNew, | ||
// showDivider: true, | ||
// shouldRender: true, | ||
// additionalInfo: { | ||
// dataYears: 2023, | ||
// resolution: '30m', | ||
// description: 'Location of deforestation in previous year', | ||
// underlyingData: 'Landsat satellite programs', | ||
// source: 'https://www.science.org/doi/10.1126/science.1244693', | ||
// covariates: 'Hansen et al. 2013', | ||
// }, | ||
// }, | ||
// { | ||
// label: tMaps('layers.forestLayers.forestBiomass'), | ||
// color: primaryColorNew, | ||
// showDivider: true, | ||
// shouldRender: true, | ||
// additionalInfo: { | ||
// dataYears: 2023, | ||
// resolution: '500km', | ||
// description: 'Tree cover as a binary map', | ||
// underlyingData: | ||
// 'AI model built by Google to classify Sentinel II images in 9 different land use and land cover classes', | ||
// source: 'https://dynamicworld.app/', | ||
// covariates: 'Dynamic World', | ||
// }, | ||
// }, | ||
// ]; | ||
const projectConfig = [ | ||
{ | ||
label: tAllProjects('projects'), | ||
color: undefined, | ||
showDivider: false, | ||
shouldRender: true, | ||
}, | ||
]; | ||
return ( | ||
<div className={styles.exploreMainContainer}> | ||
<div className={styles.exploreContainer}> | ||
<div> | ||
<div> | ||
<div className={styles.exploreItemsContainer}> | ||
{/* <MapLayerToggle | ||
infoIcon={<InfoIcon width={'10px'} />} | ||
label={tAllProjects('currentForests')} | ||
switchComponent={ | ||
<StyledSwitch customColor={`${primaryColorNew}`} /> | ||
} | ||
/> | ||
<div className={styles.hrLine} /> | ||
/> */} | ||
{/* <div className={styles.hrLine} /> | ||
<MapLayerToggle | ||
infoIcon={<InfoIcon width={'10px'} />} | ||
label={tAllProjects('restorationPotential')} | ||
|
@@ -49,10 +108,9 @@ const MapSettings: FC<MapSettingsProps> = ({ mapOptions, updateMapOption }) => { | |
switchComponent={ | ||
<StyledSwitch customColor={`${deforestrationToggleColorNew}`} /> | ||
} | ||
/> | ||
<div className={styles.hrLine} /> */} | ||
<MapLayerToggle | ||
infoIcon={undefined} | ||
/> */} | ||
{/* <div className={styles.hrLine} /> */} | ||
{/* <MapLayerToggle | ||
label={tAllProjects('projects')} | ||
switchComponent={ | ||
<StyledSwitch | ||
|
@@ -63,7 +121,19 @@ const MapSettings: FC<MapSettingsProps> = ({ mapOptions, updateMapOption }) => { | |
) => updateMapOption('showProjects', checked)} | ||
/> | ||
} | ||
/> */} | ||
{isMobile && setIsOpen && ( | ||
<ExploreDropdownHeaderMobile setIsOpen={setIsOpen} /> | ||
)} | ||
<MapLayerControlPanel | ||
Comment on lines
+125
to
+127
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Avoid cramped mobile headers. |
||
exploreConfig={projectConfig} | ||
updateMapOption={updateMapOption} | ||
mapOptions={mapOptions} | ||
/> | ||
{/* <MapLayerControlPanel | ||
category={tMaps('layers.forests')} | ||
exploreConfig={forestConfig} | ||
/> */} | ||
</div> | ||
<div className={styles.exploreDescription}> | ||
{tMaps('3trilliontrees')} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do this instead of making margin-top = 0px? This makes it tougher to understand how the element is positioned.