Skip to content

Commit a7a67fc

Browse files
committed
migrate ProductList component to tailwind
1 parent 1e68862 commit a7a67fc

File tree

1 file changed

+25
-66
lines changed

1 file changed

+25
-66
lines changed

src/components/ProductList.tsx

Lines changed: 25 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,10 @@
1-
import {
2-
Box,
3-
Flex,
4-
List,
5-
ListItem,
6-
useColorModeValue,
7-
VisuallyHidden,
8-
} from "@chakra-ui/react"
1+
import type { ImageProps } from "next/image"
2+
import { VisuallyHidden } from "@radix-ui/react-visually-hidden"
93

10-
import { ButtonLink } from "@/components/Buttons"
11-
import { Image, type ImageProps } from "@/components/Image"
12-
import OldHeading from "@/components/OldHeading"
4+
import { ButtonLink } from "./ui/buttons/Button"
5+
import { Flex } from "./ui/flex"
6+
import { List, ListItem } from "./ui/list"
7+
import { TwImage } from "./Image"
138

149
type Content = {
1510
title: string
@@ -27,85 +22,49 @@ export type ProductListProps = {
2722
}
2823

2924
const ProductList = ({ actionLabel, content, category }: ProductListProps) => {
30-
const shadow = useColorModeValue("tableBox.light", "tableBox.dark")
31-
3225
const CATEGORY_NAME = "category-name"
3326

3427
return (
35-
<Box boxSize="full">
36-
<OldHeading
37-
as="h3"
28+
<div className="w-full">
29+
<h3
3830
id={CATEGORY_NAME}
39-
fontSize="2xl"
40-
borderBottom="2px solid"
41-
borderColor="border"
42-
paddingBottom={4}
43-
marginBottom={0}
31+
className="mb-0 mt-10 border-b-2 border-border pb-4 text-2xl"
4432
>
4533
{category}
46-
</OldHeading>
47-
<Flex
48-
as={List}
49-
aria-labelledby={CATEGORY_NAME}
50-
m={0}
51-
flexDirection="column"
52-
height="inherit"
53-
>
34+
</h3>
35+
<List aria-labelledby={CATEGORY_NAME} className="m-0 flex-col">
5436
{content.map(({ title, description, link, image, alt, id }, idx) => (
55-
<Flex
56-
as={ListItem}
57-
key={id || idx}
58-
color="text"
59-
marginBottom="px"
60-
marginTop={8}
61-
height="inherit"
62-
>
63-
<Box width="5rem">
37+
<ListItem key={id || idx} color="text" className="mb-0 mt-8 flex">
38+
<div className="w-20">
6439
{image && (
65-
<Image
40+
<TwImage
6641
src={image}
6742
alt={alt}
6843
width={66}
69-
boxShadow={shadow}
70-
borderRadius="sm"
44+
className="rounded-sm shadow-lg dark:shadow-body-light"
7145
/>
7246
)}
73-
</Box>
74-
<Flex
75-
justifyContent="space-between"
76-
flexDir={{ base: "column", sm: "row" }}
77-
paddingBottom={4}
78-
width="full"
79-
ms={{ base: 4, sm: 6 }}
80-
borderBottom="1px solid"
81-
borderColor="border"
82-
>
83-
<Box flex={1}>
84-
<Box>{title}</Box>
85-
<Box fontSize="sm" marginBottom={0} opacity="0.6">
86-
{description}
87-
</Box>
88-
</Box>
47+
</div>
48+
<Flex className="ms-4 w-full flex-col justify-between border-b border-border pb-4 sm:ms-6 sm:flex-row">
49+
<div className="flex-1">
50+
<div>{title}</div>
51+
<div className="mb-0 text-sm opacity-60">{description}</div>
52+
</div>
8953
{link && (
9054
<ButtonLink
9155
variant="outline"
9256
href={link}
93-
alignSelf="center"
94-
ms={{ base: 0, sm: 8 }}
95-
paddingY={1}
96-
paddingX={6}
97-
borderRadius="sm"
98-
marginTop={{ base: 4, sm: 0 }}
57+
className="ms-0 mt-4 min-h-fit gap-0 self-center rounded-sm px-6 py-1 sm:ms-8 sm:mt-0"
9958
>
10059
{actionLabel}
10160
<VisuallyHidden>to {title} website</VisuallyHidden>
10261
</ButtonLink>
10362
)}
10463
</Flex>
105-
</Flex>
64+
</ListItem>
10665
))}
107-
</Flex>
108-
</Box>
66+
</List>
67+
</div>
10968
)
11069
}
11170

0 commit comments

Comments
 (0)