-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathChakraButton.tsx
More file actions
59 lines (57 loc) · 1.51 KB
/
ChakraButton.tsx
File metadata and controls
59 lines (57 loc) · 1.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import { Button, LinkBox, LinkOverlay } from "@chakra-ui/react";
import Image from "next/image";
import Link from "next/link";
type ButtonProps = {
href: string;
color: string; //ex: lowercase 'blue'
label: string;
width?: string;
minW?: string;
iconSrc?: string;
};
export default function ChakraButton({ href, color, label, width, minW, iconSrc }: ButtonProps) {
return (
<LinkBox>
<LinkOverlay as={Link} href={href}>
<Button
w="full"
size="lg"
width={width}
minW={minW}
py={8}
position="relative"
overflow="hidden" // keeps the bottom highlight stroke within the button
borderRadius="18px"
bg={`${color}.500`}
color="white"
fontSize="lg"
fontWeight="900"
letterSpacing="0.05em"
_hover={{ bg: `${color}.600` }}
boxShadow="0 14px 28px rgba(15, 23, 42, 0.16)"
_after={{
content: '""',
position: "absolute",
left: 0,
right: 0,
bottom: 0,
height: "8px",
bg: "rgba(0,0,0,0.12)",
pointerEvents: "none",
}}
>
{iconSrc && (
<Image
src={iconSrc}
alt={`${label} icon`}
width={22}
height={22}
style={{ objectFit: "contain", display: "block" }}
/>
)}
{label}
</Button>
</LinkOverlay>
</LinkBox>
);
}