Skip to content

Commit

Permalink
feat: add level to more info modal
Browse files Browse the repository at this point in the history
  • Loading branch information
KimiaMontazeri committed Nov 27, 2023
1 parent 756069e commit 514743d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 2 additions & 1 deletion frontend/src/components/item-card/item-card.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const Level = ({ name, color }) => (
</Stack>
);

const levelComponentMapping = {
export const levelComponentMapping = {
Elementary: <Level name="elementary" color="success.light" />,
Intermediate: <Level name="intermediate" color="secondary.main" />,
Advanced: <Level name="advanced" color="warning.light" />,
Expand Down Expand Up @@ -108,6 +108,7 @@ const ItemCard = ({
presenterName={presenterName}
cost={cost}
purchaseState={purchaseState}
level={level}
hasProject={hasProject}
prerequisites={prerequisites}
syllabus={syllabus}
Expand Down
5 changes: 4 additions & 1 deletion frontend/src/components/item-card/more-info-modal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
Chip,
} from '@mui/material';
import PropTypes from 'prop-types';
import { Cost, Presenter } from './item-card';
import { Cost, levelComponentMapping, Presenter } from './item-card';

const Prerequisites = ({ prerequisites }) => (
<>
Expand Down Expand Up @@ -45,6 +45,7 @@ const MoreInfoModal = ({
title,
presenterName,
cost,
level,
purchaseState,
hasProject,
prerequisites,
Expand Down Expand Up @@ -72,6 +73,7 @@ const MoreInfoModal = ({
<DialogTitle variant="h5">{title}</DialogTitle>
<DialogContent>
<Presenter presenterName={presenterName} />
{levelComponentMapping[level]}
<Cost cost={cost} />
<Divider sx={{ my: 2 }} />
<Prerequisites prerequisites={prerequisites} />
Expand Down Expand Up @@ -104,6 +106,7 @@ MoreInfoModal.propTypes = {
title: PropTypes.string,
presenterName: PropTypes.string,
cost: PropTypes.number,
level: PropTypes.string,
isBought: PropTypes.bool,
purchaseState: PropTypes.number,
prerequisites: PropTypes.string,
Expand Down

0 comments on commit 514743d

Please sign in to comment.