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
Show 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>(
...
@@ -27,10 +27,29 @@ export const InputGroup = React.forwardRef<HTMLDivElement, InputGroupProps>(
endOffset
,
endOffset
,
...
rest
...
rest
}
=
props
;
}
=
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
(
return
(
<
Group
ref=
{
ref
}
w=
"100%"
{
...
rest
}
>
<
Group
ref=
{
ref
}
w=
"100%"
{
...
rest
}
>
{
startElement
&&
(
{
startElement
&&
(
<
InputElement
pointerEvents=
"none"
{
...
startElementProps
}
>
<
InputElement
pointerEvents=
"none"
ref=
{
startElementRef
}
{
...
startElementProps
}
>
{
startElement
}
{
startElement
}
</
InputElement
>
</
InputElement
>
)
}
)
}
...
@@ -39,12 +58,12 @@ export const InputGroup = React.forwardRef<HTMLDivElement, InputGroupProps>(
...
@@ -39,12 +58,12 @@ export const InputGroup = React.forwardRef<HTMLDivElement, InputGroupProps>(
return
child
;
return
child
;
}
}
return
React
.
cloneElement
(
child
,
{
return
React
.
cloneElement
(
child
,
{
...(
startElement
&&
{
ps
:
startOffset
??
`
calc(var(--input-height) - 6px)
`
}),
...(
startElement
&&
{
ps
:
startOffset
??
`
${ inlinePaddings.start }px
`
}),
...(
endElement
&&
{
pe
:
endOffset
??
`
calc(var(--input-height) - 6px)
`
}),
...(
endElement
&&
{
pe
:
endOffset
??
`
${ inlinePaddings.end }px
`
}),
});
});
})
}
})
}
{
endElement
&&
(
{
endElement
&&
(
<
InputElement
placement=
"end"
{
...
endElementProps
}
>
<
InputElement
placement=
"end"
ref=
{
endElementRef
}
{
...
endElementProps
}
>
{
endElement
}
{
endElement
}
</
InputElement
>
</
InputElement
>
)
}
)
}
...
...
ui/address/contract/methods/form/ContractMethodFieldInput.tsx
View file @
67f0e1c2
...
@@ -131,7 +131,7 @@ const ContractMethodFieldInput = ({ data, hideLabel, path: name, className, isDi
...
@@ -131,7 +131,7 @@ const ContractMethodFieldInput = ({ data, hideLabel, path: name, className, isDi
const
inputEndElement
=
(
const
inputEndElement
=
(
<
Flex
alignItems=
"center"
>
<
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
}
/>
}
{
data
.
type
===
'
address
'
&&
<
ContractMethodAddressButton
onClick=
{
handleAddressButtonClick
}
isDisabled=
{
isDisabled
}
/>
}
{
argTypeMatchInt
&&
!
isNativeCoin
&&
(
hasTimestampButton
?
(
{
argTypeMatchInt
&&
!
isNativeCoin
&&
(
hasTimestampButton
?
(
<
Button
<
Button
...
...
ui/address/tokenSelect/TokenSelectMenu.tsx
View file @
67f0e1c2
...
@@ -32,7 +32,6 @@ const TokenSelectMenu = ({ erc20sort, erc1155sort, erc404sort, filteredData, onI
...
@@ -32,7 +32,6 @@ const TokenSelectMenu = ({ erc20sort, erc1155sort, erc404sort, filteredData, onI
<>
<>
<
InputGroup
<
InputGroup
startElement=
{
<
IconSvg
name=
"search"
boxSize=
{
4
}
color=
{
{
_light
:
'
blackAlpha.600
'
,
_dark
:
'
whiteAlpha.600
'
}
}
/>
}
startElement=
{
<
IconSvg
name=
"search"
boxSize=
{
4
}
color=
{
{
_light
:
'
blackAlpha.600
'
,
_dark
:
'
whiteAlpha.600
'
}
}
/>
}
startOffset=
"38px"
mb=
{
5
}
mb=
{
5
}
>
>
<
Input
placeholder=
"Search by token name"
onChange=
{
onInputChange
}
size=
"sm"
bgColor=
"dialog.bg"
/>
<
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
...
@@ -18,7 +18,7 @@ const RewardsReadOnlyInputWithCopy = ({ label, value, className, isLoading }: Pr
return
(
return
(
<
Skeleton
loading=
{
isLoading
}
className=
{
className
}
>
<
Skeleton
loading=
{
isLoading
}
className=
{
className
}
>
<
Field
label=
{
label
}
floating
size=
"xl"
readOnly
>
<
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"
/>
<
Input
value=
{
value
}
fontWeight=
"500"
overflow=
"hidden"
textOverflow=
"ellipsis"
/>
</
InputGroup
>
</
InputGroup
>
</
Field
>
</
Field
>
...
...
ui/shared/ClearButton.tsx
View file @
67f0e1c2
...
@@ -8,17 +8,19 @@ interface Props {
...
@@ -8,17 +8,19 @@ interface Props {
onClick
:
(
e
:
React
.
SyntheticEvent
)
=>
void
;
onClick
:
(
e
:
React
.
SyntheticEvent
)
=>
void
;
isDisabled
?:
boolean
;
isDisabled
?:
boolean
;
className
?:
string
;
className
?:
string
;
isVisible
?:
boolean
;
}
}
const
ClearButton
=
({
onClick
,
isDisabled
,
className
}:
Props
)
=>
{
const
ClearButton
=
({
onClick
,
isDisabled
,
isVisible
=
true
,
className
}:
Props
)
=>
{
return
(
return
(
<
IconButton
<
IconButton
disabled=
{
isDisabled
}
disabled=
{
isDisabled
||
!
isVisible
}
className=
{
className
}
className=
{
className
}
aria
-
label=
"Clear input"
aria
-
label=
"Clear input"
title=
"Clear input"
title=
"Clear input"
size=
"sm"
size=
"sm"
onClick=
{
onClick
}
onClick=
{
onClick
}
opacity=
{
isVisible
?
1
:
0
}
>
>
<
IconSvg
<
IconSvg
name=
"status/error"
name=
"status/error"
...
...
ui/shared/filters/FilterInput.tsx
View file @
67f0e1c2
...
@@ -37,7 +37,7 @@ const FilterInput = ({ onChange, size = 'sm', placeholder, initialValue, type, n
...
@@ -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
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
(
return
(
<
Skeleton
<
Skeleton
...
@@ -49,10 +49,8 @@ const FilterInput = ({ onChange, size = 'sm', placeholder, initialValue, type, n
...
@@ -49,10 +49,8 @@ const FilterInput = ({ onChange, size = 'sm', placeholder, initialValue, type, n
<
InputGroup
<
InputGroup
startElement=
{
startElement
}
startElement=
{
startElement
}
startElementProps=
{
{
px
:
2
}
}
startElementProps=
{
{
px
:
2
}
}
startOffset=
"32px"
endElement=
{
endElement
}
endElement=
{
endElement
}
endElementProps=
{
{
px
:
0
,
w
:
'
32px
'
}
}
endElementProps=
{
{
px
:
0
,
w
:
'
32px
'
}
}
endOffset=
"32px"
>
>
<
Input
<
Input
ref=
{
inputRef
}
ref=
{
inputRef
}
...
...
ui/shared/monaco/CodeEditorSearch.tsx
View file @
67f0e1c2
...
@@ -206,7 +206,6 @@ const CodeEditorSearch = ({ monaco, data, onFileSelect, isInputStuck, isActive,
...
@@ -206,7 +206,6 @@ const CodeEditorSearch = ({ monaco, data, onFileSelect, isInputStuck, isActive,
boxShadow=
{
isInputStuck
?
'
0px 6px 3px 0px rgba(0, 0, 0, 0.05)
'
:
'
none
'
}
boxShadow=
{
isInputStuck
?
'
0px 6px 3px 0px rgba(0, 0, 0, 0.05)
'
:
'
none
'
}
endElement=
{
inputEndElement
}
endElement=
{
inputEndElement
}
endElementProps=
{
{
height
:
'
26px
'
,
pl
:
'
0
'
,
pr
:
'
10px
'
,
columnGap
:
'
2px
'
}
}
endElementProps=
{
{
height
:
'
26px
'
,
pl
:
'
0
'
,
pr
:
'
10px
'
,
columnGap
:
'
2px
'
}
}
endOffset=
"75px"
>
>
<
Input
<
Input
size=
"xs"
size=
"xs"
...
...
ui/snippets/searchBar/SearchBarInput.tsx
View file @
67f0e1c2
...
@@ -109,15 +109,10 @@ const SearchBarInput = (
...
@@ -109,15 +109,10 @@ const SearchBarInput = (
);
);
const
endElement
=
(()
=>
{
const
endElement
=
(()
=>
{
if
(
value
)
{
return
<
ClearButton
onClick=
{
onClear
}
/>;
}
if
(
isMobile
)
{
return
null
;
}
return
(
return
(
<>
<
ClearButton
onClick=
{
onClear
}
isVisible=
{
value
.
length
>
0
}
/>
{
!
isMobile
&&
(
<
Center
<
Center
boxSize=
"20px"
boxSize=
"20px"
my=
"2px"
my=
"2px"
...
@@ -130,6 +125,8 @@ const SearchBarInput = (
...
@@ -130,6 +125,8 @@ const SearchBarInput = (
>
>
/
/
</
Center
>
</
Center
>
)
}
</>
);
);
})();
})();
...
@@ -157,7 +154,6 @@ const SearchBarInput = (
...
@@ -157,7 +154,6 @@ const SearchBarInput = (
>
>
<
InputGroup
<
InputGroup
startElement=
{
startElement
}
startElement=
{
startElement
}
startOffset=
{
{
base
:
isHomepage
?
'
50px
'
:
'
38px
'
,
lg
:
'
50px
'
}
}
endElement=
{
endElement
}
endElement=
{
endElement
}
>
>
<
Input
<
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
React
from
'
react
'
;
import
useIsMobile
from
'
lib/hooks/useIsMobile
'
;
import
useIsMobile
from
'
lib/hooks/useIsMobile
'
;
import
{
clearRecentSearchKeywords
,
getRecentSearchKeywords
,
removeRecentSearchKeyword
}
from
'
lib/recentSearchKeywords
'
;
import
{
clearRecentSearchKeywords
,
getRecentSearchKeywords
,
removeRecentSearchKeyword
}
from
'
lib/recentSearchKeywords
'
;
import
{
Link
}
from
'
toolkit/chakra/link
'
;
import
TextAd
from
'
ui/shared/ad/TextAd
'
;
import
TextAd
from
'
ui/shared/ad/TextAd
'
;
import
ClearButton
from
'
ui/shared/ClearButton
'
;
import
ClearButton
from
'
ui/shared/ClearButton
'
;
import
HashStringShortenDynamic
from
'
ui/shared/HashStringShortenDynamic
'
;
import
HashStringShortenDynamic
from
'
ui/shared/HashStringShortenDynamic
'
;
...
@@ -84,7 +85,7 @@ const SearchBarSuggest = ({ onClick, onClear }: Props) => {
...
@@ -84,7 +85,7 @@ const SearchBarSuggest = ({ onClick, onClear }: Props) => {
)
:
)
:
<
Text
overflow=
"hidden"
whiteSpace=
"nowrap"
textOverflow=
"ellipsis"
>
{
kw
}
</
Text
>
<
Text
overflow=
"hidden"
whiteSpace=
"nowrap"
textOverflow=
"ellipsis"
>
{
kw
}
</
Text
>
}
}
<
ClearButton
onClick=
{
removeKeyword
(
kw
)
}
flexShrink=
{
0
}
/>
<
ClearButton
onClick=
{
removeKeyword
(
kw
)
}
flexShrink=
{
0
}
boxSize=
{
6
}
/>
</
Flex
>
</
Flex
>
))
}
))
}
</
Box
>
</
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