Skip to content

Commit

Permalink
Merge pull request #56 from the-collab-lab/gl-design
Browse files Browse the repository at this point in the history
Have fixed chip width, update calculateUrgency function
  • Loading branch information
g-lee2 authored Apr 1, 2024
2 parents 24bca8c + fe55ee1 commit 312fa1b
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
4 changes: 4 additions & 0 deletions src/api/firebase.js
Original file line number Diff line number Diff line change
Expand Up @@ -287,5 +287,9 @@ export const calculateUrgency = (daysUntilNextPurchase, dateLastPurchased) => {
return 'kind of soon';
} else if (daysUntilNextPurchase >= 30 && daysUntilNextPurchase < 60) {
return 'not soon';
} else if (!daysUntilNextPurchase) {
return 'inactive';
} else if (!daysSinceLastPurchase) {
return 'inactive';
}
};
3 changes: 2 additions & 1 deletion src/components/ListItem.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export function ListItem({
}
}, [isChecked, itemId, listPath]);

const urgency = calculateUrgency(daysUntilNextPurchase, dateLastPurchased);
let urgency = calculateUrgency(daysUntilNextPurchase, dateLastPurchased);
const label = { inputProps: { 'aria-label': `${name}` } };
let chipBackgroundColor;

Expand Down Expand Up @@ -117,6 +117,7 @@ export function ListItem({
sx={{
marginRight: 2,
backgroundColor: chipBackgroundColor,
width: 75,
}}
/>
<Button
Expand Down
11 changes: 8 additions & 3 deletions src/views/List.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ export function List({ data, listPath }) {
const addItemForm = () => {
return (
<section className="addAnItemForm">
{/* {alertText(submitted)} */}
<form onSubmit={handleSubmit}>
{/* Add item form for larger screens */}
<Box
Expand All @@ -139,7 +140,6 @@ export function List({ data, listPath }) {
<Grid item>
<Typography variant="h4">Add an item</Typography>
</Grid>
{alertText(submitted)}
<Grid item xs>
<FormControl variant="standard" fullWidth>
<InputLabel htmlFor="itemName">Enter item name:</InputLabel>
Expand Down Expand Up @@ -183,7 +183,7 @@ export function List({ data, listPath }) {
<AccordionSummary expandIcon={<ExpandMoreIcon />}>
Add an item +{' '}
</AccordionSummary>
{alertText(submitted)}
{/* {alertText(submitted)} */}
<AccordionDetails>
<FormControl variant="standard">
<InputLabel htmlFor="itemName">Enter item name:</InputLabel>
Expand Down Expand Up @@ -357,5 +357,10 @@ export function List({ data, listPath }) {
setSearchTerm('');
};

return <>{data.length === 0 ? renderAddFirstItemCTA() : renderItemList()}</>;
return (
<>
{alertText(submitted)}
{data.length === 0 ? renderAddFirstItemCTA() : renderItemList()}
</>
);
}

0 comments on commit 312fa1b

Please sign in to comment.