-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: ✨ add expirationdate ingredients, recommend recipes
유통기한 임박 재료, 재료 기반 추천 레시피 기능 추가
- Loading branch information
1 parent
610044b
commit f8730fa
Showing
4 changed files
with
165 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import { ReactComponent as IconCaution } from '@/assets/icon-caution.svg'; | ||
import DesignSystem from '@/utils/designSystem'; | ||
import { Group, Stack, Typography } from '@base'; | ||
import { css } from '@emotion/react'; | ||
import moment from 'moment'; | ||
import { IngredientDataType } from '..'; | ||
interface ShortExpirationItemProps { | ||
item: IngredientDataType; | ||
} | ||
const styles = { | ||
infoBox: css({ | ||
backgroundColor: DesignSystem.Color.background.gray, | ||
border: '1px solid', | ||
borderColor: DesignSystem.Color.background.black, | ||
marginLeft: -1, | ||
padding: '17.5px 119px 32px 18.6px', | ||
}), | ||
}; | ||
function ShortExpirationItem({ item }: ShortExpirationItemProps) { | ||
return ( | ||
<Stack> | ||
<Group gap={3} css={{ marginBottom: 14 }}> | ||
<Typography variant="subtitle">{item.name}</Typography> | ||
{item.expirationDate?.isBefore(moment()) && ( | ||
<IconCaution css={{ width: 24, height: 24 }} /> | ||
)} | ||
</Group> | ||
<Stack | ||
css={styles.infoBox} | ||
style={{ | ||
backgroundColor: `${ | ||
item.expirationDate?.isBefore(moment()) | ||
? DesignSystem.Color.primary.yellow | ||
: DesignSystem.Color.background.gray | ||
}`, | ||
}} | ||
> | ||
<Typography variant="body">수량 : {item.quantity}</Typography> | ||
<Typography variant="body"> | ||
등록 일자 : {item.registrationDate?.format('YYYY/MM/DD').toString()} | ||
</Typography> | ||
<Typography variant="body"> | ||
유통기한 : {item.expirationDate?.format('YYYY/MM/DD').toString()} | ||
</Typography> | ||
</Stack> | ||
</Stack> | ||
); | ||
} | ||
|
||
export default ShortExpirationItem; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters