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
67f0e1c2
Commit
67f0e1c2
authored
Feb 14, 2025
by
tom
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix offsets of grouped inputs
parent
03c9e582
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
50 additions
and
36 deletions
+50
-36
input-group.tsx
toolkit/chakra/input-group.tsx
+23
-4
ContractMethodFieldInput.tsx
...ddress/contract/methods/form/ContractMethodFieldInput.tsx
+1
-1
TokenSelectMenu.tsx
ui/address/tokenSelect/TokenSelectMenu.tsx
+0
-1
RewardsReadOnlyInputWithCopy.tsx
ui/rewards/RewardsReadOnlyInputWithCopy.tsx
+1
-1
ClearButton.tsx
ui/shared/ClearButton.tsx
+4
-2
FilterInput.tsx
ui/shared/filters/FilterInput.tsx
+1
-3
CodeEditorSearch.tsx
ui/shared/monaco/CodeEditorSearch.tsx
+0
-1
SearchBarInput.tsx
ui/snippets/searchBar/SearchBarInput.tsx
+17
-21
SearchBarRecentKeywords.tsx
ui/snippets/searchBar/SearchBarRecentKeywords.tsx
+3
-2
No files found.
toolkit/chakra/input-group.tsx
View file @
67f0e1c2
...
...
@@ -27,10 +27,29 @@ export const InputGroup = React.forwardRef<HTMLDivElement, InputGroupProps>(
endOffset
,
...
rest
}
=
props
;
const
startElementRef
=
React
.
useRef
<
HTMLDivElement
>
(
null
);
const
endElementRef
=
React
.
useRef
<
HTMLDivElement
>
(
null
);
const
[
inlinePaddings
,
setInlinePaddings
]
=
React
.
useState
({
start
:
0
,
end
:
0
,
});
React
.
useEffect
(()
=>
{
const
{
width
:
endWidth
}
=
endElementRef
?.
current
?.
getBoundingClientRect
()
??
{};
const
{
width
:
startWidth
}
=
startElementRef
?.
current
?.
getBoundingClientRect
()
??
{};
setInlinePaddings
({
start
:
startWidth
??
0
,
end
:
endWidth
??
0
,
});
},
[]);
return
(
<
Group
ref=
{
ref
}
w=
"100%"
{
...
rest
}
>
{
startElement
&&
(
<
InputElement
pointerEvents=
"none"
{
...
startElementProps
}
>
<
InputElement
pointerEvents=
"none"
ref=
{
startElementRef
}
{
...
startElementProps
}
>
{
startElement
}
</
InputElement
>
)
}
...
...
@@ -39,12 +58,12 @@ export const InputGroup = React.forwardRef<HTMLDivElement, InputGroupProps>(
return
child
;
}
return
React
.
cloneElement
(
child
,
{
...(
startElement
&&
{
ps
:
startOffset
??
`
calc(var(--input-height) - 6px)
`
}),
...(
endElement
&&
{
pe
:
endOffset
??
`
calc(var(--input-height) - 6px)
`
}),
...(
startElement
&&
{
ps
:
startOffset
??
`
${ inlinePaddings.start }px
`
}),
...(
endElement
&&
{
pe
:
endOffset
??
`
${ inlinePaddings.end }px
`
}),
});
})
}
{
endElement
&&
(
<
InputElement
placement=
"end"
{
...
endElementProps
}
>
<
InputElement
placement=
"end"
ref=
{
endElementRef
}
{
...
endElementProps
}
>
{
endElement
}
</
InputElement
>
)
}
...
...
ui/address/contract/methods/form/ContractMethodFieldInput.tsx
View file @
67f0e1c2
...
...
@@ -131,7 +131,7 @@ const ContractMethodFieldInput = ({ data, hideLabel, path: name, className, isDi
const
inputEndElement
=
(
<
Flex
alignItems=
"center"
>
{
field
.
value
!==
undefined
&&
field
.
value
!==
''
&&
<
ClearButton
onClick=
{
handleClear
}
isDisabled=
{
isDisabled
}
boxSize=
{
6
}
/>
}
<
ClearButton
onClick=
{
handleClear
}
isDisabled=
{
isDisabled
}
boxSize=
{
6
}
isVisible=
{
field
.
value
!==
undefined
&&
field
.
value
!==
''
}
/>
{
data
.
type
===
'
address
'
&&
<
ContractMethodAddressButton
onClick=
{
handleAddressButtonClick
}
isDisabled=
{
isDisabled
}
/>
}
{
argTypeMatchInt
&&
!
isNativeCoin
&&
(
hasTimestampButton
?
(
<
Button
...
...
ui/address/tokenSelect/TokenSelectMenu.tsx
View file @
67f0e1c2
...
...
@@ -32,7 +32,6 @@ const TokenSelectMenu = ({ erc20sort, erc1155sort, erc404sort, filteredData, onI
<>
<
InputGroup
startElement=
{
<
IconSvg
name=
"search"
boxSize=
{
4
}
color=
{
{
_light
:
'
blackAlpha.600
'
,
_dark
:
'
whiteAlpha.600
'
}
}
/>
}
startOffset=
"38px"
mb=
{
5
}
>
<
Input
placeholder=
"Search by token name"
onChange=
{
onInputChange
}
size=
"sm"
bgColor=
"dialog.bg"
/>
...
...
ui/rewards/RewardsReadOnlyInputWithCopy.tsx
View file @
67f0e1c2
...
...
@@ -18,7 +18,7 @@ const RewardsReadOnlyInputWithCopy = ({ label, value, className, isLoading }: Pr
return
(
<
Skeleton
loading=
{
isLoading
}
className=
{
className
}
>
<
Field
label=
{
label
}
floating
size=
"xl"
readOnly
>
<
InputGroup
endElement=
{
<
CopyToClipboard
text=
{
value
}
/>
}
endOffset=
"40px"
>
<
InputGroup
endElement=
{
<
CopyToClipboard
text=
{
value
}
/>
}
>
<
Input
value=
{
value
}
fontWeight=
"500"
overflow=
"hidden"
textOverflow=
"ellipsis"
/>
</
InputGroup
>
</
Field
>
...
...
ui/shared/ClearButton.tsx
View file @
67f0e1c2
...
...
@@ -8,17 +8,19 @@ interface Props {
onClick
:
(
e
:
React
.
SyntheticEvent
)
=>
void
;
isDisabled
?:
boolean
;
className
?:
string
;
isVisible
?:
boolean
;
}
const
ClearButton
=
({
onClick
,
isDisabled
,
className
}:
Props
)
=>
{
const
ClearButton
=
({
onClick
,
isDisabled
,
isVisible
=
true
,
className
}:
Props
)
=>
{
return
(
<
IconButton
disabled=
{
isDisabled
}
disabled=
{
isDisabled
||
!
isVisible
}
className=
{
className
}
aria
-
label=
"Clear input"
title=
"Clear input"
size=
"sm"
onClick=
{
onClick
}
opacity=
{
isVisible
?
1
:
0
}
>
<
IconSvg
name=
"status/error"
...
...
ui/shared/filters/FilterInput.tsx
View file @
67f0e1c2
...
...
@@ -37,7 +37,7 @@ const FilterInput = ({ onChange, size = 'sm', placeholder, initialValue, type, n
const
startElement
=
<
IconSvg
name=
"search"
color=
{
{
_light
:
'
blackAlpha.600
'
,
_dark
:
'
whiteAlpha.600
'
}
}
boxSize=
{
4
}
/>;
const
endElement
=
filterQuery
?
<
ClearButton
onClick=
{
handleFilterQueryClear
}
/>
:
null
;
const
endElement
=
<
ClearButton
onClick=
{
handleFilterQueryClear
}
isVisible=
{
filterQuery
.
length
>
0
}
/>
;
return
(
<
Skeleton
...
...
@@ -49,10 +49,8 @@ const FilterInput = ({ onChange, size = 'sm', placeholder, initialValue, type, n
<
InputGroup
startElement=
{
startElement
}
startElementProps=
{
{
px
:
2
}
}
startOffset=
"32px"
endElement=
{
endElement
}
endElementProps=
{
{
px
:
0
,
w
:
'
32px
'
}
}
endOffset=
"32px"
>
<
Input
ref=
{
inputRef
}
...
...
ui/shared/monaco/CodeEditorSearch.tsx
View file @
67f0e1c2
...
...
@@ -206,7 +206,6 @@ const CodeEditorSearch = ({ monaco, data, onFileSelect, isInputStuck, isActive,
boxShadow=
{
isInputStuck
?
'
0px 6px 3px 0px rgba(0, 0, 0, 0.05)
'
:
'
none
'
}
endElement=
{
inputEndElement
}
endElementProps=
{
{
height
:
'
26px
'
,
pl
:
'
0
'
,
pr
:
'
10px
'
,
columnGap
:
'
2px
'
}
}
endOffset=
"75px"
>
<
Input
size=
"xs"
...
...
ui/snippets/searchBar/SearchBarInput.tsx
View file @
67f0e1c2
...
...
@@ -109,27 +109,24 @@ const SearchBarInput = (
);
const
endElement
=
(()
=>
{
if
(
value
)
{
return
<
ClearButton
onClick=
{
onClear
}
/>;
}
if
(
isMobile
)
{
return
null
;
}
return
(
<
Center
boxSize=
"20px"
my=
"2px"
mr=
{
{
base
:
1
,
lg
:
isHomepage
?
2
:
1
}
}
borderRadius=
"sm"
borderWidth=
"1px"
borderColor=
"gray.400"
color=
"gray.400"
display=
{
{
base
:
'
none
'
,
lg
:
'
flex
'
}
}
>
/
</
Center
>
<>
<
ClearButton
onClick=
{
onClear
}
isVisible=
{
value
.
length
>
0
}
/>
{
!
isMobile
&&
(
<
Center
boxSize=
"20px"
my=
"2px"
mr=
{
{
base
:
1
,
lg
:
isHomepage
?
2
:
1
}
}
borderRadius=
"sm"
borderWidth=
"1px"
borderColor=
"gray.400"
color=
"gray.400"
display=
{
{
base
:
'
none
'
,
lg
:
'
flex
'
}
}
>
/
</
Center
>
)
}
</>
);
})();
...
...
@@ -157,7 +154,6 @@ const SearchBarInput = (
>
<
InputGroup
startElement=
{
startElement
}
startOffset=
{
{
base
:
isHomepage
?
'
50px
'
:
'
38px
'
,
lg
:
'
50px
'
}
}
endElement=
{
endElement
}
>
<
Input
...
...
ui/snippets/searchBar/SearchBarRecentKeywords.tsx
View file @
67f0e1c2
import
{
Box
,
Flex
,
Link
,
Text
}
from
'
@chakra-ui/react
'
;
import
{
Box
,
Flex
,
Text
}
from
'
@chakra-ui/react
'
;
import
React
from
'
react
'
;
import
useIsMobile
from
'
lib/hooks/useIsMobile
'
;
import
{
clearRecentSearchKeywords
,
getRecentSearchKeywords
,
removeRecentSearchKeyword
}
from
'
lib/recentSearchKeywords
'
;
import
{
Link
}
from
'
toolkit/chakra/link
'
;
import
TextAd
from
'
ui/shared/ad/TextAd
'
;
import
ClearButton
from
'
ui/shared/ClearButton
'
;
import
HashStringShortenDynamic
from
'
ui/shared/HashStringShortenDynamic
'
;
...
...
@@ -84,7 +85,7 @@ const SearchBarSuggest = ({ onClick, onClear }: Props) => {
)
:
<
Text
overflow=
"hidden"
whiteSpace=
"nowrap"
textOverflow=
"ellipsis"
>
{
kw
}
</
Text
>
}
<
ClearButton
onClick=
{
removeKeyword
(
kw
)
}
flexShrink=
{
0
}
/>
<
ClearButton
onClick=
{
removeKeyword
(
kw
)
}
flexShrink=
{
0
}
boxSize=
{
6
}
/>
</
Flex
>
))
}
</
Box
>
...
...
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