mirror of
https://github.com/pheralb/svgl.git
synced 2025-02-06 06:58:04 +08:00
refactor: add categories active indicator
This commit is contained in:
parent
b66e1100b7
commit
260246355d
@ -5,11 +5,12 @@ import CustomLink from "@/common/link";
|
||||
import { Box, useColorModeValue } from "@chakra-ui/react";
|
||||
import { RaceBy } from "@uiball/loaders";
|
||||
import Tap from "@/animations/tap";
|
||||
import { useRouter } from "next/router";
|
||||
|
||||
const Categories = () => {
|
||||
const { data, error } = useSWR(getCategorySvgs);
|
||||
const color = useColorModeValue("rgb(0,0,0, .1)", "rgb(255,255,255, .1)");
|
||||
|
||||
const router = useRouter();
|
||||
if (error) return <div>failed to load</div>;
|
||||
if (!data)
|
||||
return <RaceBy size={52} lineWeight={3} speed={1.4} color="#4343E5" />;
|
||||
@ -23,6 +24,14 @@ const Categories = () => {
|
||||
p={4}
|
||||
borderRadius="4px"
|
||||
borderWidth="1px"
|
||||
__css={
|
||||
router.asPath === `/category/${category}`
|
||||
? {
|
||||
backgroundColor: '#4343e5',
|
||||
color: '#fff'
|
||||
}
|
||||
: {}
|
||||
}
|
||||
_hover={{
|
||||
border:`1px solid ${color}`,
|
||||
transform: "scale(0.98)",
|
||||
|
Loading…
x
Reference in New Issue
Block a user