Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update tooltip component based on new DS #10974

Merged
merged 42 commits into from
Mar 8, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
89aff2f
update tooltip component based on new DS
amit-ksh Aug 21, 2023
381ccdd
fix: overflow of page by tooltip
amit-ksh Aug 21, 2023
a5f33e6
using the Chakra tooltip component
amit-ksh Aug 29, 2023
4625542
add the tooltip story
amit-ksh Aug 29, 2023
1e3398b
Improve type safety for storybook
amit-ksh Sep 4, 2023
3fe91d6
Improve type safety for storybook
amit-ksh Sep 4, 2023
fd4d88d
Use Story args for better type safety
amit-ksh Sep 4, 2023
c98e4f3
Update tooltip boxShadow
amit-ksh Sep 4, 2023
4abda57
Use Chakra Popover for Tooltip component
amit-ksh Sep 8, 2023
34f29d0
Update tooltip active state style
amit-ksh Sep 11, 2023
d17b033
Remove duplicate import
amit-ksh Sep 15, 2023
9cd1359
Remove unused code
amit-ksh Sep 15, 2023
56b5efa
Use popover zIndex
amit-ksh Sep 15, 2023
a0f37a4
Use popover zIndex
amit-ksh Sep 15, 2023
6318c50
Add new tooltip story
amit-ksh Sep 15, 2023
63013ae
revert tooltip removal
pettinarip Sep 19, 2023
41c3b25
Merge branch 'dev' into new-ds/tooltip
pettinarip Sep 19, 2023
a47b8c8
add new stories
pettinarip Sep 20, 2023
0124b47
Remove tooltip title attribute
amit-ksh Sep 20, 2023
d3a575e
Merge branch 'dev' into new-ds/tooltip
pettinarip Nov 3, 2023
cc6d4be
place zindex in popover container
pettinarip Nov 3, 2023
3293087
set maxW in tooltip content
pettinarip Nov 3, 2023
86f32f2
remove unnecessary styles
pettinarip Nov 3, 2023
c9f2f01
adjust tooltip base styles
pettinarip Nov 3, 2023
27f4fe8
remove centered style
pettinarip Nov 3, 2023
30054d8
adapt new tooltip in codebase
pettinarip Nov 3, 2023
d601f56
adjust tooltip anchors
pettinarip Nov 8, 2023
12f864e
fix storybook
pettinarip Nov 8, 2023
d6c18b1
Merge branch 'dev' into new-ds/tooltip
pettinarip Mar 4, 2024
2b53d8e
fixes after dev merge
pettinarip Mar 4, 2024
40ec410
replace old tooltip with new one
pettinarip Mar 4, 2024
8523f2e
share styles and adapt previous popovers
pettinarip Mar 4, 2024
4ac95b0
adjust popover default dimensions
pettinarip Mar 5, 2024
2bd7d6f
fix stats grid to display tooltip in the correct position
pettinarip Mar 5, 2024
d9818a7
Merge branch 'dev' into new-ds/tooltip
pettinarip Mar 7, 2024
e446117
fix tooltip positioning in ethpricecard
pettinarip Mar 7, 2024
7c4755a
fix translation
pettinarip Mar 7, 2024
a3854e4
add default styles to tooltip
pettinarip Mar 7, 2024
c32b1ac
Merge branch 'dev' into new-ds/tooltip
pettinarip Mar 8, 2024
ffa36de
add tooltip body base styles
pettinarip Mar 8, 2024
8bf4efc
fix lineheight in find wallet tooltips
pettinarip Mar 8, 2024
db12afd
add wrapper on glossary tooltip to avoid text wrapping in a new line …
pettinarip Mar 8, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions src/@chakra-ui/gatsby-plugin/components/Tooltip.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import {
cssVar,
defineStyle,
defineStyleConfig,
getToken,
} from "@chakra-ui/react"

const $arrowBg = cssVar("popper-arrow-bg")

const baseStyle = defineStyle((props) => {
const tableBoxShadow = getToken("colors", "tableBoxShadow")(props.theme)

return {
w: 44,
maxW: 48,
p: 2,
bg: "background.highlight",
fontSize: "sm",
fontWeight: "normal",
borderRadius: "base",
cursor: "default",
textAlign: "center",
zIndex: "docked",
boxShadow: tableBoxShadow,
[$arrowBg.variable]: "colors.background.highlight",
}
})

export const Tooltip = defineStyleConfig({
baseStyle,
})
2 changes: 2 additions & 0 deletions src/@chakra-ui/gatsby-plugin/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { Radio } from "./Radio"
import { Select } from "./Select"
import { Switch } from "./Switch"
import { Input } from "./Input"
import { Tooltip } from "./Tooltip"
import {
accordionDefaultTheme,
breadcrumbDefaultTheme,
Expand Down Expand Up @@ -54,4 +55,5 @@ export default {
Table,
Tabs,
Tag,
Tooltip,
}
86 changes: 0 additions & 86 deletions src/components/Tooltip.tsx

This file was deleted.

23 changes: 23 additions & 0 deletions src/components/Tooltip/Tooltip.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import * as React from "react"
import { Meta, StoryObj } from "@storybook/react"
import { Icon } from "@chakra-ui/react"
import TooltipComponent from "."

type TooltipType = typeof TooltipComponent

const meta: Meta<TooltipType> = {
title: "Molecules / Overlay Content / Tooltip",
component: TooltipComponent,
}

export default meta

type Story = StoryObj<TooltipType>

export const Tooltip: Story = {
render: () => (
<TooltipComponent content="Text here">
<Icon fill="'text" name="info" />
</TooltipComponent>
),
}
48 changes: 48 additions & 0 deletions src/components/Tooltip/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import React, { ReactNode } from "react"
import { Box, Center, Tooltip as ChakraTooltip } from "@chakra-ui/react"
import * as utils from "../../utils/isMobile"

export interface IProps {
content: ReactNode
children?: React.ReactNode
}

const Tooltip: React.FC<IProps> = ({ content, children }) => {
const isMobile = utils.isMobile()

return (
<Box title="More Info!" display="inline-block" ml={2}>
<ChakraTooltip label={content} placement="top" hasArrow>
<Center
as="span"
tabIndex={0}
p={1}
cursor="pointer"
color="body.base"
_hover={{
color: isMobile ? "primary.hover" : "primary.base",
}}
_focusVisible={{
outline: "none",
color: "primary.base",
border: "2px",
borderColor: "primary.hover",
borderRadius: "full",
}}
sx={{
svg: {
w: 3,
h: 3,
ml: 0,
color: "inherit",
},
}}
>
{children}
</Center>
</ChakraTooltip>
</Box>
)
}

export default Tooltip