-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(frontend): add locked balance tooltip (#235)
- Loading branch information
1 parent
7809040
commit 7d1fa86
Showing
10 changed files
with
139 additions
and
111 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import { Tooltip } from './tooltip'; | ||
|
||
export { Tooltip }; |
File renamed without changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
.container, | ||
.skeleton { | ||
flex-shrink: 0; | ||
} | ||
|
||
.container { | ||
display: flex; | ||
|
||
position: relative; | ||
|
||
svg { | ||
transition: 0.25s opacity; | ||
|
||
&:hover { | ||
opacity: 0.75; | ||
} | ||
} | ||
|
||
&:hover { | ||
.tooltip { | ||
opacity: 1; | ||
} | ||
} | ||
} | ||
|
||
.tooltip { | ||
position: absolute; | ||
|
||
padding: 10px 16px; | ||
|
||
display: flex; | ||
flex-direction: column; | ||
gap: 4px; | ||
|
||
font-size: 14px; | ||
font-weight: 400; | ||
line-height: 20px; | ||
color: #fff; | ||
white-space: nowrap; | ||
|
||
background-color: #000; | ||
border-radius: 4px; | ||
box-shadow: 0px 8px 16px 0px rgba(#000, 0.24); | ||
|
||
opacity: 0; | ||
pointer-events: none; | ||
transition: 0.25s opacity; | ||
} | ||
|
||
.top { | ||
bottom: calc(100% + 8px); | ||
left: 50%; | ||
transform: translateX(-50%); | ||
} | ||
|
||
.bottom-end { | ||
top: calc(100% + 8px); | ||
right: 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { ReactNode } from 'react'; | ||
|
||
import { SVGComponent } from '@/types'; | ||
import { cx } from '@/utils'; | ||
|
||
import { Skeleton } from '../layout'; | ||
|
||
import QuestionSVG from './question.svg?react'; | ||
import styles from './tooltip.module.scss'; | ||
|
||
type BaseProps = { | ||
text?: string; | ||
children?: ReactNode; | ||
position?: 'top' | 'bottom-end'; | ||
SVG?: SVGComponent; | ||
}; | ||
|
||
type TextProps = BaseProps & { text: string }; | ||
type ChildrenProps = BaseProps & { children: ReactNode }; | ||
type Props = TextProps | ChildrenProps; | ||
|
||
function Tooltip({ text, children, position = 'top', SVG = QuestionSVG }: Props) { | ||
return ( | ||
<div className={styles.container}> | ||
<SVG /> | ||
|
||
<div className={cx(styles.tooltip, styles[position])}> | ||
{text ? <p className={styles.heading}>{text}</p> : children} | ||
</div> | ||
</div> | ||
); | ||
} | ||
|
||
function TooltipSkeleton({ disabled }: { disabled?: boolean }) { | ||
return <Skeleton width="14px" height="14px" borderRadius="50%" className={styles.skeleton} disabled={disabled} />; | ||
} | ||
|
||
Tooltip.Skeleton = TooltipSkeleton; | ||
|
||
export { Tooltip }; |
77 changes: 1 addition & 76 deletions
77
frontend/src/features/swap/components/ft-allowance-tip/ft-allowance-tip.module.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,82 +1,7 @@ | ||
.container, | ||
.skeleton { | ||
flex-shrink: 0; | ||
} | ||
|
||
.container { | ||
display: flex; | ||
|
||
position: relative; | ||
|
||
svg { | ||
cursor: pointer; | ||
transition: 0.25s opacity; | ||
|
||
&:hover { | ||
opacity: 0.75; | ||
} | ||
} | ||
|
||
&:hover { | ||
.tooltip { | ||
opacity: 1; | ||
} | ||
} | ||
} | ||
|
||
.tooltip { | ||
position: absolute; | ||
bottom: 100%; | ||
left: 50%; | ||
transform: translate(-50%, -4px); | ||
|
||
padding: 8px 12px; | ||
|
||
display: flex; | ||
flex-direction: column; | ||
gap: 4px; | ||
|
||
background-color: #fff; | ||
border-radius: 6px; | ||
box-shadow: 0px 0px 28px 0px #00000033; | ||
|
||
opacity: 0; | ||
pointer-events: none; | ||
transition: 0.25s opacity; | ||
|
||
&::before { | ||
content: ''; | ||
|
||
position: absolute; | ||
top: 0; | ||
right: 0; | ||
bottom: 0; | ||
left: 0; | ||
|
||
width: calc(100% - 12px); | ||
height: calc(100% - 8px); | ||
margin: auto; | ||
|
||
background-image: linear-gradient(164.33deg, rgba(14, 211, 163, 0.1) 9.48%, rgba(242, 242, 242, 0.1) 31.6%); | ||
border-radius: inherit; | ||
} | ||
} | ||
|
||
.heading, | ||
.subheading { | ||
white-space: nowrap; | ||
} | ||
|
||
.heading { | ||
font-weight: 500; | ||
opacity: 0.9; | ||
} | ||
|
||
.subheading { | ||
opacity: 0.75; | ||
} | ||
|
||
.disabled { | ||
opacity: 0.25; | ||
pointer-events: none; | ||
opacity: 0.85; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions
5
frontend/src/features/token-tracker/components/token-tracker/token-tracker.module.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
.container { | ||
display: flex; | ||
align-items: flex-start; | ||
gap: 4px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters