-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: before search/after search page, add router with params
- Loading branch information
Showing
17 changed files
with
607 additions
and
134 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,56 @@ | ||
import React from 'react' | ||
import { cls } from '../../utils' | ||
import heart from '/public/assets/heart-on.svg' | ||
|
||
function Card({ data, purchase }) { | ||
const { brand, productName, thumbnail, price, sale } = data | ||
const saleCost = parseInt((price * (100 - sale)) / 100) | ||
|
||
return ( | ||
<div> | ||
<div className="relative"> | ||
<div className="w-full bg-cover overflow-hidden relative justify-center after:content('') after:block after:pb-[100%]"> | ||
<img src={thumbnail} alt={productName} className="absolute" /> | ||
</div> | ||
{!purchase && ( | ||
<div className="absolute w-[13%] max-w-[35px] top-2.5 right-2.5"> | ||
<img src={heart} alt="heart" /> | ||
</div> | ||
)} | ||
</div> | ||
<div className={purchase ? '' : 'px-5 py-2.5'}> | ||
<div> | ||
<div | ||
className={cls( | ||
'font-bold', | ||
purchase ? 'text-xs pt-2 pb-1 truncate' : 'text-sm', | ||
)} | ||
> | ||
{brand} | ||
</div> | ||
<div | ||
className={cls( | ||
'font-normal text-black-800', | ||
purchase | ||
? 'text-[10px] overflow-hidden line-clamp-2 md:line-clamp-none' | ||
: 'text-xs truncate', | ||
)} | ||
> | ||
{productName} | ||
</div> | ||
{!purchase && ( | ||
<div className="test-xs font-medium text-black-600">{price} ¥</div> | ||
)} | ||
</div> | ||
{!purchase && ( | ||
<div className="flex text-sm font-bold"> | ||
<div className="text-primary mr-3">{sale}%</div> | ||
<div className="text-black-100">{saleCost} ¥</div> | ||
</div> | ||
)} | ||
</div> | ||
</div> | ||
) | ||
} | ||
|
||
export default Card |
6 changes: 3 additions & 3 deletions
6
src/components/Category/Container.jsx → src/components/CardList/Container.jsx
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 was deleted.
Oops, something went wrong.
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
Oops, something went wrong.