CategoryCard.jsx
6 days ago
FAQs.jsx
6 days ago
PaidSupport.jsx
6 days ago
SearchBox.jsx
6 days ago
SupportForum.jsx
6 days ago
TicketModal.jsx
6 days ago
Videos.jsx
6 days ago
CategoryCard.jsx
63 lines
| 1 | /** |
| 2 | * External Dependencies |
| 3 | */ |
| 4 | import { CircleArrowRight } from 'lucide-react'; |
| 5 | |
| 6 | /** |
| 7 | * Internal Dependencies |
| 8 | */ |
| 9 | import { useFetch } from '@admin/hooks/useFetch'; |
| 10 | import { Card } from '@admin/components/Card'; |
| 11 | import { CardSkeleton } from '@admin/components/CardSkeleton'; |
| 12 | |
| 13 | export function CategoryCard( { |
| 14 | title, |
| 15 | icon, |
| 16 | endpoint, |
| 17 | extraArgs, |
| 18 | utms, |
| 19 | viewAll = null, |
| 20 | } ) { |
| 21 | const { data, isLoading } = useFetch( endpoint, extraArgs ); |
| 22 | |
| 23 | return ( |
| 24 | <Card className="advads-card flex flex-col"> |
| 25 | <div> |
| 26 | <Card.Header> |
| 27 | <Card.HeaderIcon size="stroke-gray-700 size-6"> |
| 28 | { icon } |
| 29 | </Card.HeaderIcon> |
| 30 | <Card.HeaderTitle>{ title }</Card.HeaderTitle> |
| 31 | </Card.Header> |
| 32 | { isLoading ? ( |
| 33 | <CardSkeleton /> |
| 34 | ) : ( |
| 35 | <ul> |
| 36 | { data.map( ( item ) => ( |
| 37 | <li |
| 38 | key={ `${ item.ID }-${ item.title?.rendered }` } |
| 39 | > |
| 40 | <a |
| 41 | href={ item.link + utms } |
| 42 | target="_blank" |
| 43 | rel="noopener noreferrer" |
| 44 | > |
| 45 | { item.title?.rendered } |
| 46 | </a> |
| 47 | </li> |
| 48 | ) ) } |
| 49 | </ul> |
| 50 | ) } |
| 51 | </div> |
| 52 | { viewAll && ( |
| 53 | <footer className="mt-auto"> |
| 54 | <a href={ viewAll.link } className="advads-view-all-link"> |
| 55 | { viewAll.label } |
| 56 | <CircleArrowRight /> |
| 57 | </a> |
| 58 | </footer> |
| 59 | ) } |
| 60 | </Card> |
| 61 | ); |
| 62 | } |
| 63 |