Skip to content

Commit

Permalink
fix(frontend): avoid map legend overlay on small screens (dynamic siz…
Browse files Browse the repository at this point in the history
…e) (#1637)

* fix(accordion): padding fix

* fix(mapLegend): legend UI fix
  • Loading branch information
NSUWAL123 authored Jul 9, 2024
1 parent 0dcfdc6 commit e29e08d
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 18 deletions.
25 changes: 11 additions & 14 deletions src/frontend/src/components/MapLegends.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,26 +52,23 @@ const MapLegends = ({ defaultTheme }: { defaultTheme: any }) => {
const LegendListItem = ({ data }: { data: mapDetialsType }) => {
return (
<div className="fmtm-flex fmtm-items-center fmtm-gap-3">
<div className="fmtm-border-[1px] fmtm-border-gray-200">
{data.type !== 'locked' ? (
<CoreModules.IconButton
style={{ backgroundColor: data.color, borderRadius: 0 }}
color="primary"
component="label"
className="fmtm-w-7 fmtm-h-7 sm:fmtm-w-10 sm:fmtm-h-10"
></CoreModules.IconButton>
) : (
<AssetModules.LockIcon className="!fmtm-text-[28px] sm:!fmtm-text-[40px]" />
)}
</div>
<p className="fmtm-text-base sm:fmtm-text-lg">{data.value}</p>
{data.type !== 'locked' ? (
<div
style={{ backgroundColor: data.color, borderRadius: 0 }}
color="primary"
className="!fmtm-w-5 !fmtm-h-5 fmtm-border-[1px] fmtm-border-gray-200"
></div>
) : (
<AssetModules.LockIcon className="!fmtm-text-[20px]" />
)}
<p className="fmtm-text-base fmtm-text-[#494949]">{data.value}</p>
</div>
);
};

return (
<div className="fmtm-py-3">
<div className="fmtm-flex fmtm-flex-col fmtm-gap-2 sm:fmtm-gap-4">
<div className="fmtm-flex fmtm-flex-col fmtm-gap-2">
{MapDetails.map((data, index) => {
return <LegendListItem data={data} key={index} />;
})}
Expand Down
2 changes: 1 addition & 1 deletion src/frontend/src/components/common/Accordion.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export default function Accordion({
<div className="">
<div
className={`fmtm-flex fmtm-items-center fmtm-justify-between
fmtm-w-full fmtm-font-bold fmtm-gap-3 fmtm-cursor-pointer fmtm-text-2xl fmtm-py-[0px] sm:fmtm-py-2 fmtm-border-[#929DB3] ${
fmtm-w-full fmtm-font-bold fmtm-gap-3 fmtm-cursor-pointer fmtm-text-2xl fmtm-py-[0px] sm:fmtm-py-1 fmtm-border-[#929DB3] ${
collapsed ? 'fmtm-border-b-[0px]' : 'fmtm-border-b-[2px]'
}`}
onClick={() => {
Expand Down
6 changes: 3 additions & 3 deletions src/frontend/src/views/ProjectDetailsV2.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -509,14 +509,14 @@ const ProjectDetailsV2 = () => {
popupId="locked-popup"
className="fmtm-w-[235px]"
/>
<div className="fmtm-absolute fmtm-bottom-20 sm:fmtm-bottom-5 fmtm-left-3 fmtm-z-50 fmtm-rounded-lg">
<div className="fmtm-absolute fmtm-bottom-20 sm:fmtm-bottom-3 fmtm-left-3 fmtm-z-50 fmtm-rounded-lg">
<Accordion
ref={legendRef}
body={<MapLegends defaultTheme={defaultTheme} />}
header={
<div className="fmtm-flex fmtm-items-center fmtm-gap-1 sm:fmtm-gap-2">
<AssetModules.LegendToggleIcon className=" fmtm-text-primaryRed" sx={{ fontSize: '30px' }} />
<p className="fmtm-text-lg fmtm-font-normal">Legend</p>
<AssetModules.LegendToggleIcon className=" fmtm-text-primaryRed" sx={{ fontSize: '25px' }} />
<p className="fmtm-text-base fmtm-font-normal">LEGEND</p>
</div>
}
onToggle={() => {
Expand Down

0 comments on commit e29e08d

Please sign in to comment.