Skip to content

Commit 893e955

Browse files
authored
Merge pull request #13859 from saurabhburade/shadcn-migrate/MeetupList
Shadcn migration - MeetupList
2 parents d821b75 + 470dfa4 commit 893e955

File tree

1 file changed

+35
-77
lines changed

1 file changed

+35
-77
lines changed

src/components/MeetupList.tsx

Lines changed: 35 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,21 @@
11
import { useState } from "react"
22
import sortBy from "lodash/sortBy"
33
import { FaChevronRight } from "react-icons/fa6"
4-
import {
5-
Box,
6-
Flex,
7-
Icon,
8-
LinkBox,
9-
LinkOverlay,
10-
List,
11-
ListItem,
12-
useToken,
13-
VisuallyHidden,
14-
} from "@chakra-ui/react"
154

165
import Emoji from "@/components/Emoji"
176
import InfoBanner from "@/components/InfoBanner"
18-
import Input from "@/components/Input"
19-
import InlineLink, { BaseLink } from "@/components/Link"
20-
import Text from "@/components/OldText"
217
import Translation from "@/components/Translation"
228

9+
import { cn } from "@/lib/utils/cn"
2310
import { trackCustomEvent } from "@/lib/utils/matomo"
2411

2512
import meetups from "@/data/community-meetups.json"
2613

14+
import Input from "../../tailwind/ui/Input"
15+
16+
import { Flex } from "./ui/flex"
17+
import InlineLink, { BaseLink } from "./ui/Link"
18+
2719
export interface Meetup {
2820
title: string
2921
emoji: string
@@ -59,89 +51,55 @@ const MeetupList = () => {
5951
})
6052
}
6153

62-
const primaryBaseColor = useToken("colors", "primary.base")
63-
6454
return (
65-
<Box>
55+
<div>
6656
<Input
67-
mb={6}
57+
className="mb-6 w-full"
6858
onChange={handleSearch}
6959
placeholder={"Search by meetup title or location"}
7060
aria-describedby="input-instruction"
7161
/>
7262
{/* hidden for attachment to input only */}
73-
<VisuallyHidden hidden id="input-instruction">
63+
<span id="input-instruction" className="sr-only">
7464
results update as you type
75-
</VisuallyHidden>
76-
77-
<List
78-
m={0}
79-
border={"2px solid"}
80-
borderColor={"offBackground"}
65+
</span>
66+
<ul
67+
className="m-0 border-2 border-body-light"
8168
aria-label="Event meetup results"
8269
>
8370
{filteredMeetups.map((meetup, idx) => (
84-
<LinkBox
85-
as={ListItem}
71+
<BaseLink
72+
href={meetup.link}
73+
hideArrow
74+
className={cn(
75+
"group mb-[0.25px] flex w-full justify-between p-4 text-current no-underline",
76+
"hover:bg-background-highlight hover:text-current hover:no-underline hover:shadow-[0_0_1px] hover:shadow-primary",
77+
"border-b-2 border-body-light"
78+
)}
8679
key={idx}
87-
display="flex"
88-
justifyContent="space-between"
89-
mb={0.25}
90-
p={4}
91-
w="100%"
92-
_hover={{
93-
textDecoration: "none",
94-
borderRadius: "base",
95-
boxShadow: `0 0 1px ${primaryBaseColor}`,
96-
bg: "tableBackgroundHover",
97-
}}
98-
borderBottom={"2px solid"}
99-
borderColor={"offBackground"}
10080
>
101-
<Flex flex="1 1 75%" me={4}>
102-
<Box me={4} opacity="0.4">
103-
{idx + 1}
104-
</Box>
105-
<Box>
106-
<LinkOverlay
107-
as={BaseLink}
108-
href={meetup.link}
109-
textDecor="none"
110-
color="text"
111-
hideArrow
112-
isExternal
113-
>
81+
<Flex className="me-4 flex-[1_1_75%]">
82+
<div className="me-4 opacity-40">{idx + 1}</div>
83+
<div>
84+
<p className="no-underline group-hover:text-primary-hover group-hover:underline">
11485
{meetup.title}
115-
</LinkOverlay>
116-
</Box>
86+
</p>
87+
</div>
11788
</Flex>
118-
<Flex
119-
textAlign="end"
120-
alignContent="flex-start"
121-
flex="1 1 25%"
122-
me={4}
123-
flexWrap="wrap"
124-
>
89+
<Flex className="me-4 flex-[1_1_25%] flex-wrap content-start items-center text-end">
12590
<Emoji
12691
text={meetup.emoji}
12792
className="me-2 text-md leading-none"
12893
/>
129-
<Text mb={0} opacity={"0.6"}>
130-
{meetup.location}
131-
</Text>
94+
<p className="mb-0 opacity-60">{meetup.location}</p>
13295
</Flex>
133-
<Flex alignItems={"center"}>
134-
<Icon
135-
as={FaChevronRight}
136-
width={{ base: "14px", xl: "18px" }}
137-
height={{ base: "14px", xl: "18px" }}
138-
color={"text"}
139-
/>
96+
<Flex className="items-center">
97+
<FaChevronRight className="h-[14px] w-[14px] xl:h-[18px] xl:w-[18px]" />
14098
</Flex>
141-
</LinkBox>
99+
</BaseLink>
142100
))}
143-
</List>
144-
<Box aria-live="assertive" aria-atomic>
101+
</ul>
102+
<div aria-live="assertive" aria-atomic>
145103
{!filteredMeetups.length && (
146104
<InfoBanner emoji=":information_source:">
147105
<Translation id="page-community:page-community-meetuplist-no-meetups" />{" "}
@@ -150,8 +108,8 @@ const MeetupList = () => {
150108
</InlineLink>
151109
</InfoBanner>
152110
)}
153-
</Box>
154-
</Box>
111+
</div>
112+
</div>
155113
)
156114
}
157115

0 commit comments

Comments
 (0)