-
Notifications
You must be signed in to change notification settings - Fork 42
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
Restyle SearchAddress focus and refactor #844
Conversation
lukaw3d
commented
Jun 1, 2022
Before | After |
---|---|
![]() |
![]() |
MegaLinter status: ✅ SUCCESS
See errors details in artifact MegaLinter reports on CI Job page |
Codecov Report
@@ Coverage Diff @@
## master #844 +/- ##
==========================================
- Coverage 87.88% 87.82% -0.06%
==========================================
Files 101 102 +1
Lines 1634 1643 +9
Branches 337 337
==========================================
+ Hits 1436 1443 +7
- Misses 198 200 +2
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
/> | ||
{value && ( | ||
<Button | ||
style={{ marginLeft: '-48px', zIndex: 1, marginTop: '-2px', marginBottom: '-2px' }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two ideas:
- we can avoid hardcoding all these pixels here , so component will be more 'stable' when updating Grommet or theme in the future
- input height is not aligned with network selection button height, it's more visible on mobile view
something like this may work:
const FooButton = styled(Button)`
margin-left: ${({ theme }) => `-${theme.global.edgeSize.large}`}; // avoid hardcoded pixels
position: relative;
`
<FooButton
style={{
visibility: value ? 'visible' : 'hidden', // avoid jumping
}}
icon={<FormClose />}
onClick={() => onClear()}
/>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh yeah, that's better!
I didn't know grommet's theme is in styled-components. Though theme.global.edgeSize.large
isn't related. 48px comes from "x" button's width: left-padding + "x" icon width + right-padding
.
Is there any benefit of position: relative;
vs z-index: 1;
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any benefit of position: relative; vs z-index: 1;?
I have no idea 😄
1f52863
to
545323d
Compare
@@ -1,6 +1,7 @@ | |||
import { Box, Button, TextInput } from 'grommet' | |||
import { FormClose, Search } from 'grommet-icons/icons' | |||
import React from 'react' | |||
import styled, { useTheme } from 'styled-components' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
useTheme is not used
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oops :D
I looked at some linting options to detect these, and now I've got 204 other problems
65ebd3f
to
43af684
Compare
43af684
to
0cec641
Compare