Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
frontend
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
vicotor
frontend
Commits
d053f9da
Commit
d053f9da
authored
Feb 12, 2025
by
tom
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix button with tooltip and popover
parent
e8a4fb4d
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
70 additions
and
60 deletions
+70
-60
tooltip.tsx
toolkit/chakra/tooltip.tsx
+1
-2
SolidityscanReport.tsx
ui/address/SolidityscanReport.tsx
+6
-13
AddressEnsDomains.tsx
ui/address/ensDomains/AddressEnsDomains.tsx
+6
-8
CopyToClipboard.tsx
ui/shared/CopyToClipboard.tsx
+1
-0
VerifyWith.tsx
ui/shared/VerifyWith.tsx
+5
-9
SolidityscanReportButton.tsx
ui/shared/solidityscanReport/SolidityscanReportButton.tsx
+30
-28
Button.tsx
ui/showcases/Button.tsx
+21
-0
No files found.
toolkit/chakra/tooltip.tsx
View file @
d053f9da
...
@@ -16,7 +16,6 @@ export interface TooltipProps extends ChakraTooltip.RootProps {
...
@@ -16,7 +16,6 @@ export interface TooltipProps extends ChakraTooltip.RootProps {
disableOnMobile
?:
boolean
;
disableOnMobile
?:
boolean
;
}
}
// TODO @tom2drum fix flashing svg icons when use tooltip (disabled) + popover
export
const
Tooltip
=
React
.
forwardRef
<
HTMLDivElement
,
TooltipProps
>
(
export
const
Tooltip
=
React
.
forwardRef
<
HTMLDivElement
,
TooltipProps
>
(
function
Tooltip
(
props
,
ref
)
{
function
Tooltip
(
props
,
ref
)
{
const
{
const
{
...
@@ -72,7 +71,7 @@ export const Tooltip = React.forwardRef<HTMLDivElement, TooltipProps>(
...
@@ -72,7 +71,7 @@ export const Tooltip = React.forwardRef<HTMLDivElement, TooltipProps>(
open=
{
open
}
open=
{
open
}
onOpenChange=
{
isMobile
?
undefined
:
handleOpenChange
}
onOpenChange=
{
isMobile
?
undefined
:
handleOpenChange
}
closeOnClick=
{
false
}
closeOnClick=
{
false
}
closeOnPointerDown=
{
fals
e
}
closeOnPointerDown=
{
tru
e
}
variant=
{
variant
}
variant=
{
variant
}
lazyMount=
{
lazyMount
}
lazyMount=
{
lazyMount
}
unmountOnExit=
{
unmountOnExit
}
unmountOnExit=
{
unmountOnExit
}
...
...
ui/address/SolidityscanReport.tsx
View file @
d053f9da
...
@@ -7,8 +7,7 @@ import React from 'react';
...
@@ -7,8 +7,7 @@ import React from 'react';
import
solidityScanIcon
from
'
icons/brands/solidity_scan.svg
'
;
import
solidityScanIcon
from
'
icons/brands/solidity_scan.svg
'
;
import
useFetchReport
from
'
lib/solidityScan/useFetchReport
'
;
import
useFetchReport
from
'
lib/solidityScan/useFetchReport
'
;
import
{
Link
}
from
'
toolkit/chakra/link
'
;
import
{
Link
}
from
'
toolkit/chakra/link
'
;
import
{
PopoverBody
,
PopoverContent
,
PopoverRoot
,
PopoverTrigger
}
from
'
toolkit/chakra/popover
'
;
import
{
PopoverBody
,
PopoverContent
,
PopoverRoot
}
from
'
toolkit/chakra/popover
'
;
import
{
useDisclosure
}
from
'
toolkit/hooks/useDisclosure
'
;
import
SolidityscanReportButton
from
'
ui/shared/solidityscanReport/SolidityscanReportButton
'
;
import
SolidityscanReportButton
from
'
ui/shared/solidityscanReport/SolidityscanReportButton
'
;
import
SolidityscanReportDetails
from
'
ui/shared/solidityscanReport/SolidityscanReportDetails
'
;
import
SolidityscanReportDetails
from
'
ui/shared/solidityscanReport/SolidityscanReportDetails
'
;
import
SolidityscanReportScore
from
'
ui/shared/solidityscanReport/SolidityscanReportScore
'
;
import
SolidityscanReportScore
from
'
ui/shared/solidityscanReport/SolidityscanReportScore
'
;
...
@@ -18,7 +17,6 @@ interface Props {
...
@@ -18,7 +17,6 @@ interface Props {
}
}
const
SolidityscanReport
=
({
hash
}:
Props
)
=>
{
const
SolidityscanReport
=
({
hash
}:
Props
)
=>
{
const
{
open
,
onOpenChange
}
=
useDisclosure
();
const
{
data
,
isPlaceholderData
,
isError
}
=
useFetchReport
({
hash
});
const
{
data
,
isPlaceholderData
,
isError
}
=
useFetchReport
({
hash
});
...
@@ -37,16 +35,11 @@ const SolidityscanReport = ({ hash }: Props) => {
...
@@ -37,16 +35,11 @@ const SolidityscanReport = ({ hash }: Props) => {
const
vulnerabilitiesCount
=
vulnerabilitiesCounts
.
reduce
((
acc
,
val
)
=>
acc
+
val
,
0
);
const
vulnerabilitiesCount
=
vulnerabilitiesCounts
.
reduce
((
acc
,
val
)
=>
acc
+
val
,
0
);
return
(
return
(
<
PopoverRoot
onOpenChange=
{
onOpenChange
}
open=
{
open
}
>
<
PopoverRoot
>
<
PopoverTrigger
>
<
SolidityscanReportButton
<
Box
>
score=
{
score
}
<
SolidityscanReportButton
isLoading=
{
isPlaceholderData
}
score=
{
score
}
/>
isLoading=
{
isPlaceholderData
}
isActive=
{
open
}
/>
</
Box
>
</
PopoverTrigger
>
<
PopoverContent
w=
{
{
base
:
'
100vw
'
,
lg
:
'
328px
'
}
}
>
<
PopoverContent
w=
{
{
base
:
'
100vw
'
,
lg
:
'
328px
'
}
}
>
<
PopoverBody
textStyle=
"sm"
>
<
PopoverBody
textStyle=
"sm"
>
<
Box
mb=
{
5
}
lineHeight=
"25px"
>
<
Box
mb=
{
5
}
lineHeight=
"25px"
>
...
...
ui/address/ensDomains/AddressEnsDomains.tsx
View file @
d053f9da
...
@@ -37,8 +37,6 @@ const DomainsGrid = ({ data }: { data: Array<bens.Domain> }) => {
...
@@ -37,8 +37,6 @@ const DomainsGrid = ({ data }: { data: Array<bens.Domain> }) => {
};
};
const
AddressEnsDomains
=
({
query
,
addressHash
,
mainDomainName
}:
Props
)
=>
{
const
AddressEnsDomains
=
({
query
,
addressHash
,
mainDomainName
}:
Props
)
=>
{
// const { isOpen, onToggle, onClose } = useDisclosure();
const
{
data
,
isPending
,
isError
}
=
query
;
const
{
data
,
isPending
,
isError
}
=
query
;
if
(
isError
)
{
if
(
isError
)
{
...
@@ -85,9 +83,9 @@ const AddressEnsDomains = ({ query, addressHash, mainDomainName }: Props) => {
...
@@ -85,9 +83,9 @@ const AddressEnsDomains = ({ query, addressHash, mainDomainName }: Props) => {
return
(
return
(
<
PopoverRoot
>
<
PopoverRoot
>
<
PopoverTrigger
>
<
Tooltip
content=
"List of names resolved or owned by this address"
>
<
Box
>
<
div
>
<
Tooltip
content=
"List of names resolved or owned by this address"
>
<
PopoverTrigger
>
<
Button
<
Button
size=
"sm"
size=
"sm"
variant=
"dropdown"
variant=
"dropdown"
...
@@ -100,9 +98,9 @@ const AddressEnsDomains = ({ query, addressHash, mainDomainName }: Props) => {
...
@@ -100,9 +98,9 @@ const AddressEnsDomains = ({ query, addressHash, mainDomainName }: Props) => {
<
chakra
.
span
hideBelow=
"xl"
>
{
totalRecords
}
Domain
{
data
.
items
.
length
>
1
?
'
s
'
:
''
}
</
chakra
.
span
>
<
chakra
.
span
hideBelow=
"xl"
>
{
totalRecords
}
Domain
{
data
.
items
.
length
>
1
?
'
s
'
:
''
}
</
chakra
.
span
>
<
chakra
.
span
hideFrom=
"xl"
>
{
totalRecords
}
</
chakra
.
span
>
<
chakra
.
span
hideFrom=
"xl"
>
{
totalRecords
}
</
chakra
.
span
>
</
Button
>
</
Button
>
</
Tooltip
>
</
PopoverTrigger
>
</
Box
>
</
div
>
</
PopoverTrigger
>
</
Tooltip
>
<
PopoverContent
w=
{
{
lg
:
'
500px
'
}
}
>
<
PopoverContent
w=
{
{
lg
:
'
500px
'
}
}
>
<
PopoverBody
textStyle=
"sm"
display=
"flex"
flexDir=
"column"
rowGap=
{
5
}
alignItems=
"flex-start"
>
<
PopoverBody
textStyle=
"sm"
display=
"flex"
flexDir=
"column"
rowGap=
{
5
}
alignItems=
"flex-start"
>
{
mainDomain
&&
(
{
mainDomain
&&
(
...
...
ui/shared/CopyToClipboard.tsx
View file @
d053f9da
...
@@ -53,6 +53,7 @@ const CopyToClipboard = (props: Props) => {
...
@@ -53,6 +53,7 @@ const CopyToClipboard = (props: Props) => {
contentProps=
{
{
zIndex
:
'
tooltip2
'
}
}
contentProps=
{
{
zIndex
:
'
tooltip2
'
}
}
open=
{
disclosure
.
open
}
open=
{
disclosure
.
open
}
onOpenChange=
{
disclosure
.
onOpenChange
}
onOpenChange=
{
disclosure
.
onOpenChange
}
closeOnPointerDown=
{
false
}
>
>
<
IconButton
<
IconButton
aria
-
label=
"copy"
aria
-
label=
"copy"
...
...
ui/shared/VerifyWith.tsx
View file @
d053f9da
...
@@ -4,7 +4,6 @@ import React from 'react';
...
@@ -4,7 +4,6 @@ import React from 'react';
import
{
Button
}
from
'
toolkit/chakra/button
'
;
import
{
Button
}
from
'
toolkit/chakra/button
'
;
import
{
PopoverBody
,
PopoverContent
,
PopoverRoot
,
PopoverTrigger
}
from
'
toolkit/chakra/popover
'
;
import
{
PopoverBody
,
PopoverContent
,
PopoverRoot
,
PopoverTrigger
}
from
'
toolkit/chakra/popover
'
;
import
{
Tooltip
}
from
'
toolkit/chakra/tooltip
'
;
import
{
Tooltip
}
from
'
toolkit/chakra/tooltip
'
;
import
{
useDisclosure
}
from
'
toolkit/hooks/useDisclosure
'
;
import
IconSvg
from
'
ui/shared/IconSvg
'
;
import
IconSvg
from
'
ui/shared/IconSvg
'
;
interface
Props
{
interface
Props
{
...
@@ -17,17 +16,14 @@ interface Props {
...
@@ -17,17 +16,14 @@ interface Props {
const
VerifyWith
=
({
className
,
links
,
label
,
longText
,
shortText
}:
Props
)
=>
{
const
VerifyWith
=
({
className
,
links
,
label
,
longText
,
shortText
}:
Props
)
=>
{
const
{
open
,
onOpenChange
}
=
useDisclosure
();
return
(
return
(
<
PopoverRoot
positioning=
{
{
placement
:
'
bottom-start
'
}
}
open=
{
open
}
onOpenChange=
{
onOpenChange
}
>
<
PopoverRoot
>
<
PopoverTrigger
>
<
Tooltip
content=
{
label
}
disableOnMobile
>
<
Box
className=
{
className
}
>
<
Box
className=
{
className
}
>
<
Tooltip
content=
{
label
}
disableOnMobile
disabled=
{
open
}
>
<
PopoverTrigger
>
<
Button
<
Button
size=
"sm"
size=
"sm"
variant=
"dropdown"
variant=
"dropdown"
expanded=
{
open
}
aria
-
label=
{
label
}
aria
-
label=
{
label
}
fontWeight=
{
500
}
fontWeight=
{
500
}
px=
{
shortText
?
2
:
1
}
px=
{
shortText
?
2
:
1
}
...
@@ -38,9 +34,9 @@ const VerifyWith = ({ className, links, label, longText, shortText }: Props) =>
...
@@ -38,9 +34,9 @@ const VerifyWith = ({ className, links, label, longText, shortText }: Props) =>
<
chakra
.
span
hideBelow=
"xl"
>
{
longText
}
</
chakra
.
span
>
<
chakra
.
span
hideBelow=
"xl"
>
{
longText
}
</
chakra
.
span
>
{
shortText
&&
<
chakra
.
span
hideFrom=
"xl"
>
{
shortText
}
</
chakra
.
span
>
}
{
shortText
&&
<
chakra
.
span
hideFrom=
"xl"
>
{
shortText
}
</
chakra
.
span
>
}
</
Button
>
</
Button
>
</
Tooltip
>
</
PopoverTrigger
>
</
Box
>
</
Box
>
</
PopoverTrigger
>
</
Tooltip
>
<
PopoverContent
w=
"auto"
>
<
PopoverContent
w=
"auto"
>
<
PopoverBody
>
<
PopoverBody
>
<
chakra
.
span
color=
"text.secondary"
textStyle=
"xs"
>
{
label
}
</
chakra
.
span
>
<
chakra
.
span
color=
"text.secondary"
textStyle=
"xs"
>
{
label
}
</
chakra
.
span
>
...
...
ui/shared/solidityscanReport/SolidityscanReportButton.tsx
View file @
d053f9da
...
@@ -4,6 +4,7 @@ import React from 'react';
...
@@ -4,6 +4,7 @@ import React from 'react';
import
usePreventFocusAfterModalClosing
from
'
lib/hooks/usePreventFocusAfterModalClosing
'
;
import
usePreventFocusAfterModalClosing
from
'
lib/hooks/usePreventFocusAfterModalClosing
'
;
import
type
{
ButtonProps
}
from
'
toolkit/chakra/button
'
;
import
type
{
ButtonProps
}
from
'
toolkit/chakra/button
'
;
import
{
Button
}
from
'
toolkit/chakra/button
'
;
import
{
Button
}
from
'
toolkit/chakra/button
'
;
import
{
PopoverTrigger
}
from
'
toolkit/chakra/popover
'
;
import
{
Tooltip
}
from
'
toolkit/chakra/tooltip
'
;
import
{
Tooltip
}
from
'
toolkit/chakra/tooltip
'
;
import
IconSvg
from
'
ui/shared/IconSvg
'
;
import
IconSvg
from
'
ui/shared/IconSvg
'
;
...
@@ -13,44 +14,45 @@ interface Props extends ButtonProps {
...
@@ -13,44 +14,45 @@ interface Props extends ButtonProps {
score
:
number
;
score
:
number
;
isLoading
?:
boolean
;
isLoading
?:
boolean
;
onlyIcon
?:
boolean
;
onlyIcon
?:
boolean
;
isActive
?:
boolean
;
label
?:
string
|
React
.
ReactElement
;
label
?:
string
|
React
.
ReactElement
;
}
}
const
SolidityscanReportButton
=
(
const
SolidityscanReportButton
=
(
{
score
,
isLoading
,
onlyIcon
,
isActive
,
label
=
'
Security score
'
,
...
rest
}:
Props
,
{
score
,
isLoading
,
onlyIcon
,
label
=
'
Security score
'
,
...
rest
}:
Props
,
)
=>
{
)
=>
{
const
{
scoreColor
}
=
useScoreLevelAndColor
(
score
);
const
{
scoreColor
}
=
useScoreLevelAndColor
(
score
);
const
colorLoading
=
{
_light
:
'
gray.300
'
,
_dark
:
'
gray.600
'
};
const
colorLoading
=
{
_light
:
'
gray.300
'
,
_dark
:
'
gray.600
'
};
const
onFocusCapture
=
usePreventFocusAfterModalClosing
();
const
onFocusCapture
=
usePreventFocusAfterModalClosing
();
return
(
return
(
<
Tooltip
content=
{
label
}
disableOnMobile
disabled=
{
isActive
}
>
<
Tooltip
content=
{
label
}
disableOnMobile
>
<
Button
<
div
>
color=
{
isLoading
?
colorLoading
:
scoreColor
}
<
PopoverTrigger
>
size=
"sm"
<
Button
variant=
"dropdown"
color=
{
isLoading
?
colorLoading
:
scoreColor
}
expanded=
{
isActive
}
size=
"sm"
aria
-
label=
"SolidityScan score"
variant=
"dropdown"
fontWeight=
{
500
}
aria
-
label=
"SolidityScan score"
px=
"6px"
fontWeight=
{
500
}
flexShrink=
{
0
}
px=
"6px"
columnGap=
{
1
}
flexShrink=
{
0
}
disabled=
{
isLoading
}
columnGap=
{
1
}
_expanded=
{
{
color
:
'
link.primary.hover
'
}
}
disabled=
{
isLoading
}
_disabled=
{
{
_hover=
{
{
color
:
'
link.primary.hover
'
}
}
opacity
:
1
,
_expanded=
{
{
color
:
'
link.primary.hover
'
}
}
_hover
:
{
_disabled=
{
{
color
:
colorLoading
,
opacity
:
1
,
},
_hover
:
{
color
:
colorLoading
},
}
}
}
}
onFocusCapture=
{
onFocusCapture
}
onFocusCapture=
{
onFocusCapture
}
{
...
rest
}
{
...
rest
}
>
>
<
IconSvg
name=
{
score
<
80
?
'
score/score-not-ok
'
:
'
score/score-ok
'
}
boxSize=
{
5
}
/>
<
IconSvg
name=
{
score
<
80
?
'
score/score-not-ok
'
:
'
score/score-ok
'
}
boxSize=
{
5
}
/>
{
isLoading
&&
<
Spinner
size=
"sm"
/>
}
{
isLoading
&&
<
Spinner
size=
"sm"
/>
}
{
!
isLoading
&&
(
onlyIcon
?
null
:
score
)
}
{
!
isLoading
&&
(
onlyIcon
?
null
:
score
)
}
</
Button
>
</
Button
>
</
PopoverTrigger
>
</
div
>
</
Tooltip
>
</
Tooltip
>
);
);
};
};
...
...
ui/showcases/Button.tsx
View file @
d053f9da
...
@@ -2,9 +2,12 @@ import React from 'react';
...
@@ -2,9 +2,12 @@ import React from 'react';
import
{
Button
}
from
'
toolkit/chakra/button
'
;
import
{
Button
}
from
'
toolkit/chakra/button
'
;
import
{
Checkbox
}
from
'
toolkit/chakra/checkbox
'
;
import
{
Checkbox
}
from
'
toolkit/chakra/checkbox
'
;
import
{
IconButton
}
from
'
toolkit/chakra/icon-button
'
;
import
{
Link
}
from
'
toolkit/chakra/link
'
;
import
{
Link
}
from
'
toolkit/chakra/link
'
;
import
{
PopoverContent
,
PopoverRoot
,
PopoverTrigger
,
PopoverBody
}
from
'
toolkit/chakra/popover
'
;
import
{
PopoverContent
,
PopoverRoot
,
PopoverTrigger
,
PopoverBody
}
from
'
toolkit/chakra/popover
'
;
import
{
Tooltip
}
from
'
toolkit/chakra/tooltip
'
;
import
{
BACKGROUND_DEFAULT
}
from
'
ui/home/HeroBanner
'
;
import
{
BACKGROUND_DEFAULT
}
from
'
ui/home/HeroBanner
'
;
import
IconSvg
from
'
ui/shared/IconSvg
'
;
import
{
Section
,
Container
,
SectionHeader
,
SamplesStack
,
Sample
,
SectionSubHeader
}
from
'
./parts
'
;
import
{
Section
,
Container
,
SectionHeader
,
SamplesStack
,
Sample
,
SectionSubHeader
}
from
'
./parts
'
;
...
@@ -95,6 +98,24 @@ const ButtonShowcase = () => {
...
@@ -95,6 +98,24 @@ const ButtonShowcase = () => {
</
PopoverContent
>
</
PopoverContent
>
</
PopoverRoot
>
</
PopoverRoot
>
<
Button
variant=
"dropdown"
disabled
>
Disabled
</
Button
>
<
Button
variant=
"dropdown"
disabled
>
Disabled
</
Button
>
<
PopoverRoot
>
<
Tooltip
content=
"Tooltip content"
>
<
div
>
<
PopoverTrigger
>
<
IconButton
variant=
"dropdown"
size=
"md"
px=
{
2
}
>
<
IconSvg
name=
"explorer"
boxSize=
{
5
}
/>
With tooltip
</
IconButton
>
</
PopoverTrigger
>
</
div
>
</
Tooltip
>
<
PopoverContent
>
<
PopoverBody
>
Popover content
</
PopoverBody
>
</
PopoverContent
>
</
PopoverRoot
>
</
Sample
>
</
Sample
>
<
Sample
label=
"variant: header"
>
<
Sample
label=
"variant: header"
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment