Skip to content

Commit 1f95967

Browse files
refactor(meetup-list): apply chakra color mode hooks
1 parent b0d03f9 commit 1f95967

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

src/components/MeetupList.tsx

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88
LinkBox,
99
LinkOverlay,
1010
Text,
11-
useColorMode,
11+
useColorModeValue,
1212
} from "@chakra-ui/react"
1313

1414
// Components
@@ -50,7 +50,11 @@ export interface IProps {}
5050
const MeetupList: React.FC<IProps> = () => {
5151
const [searchField, setSearchField] = useState<string>("")
5252
const filteredMeetups = filterMeetups(searchField)
53-
const { colorMode } = useColorMode()
53+
const listBoxShadow = useColorModeValue("tableBox.light", "tableBox.dark")
54+
const listItemBoxShadow = useColorModeValue(
55+
"tableItemBox.light",
56+
"tableItemBox.dark"
57+
)
5458

5559
const handleSearch = (event: React.ChangeEvent<HTMLInputElement>): void =>
5660
setSearchField(event.target.value)
@@ -74,20 +78,14 @@ const MeetupList: React.FC<IProps> = () => {
7478
_focus={{ outline: "auto 1px" }}
7579
_placeholder={{ color: "text200" }}
7680
/>
77-
<Box
78-
boxShadow={colorMode === "dark" ? "tableBox.dark" : "tableBox.light"}
79-
>
81+
<Box boxShadow={listBoxShadow}>
8082
{filteredMeetups.length ? (
8183
filteredMeetups.map((meetup, idx) => (
8284
<LinkBox
8385
key={idx}
8486
display="flex"
8587
justifyContent="space-between"
86-
boxShadow={
87-
colorMode === "dark"
88-
? "tableItemBox.dark"
89-
: "tableItemBox.light"
90-
}
88+
boxShadow={listItemBoxShadow}
9189
mb={0.25}
9290
p={4}
9391
w="100%"

0 commit comments

Comments
 (0)