Skip to content

Commit 12baa13

Browse files
committed
convert content to chakra
1 parent 7f83ddf commit 12baa13

File tree

1 file changed

+22
-27
lines changed

1 file changed

+22
-27
lines changed

src/components/Tooltip.tsx

Lines changed: 22 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,8 @@
11
import React, { ReactNode, useState } from "react"
22
import styled from "@emotion/styled"
3-
import { Box } from "@chakra-ui/react"
3+
import { Box, calc } from "@chakra-ui/react"
44
import * as utils from "../utils/isMobile"
55

6-
const Content = styled.div`
7-
text-align: center;
8-
white-space: normal;
9-
width: 200px;
10-
color: ${({ theme }) => theme.colors.text};
11-
background-color: ${({ theme }) => theme.colors.background};
12-
box-shadow: ${({ theme }) => theme.colors.tableBoxShadow};
13-
position: absolute;
14-
z-index: 10;
15-
padding: 1rem 0.5rem;
16-
text-transform: none;
17-
font-size: ${({ theme }) => theme.fontSizes.s};
18-
font-weight: 500;
19-
cursor: default;
20-
border-radius: 4px;
21-
bottom: calc(100% + 1rem);
22-
left: 25%;
23-
bottom: 125%;
24-
transform: translateX(-50%);
25-
@media (max-width: ${({ theme }) => theme.breakpoints.m}) {
26-
width: 140px;
27-
}
28-
`
29-
306
const Arrow = styled.span`
317
position: absolute;
328
bottom: -0.5rem;
@@ -74,10 +50,29 @@ const Tooltip: React.FC<IProps> = ({ content, children }) => {
7450
>
7551
{children}
7652
{isVisible && (
77-
<Content>
53+
<Box
54+
textAlign="center"
55+
whiteSpace="normal"
56+
w={{ base: "140px", md: "200px" }}
57+
color="text"
58+
bg="background"
59+
boxShadow="tableBoxShadow"
60+
position="absolute"
61+
zIndex="docked"
62+
py={4}
63+
px={2}
64+
textTransform="none"
65+
fontSize="sm"
66+
fontWeight="medium"
67+
cursor="default"
68+
borderRadius="base"
69+
bottom="125%"
70+
left="25%"
71+
transform="translateX(-50%)"
72+
>
7873
<Arrow />
7974
{content}
80-
</Content>
75+
</Box>
8176
)}
8277
</Box>
8378
</>

0 commit comments

Comments
 (0)