Skip to content

Commit

Permalink
fix: restyle the nutrition accordion text
Browse files Browse the repository at this point in the history
  • Loading branch information
Armanpreet Ghotra committed Dec 19, 2024
1 parent 1b4750a commit be3ca0d
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 18 deletions.
3 changes: 1 addition & 2 deletions src/components/Cards/Card.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
'use client';

import { Card, CardBody } from '@nextui-org/react';
import Image from 'next/image';
import { Card, CardBody, Image } from '@nextui-org/react';
import React from 'react';
import { v4 as uuid } from 'uuid';

Expand Down
4 changes: 4 additions & 0 deletions src/domain/props/NutritionAccordionTextProps.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export default interface NutritionAccordionTextProps {
nutritionValue: string;
text: string;
}
17 changes: 9 additions & 8 deletions src/operations/map/FcsFoodSecurityOperations.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { ReactComponent as FoodConsumption } from '../../../public/Images/FoodCo
import { ReactComponent as Nutrition } from '../../../public/Images/Nutrition.svg';
import { ReactComponent as Population } from '../../../public/Images/Population.svg';
import { FcsAccordionOperations } from './FcsAccordionOperations';
import NutritionAccordionText from './NutritionAccordionText';

export function getFcsFoodSecurityAccordionItems(
countryData: CountryData | undefined,
Expand Down Expand Up @@ -81,10 +82,10 @@ export function getFcsFoodSecurityAccordionItems(
{
svgIcon: <Nutrition className="w-[50px] h-[50px] object-contain" />,
text: (
<>
<span className="text-base">{`${nutritionData.Acute} %`}</span>
<span className="text-xs text-gray-400 ml-1">of children (under 5)</span>
</>
<NutritionAccordionText
nutritionValue={`${nutritionData.Acute} %`}
text="of children (under 5)"
/>
),
},
]}
Expand All @@ -97,10 +98,10 @@ export function getFcsFoodSecurityAccordionItems(
{
svgIcon: <Nutrition className="w-[30px] h-[30px] object-contain" />,
text: (
<>
<span className="text-base">{`${nutritionData.Chronic} %`}</span>
<span className="text-xs text-gray-400 ml-1">of children (under 5)</span>
</>
<NutritionAccordionText
nutritionValue={`${nutritionData.Chronic} %`}
text="of children (under 5)"
/>
),
},
]}
Expand Down
17 changes: 9 additions & 8 deletions src/operations/map/IpcFoodSecurityOperations.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { ReactComponent as FoodConsumption } from '../../../public/Images/FoodCo
import { ReactComponent as Nutrition } from '../../../public/Images/Nutrition.svg';
import { ReactComponent as Population } from '../../../public/Images/Population.svg';
import { FcsAccordionOperations } from './FcsAccordionOperations';
import NutritionAccordionText from './NutritionAccordionText';

export const IpcFoodSecurityAccordionOperations = {
getFoodSecurityAccordionItems: (
Expand Down Expand Up @@ -85,10 +86,10 @@ export const IpcFoodSecurityAccordionOperations = {
{
svgIcon: <Nutrition className="w-[50px] h-[50px] object-contain" />,
text: (
<>
<span className="text-base">{`${nutritionData.Acute} %`}</span>
<span className="text-xs text-gray-400 ml-1">of children (under 5)</span>
</>
<NutritionAccordionText
nutritionValue={`${nutritionData.Acute} %`}
text="of children (under 5)"
/>
),
},
]}
Expand All @@ -101,10 +102,10 @@ export const IpcFoodSecurityAccordionOperations = {
{
svgIcon: <Nutrition className="w-[50px] h-[50px] object-contain" />,
text: (
<>
<span className="text-base">{`${nutritionData.Chronic} %`}</span>
<span className="text-xs text-gray-400 ml-1">of children (under 5)</span>
</>
<NutritionAccordionText
nutritionValue={`${nutritionData.Chronic} %`}
text="of children (under 5)"
/>
),
},
]}
Expand Down
11 changes: 11 additions & 0 deletions src/operations/map/NutritionAccordionText.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import NutritionAccordionTextProps from '@/domain/props/NutritionAccordionTextProps';

function NutritionAccordionText({ nutritionValue, text }: NutritionAccordionTextProps) {
return (
<>
<span className="text-base">{nutritionValue}</span>
<span className="text-xs text-gray-400 ml-1">{text}</span>
</>
);
}
export default NutritionAccordionText;

0 comments on commit be3ca0d

Please sign in to comment.