Skip to content

Commit

Permalink
turn IconRow into a component
Browse files Browse the repository at this point in the history
  • Loading branch information
ccatherinetan committed Dec 23, 2024
1 parent d86754d commit 9c3a04e
Showing 1 changed file with 22 additions and 4 deletions.
26 changes: 22 additions & 4 deletions components/PlantCareDescription.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,13 @@ import { H4, P3 } from '@/styles/text';
import { displaySunlightEnumFromHours } from '@/utils/helpers';
import Icon from './Icon';

function IconRow(iconType: IconType, boldText: string, text: string) {
type IconRowProps = {
iconType: IconType;
boldText: string;
text: string;
};

function IconRow({ iconType, boldText, text }: IconRowProps) {
return (
<Flex $align="center" $gap="8px">
<Icon type={iconType} />
Expand Down Expand Up @@ -36,9 +42,21 @@ export default function PlantCareDescription({
<Flex $direction="column" $gap="12px" $pl="8px">
<H4>Plant Care Description</H4>
<Flex $direction="column" $gap="8px">
{IconRow('wateringCan', 'Watering Frequency:', waterFreq)}
{IconRow('wateringCan', 'Weeding Frequency:', weedingFreq)}
{IconRow('sun', 'Sunlight Requirement:', sunlightText)}
<IconRow
iconType="wateringCan"
boldText="Watering Frequency:"
text={waterFreq}
/>
<IconRow
iconType="wateringCan"
boldText="Weeding Frequency:"
text={weedingFreq}
/>
<IconRow
iconType="sun"
boldText="Sunlight Requirement:"
text={sunlightText}
/>
</Flex>
</Flex>
);
Expand Down

0 comments on commit 9c3a04e

Please sign in to comment.