Skip to content

Commit

Permalink
make tags on productcard clickable
Browse files Browse the repository at this point in the history
  • Loading branch information
Petter Andersson committed Dec 12, 2024
1 parent 8898998 commit 50fdcd9
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/adverts/components/details/advert-card/TagCard.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,25 @@
import { Chip, PaperProps } from '@mui/material'
import { Advert } from 'adverts'
import { useNavigate } from 'react-router-dom'

export const TagCard = (props: PaperProps & { advert: Advert }) => {
const { tags } = props.advert

const nav = useNavigate()

const clicked = (tag: string) => {
nav(`/browse/#tags=${tag}`)
}
return (
tags.length > 0 && (
<>
{tags.map((v) => (
<Chip label={v} sx={{ mr: 1 }} />
<Chip
clickable
onClick={() => clicked(v)}
label={v}
sx={{ mr: 1 }}
/>
))}
</>
)
Expand Down

0 comments on commit 50fdcd9

Please sign in to comment.