Skip to content

Commit

Permalink
simplify difficulty level return logic
Browse files Browse the repository at this point in the history
  • Loading branch information
ccatherinetan committed Nov 21, 2024
1 parent d5aecbe commit 511bf78
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
15 changes: 8 additions & 7 deletions components/DifficultyLevelBar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@ export default function DifficultyLevelBar({
}: {
difficultyLevel: DifficultyLevelEnum;
}) {
return (
<div>
{difficultyLevel === 'EASY' && <Icon type="easy_bar"></Icon>}
{difficultyLevel === 'MODERATE' && <Icon type="moderate_bar"></Icon>}
{difficultyLevel === 'HARD' && <Icon type="hard_bar"></Icon>}
</div>
);
if (difficultyLevel === 'EASY') {
return <Icon type="easy_bar" />;
} else if (difficultyLevel === 'MODERATE') {
return <Icon type="moderate_bar" />;
} else {
// difficultyLevel === 'HARD'
return <Icon type="hard_bar" />;
}
}
2 changes: 1 addition & 1 deletion components/PlantCareDescription/style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export const Title = styled.h2`
export const CareItem = styled.div`
display: flex;
align-items: center;
margin-bottom: 0.5rem;
margin-bottom: 10px;
`;

export const IconWrapper = styled.div`
Expand Down

0 comments on commit 511bf78

Please sign in to comment.