-
Notifications
You must be signed in to change notification settings - Fork 0
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
feat: redesign accordions of fcs and ipc #138
Open
ArmanpreetGhotra
wants to merge
20
commits into
main
Choose a base branch
from
feature/f-167-accordions-redesign-fcs-ipc
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
7b49445
feat: redesign accordions of fcs and ipc
a2d5221
feat: add nutrition accordion in ipc and fcs
de66d73
feat: downsize the accordions, add flex to population card
ab1fa4a
fix: reduce the size of nutrition svg
786e982
Merge branch 'main' into feature/f-167-accordions-redesign-fcs-ipc
38749c5
fix: fix macroAccordion lineChart
1b4750a
fix: fix after merge
be3ca0d
fix: restyle the nutrition accordion text
1f5b2ad
fix: remove the extra accordion files and fix chronic nutrition svg
5033db4
fix: remove unwanted props file
4698e21
fix: fix accordion operations of fcs and ipc
5b0d741
fix: remove null and add multiple selection mode to accordions
c8e90e2
Merge branch 'main' into feature/f-167-accordions-redesign-fcs-ipc
49ab8a9
fix: rename methods of fcs and ipc
a37249b
fix: fix scrollbar
2af98d6
fix: fix width of ofcs because of the scrollbar
a126155
fix: fix mobile version of fcs
c70a61e
fix: rename foodAccordion, nutritionAccordion, macroEconomicAccoridon
7a6e314
fix: change the width of accordions and text size of nutrition accordion
0901ddb
fix: fix fcs food security width
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,46 @@ | ||
'use client'; | ||
|
||
import { Card, CardBody, CardHeader, Image } from '@nextui-org/react'; | ||
import { Card, CardBody } from '@nextui-org/react'; | ||
import React from 'react'; | ||
import { v4 as uuid } from 'uuid'; | ||
|
||
import { CardProps } from '@/domain/props/CardProps'; | ||
|
||
export default function CustomCard({ title, content }: CardProps) { | ||
return ( | ||
<Card className="w-fit h-auto min-w-[210px] justify-evenly m-2.5 dark:primary white:bg-white"> | ||
<CardHeader className="flex flex-col items-center p-[5px] overflow-visible"> | ||
<h2 className="text-large break-words text-pretty"> {title} </h2> | ||
</CardHeader> | ||
<Card className="w-fit h-auto min-w-[200px] justify-evenly m-2.5 dark:primary white:bg-white"> | ||
<CardBody className="flex flex-col items-center justify-center overflow-visible overflow-y-auto max-h-[300px] py-2"> | ||
<div className="flex flex-row gap-6 overflow-y-auto"> | ||
<div className="flex flex-row flex-wrap gap-6 overflow-y-auto"> | ||
{content.map((item) => ( | ||
<div key={uuid()} className="flex flex-col gap-1 items-center"> | ||
<div key={uuid()} className="flex flex-row gap-4 items-start"> | ||
{item.svgIcon ? ( | ||
<div className="svg-icon w-[90px]">{item.svgIcon}</div> | ||
) : ( | ||
<Image alt={item.altText} className="w-[102px] h-[75px]" src={item.imageSrc} /> | ||
<div className="svg-icon w-[70px] h-[70px] object-contain">{item.svgIcon}</div> | ||
) : item.imageSrc ? ( | ||
<img alt={item.altText || ''} className="w-[70px] h-[70px] -mt-4" src={item.imageSrc} /> | ||
) : null} | ||
<div className="flex flex-col"> | ||
{title && <h2 className="text-lg text-center">{title}</h2>} | ||
{item.text && <h2 className={`text-center ${item.textClass || 'text-xs'}`}>{item.text}</h2>} | ||
{item.value && ( | ||
<p className="text-sm/[2rem] text-center"> | ||
{typeof item.value === 'number' ? `${item.value.toFixed(2)} M` : item.value || 'N/A'} | ||
</p> | ||
)} | ||
</div> | ||
{/* Additional Content (Time-based data) */} | ||
{item.changeValues && ( | ||
<div className="flex flex-row space-x-3"> | ||
{item.changeValues.map((delta) => ( | ||
<div key={uuid()} className="flex flex-col items-center gap-2"> | ||
<img src={delta.imageSrc} alt={delta.altText} className="w-6 h-6" /> | ||
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. next Image |
||
<div className="text-center"> | ||
<p className="text-sm font-medium whitespace-nowrap">{delta.text}</p> | ||
<p className="text-xs text-gray-600">{delta.timeText}</p> | ||
</div> | ||
</div> | ||
))} | ||
</div> | ||
)} | ||
<h1 className="text-base text-center mt-2">{item.text}</h1> | ||
{item.timeText && <h1 className="text-xs text-[#888888] text-center break-words">{item.timeText}</h1>} | ||
</div> | ||
))} | ||
</div> | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import FcsAccordionProps from '@/domain/props/FcsAccordionProps'; | ||
import { useMediaQuery } from '@/utils/resolution.ts'; | ||
|
||
import AccordionContainer from '../../Accordions/AccordionContainer'; | ||
import FcsFoodSecurityAccordion from './FcsFoodSecurityAccordion'; | ||
import FcsMacroEconomicAccordion from './FcsMacroEconomicAccordion'; | ||
|
||
export default function FcsAccordion({ countryData, loading, countryIso3Data, countryName }: FcsAccordionProps) { | ||
const isMobile = useMediaQuery('(max-width: 700px)'); | ||
const foodSecurityAccordion = FcsFoodSecurityAccordion({ countryData }); | ||
const macroEconomicAccordion = FcsMacroEconomicAccordion({ countryData, countryIso3Data }); | ||
|
||
return ( | ||
<> | ||
{!isMobile ? ( | ||
bohdangarchu marked this conversation as resolved.
Show resolved
Hide resolved
|
||
<div className="absolute w-[370px] left-[108px] top-4 z-9999"> | ||
<AccordionContainer | ||
bohdangarchu marked this conversation as resolved.
Show resolved
Hide resolved
|
||
loading={loading} | ||
title={countryName ?? undefined} | ||
bohdangarchu marked this conversation as resolved.
Show resolved
Hide resolved
|
||
accordionModalActive | ||
maxWidth={600} | ||
items={foodSecurityAccordion} | ||
/> | ||
</div> | ||
) : ( | ||
<div className="absolute w-[350px] left-[108px] top-4 z-9999"> | ||
<AccordionContainer | ||
loading={loading} | ||
title={countryName ?? undefined} | ||
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. same here |
||
accordionModalActive | ||
maxWidth={600} | ||
items={[...foodSecurityAccordion, ...macroEconomicAccordion]} | ||
/> | ||
</div> | ||
)} | ||
{!isMobile && ( | ||
<div className="absolute w-[370px] right-[1rem] inset-y-20 z-9999"> | ||
<AccordionContainer loading={loading} accordionModalActive maxWidth={600} items={macroEconomicAccordion} /> | ||
</div> | ||
)} | ||
</> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
use next Image