-
-
Notifications
You must be signed in to change notification settings - Fork 480
Refactor: Form elements #1315
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
Refactor: Form elements #1315
Conversation
showWeblateLink?: boolean | ||
} | ||
|
||
const languageLabels: { [key: string]: string } = { |
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.
moved these 2 constants outside the component so they are not initialized in every call to the function
dataTestId = 'toggleSwitch' | ||
} = props | ||
// TODO fixes errors in the console, but the props may not be necessary at all | ||
const checkmarkProps = { |
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.
I was able to remove the need of the .checkmark
element completely so we don't need this anymore
.switch input:checked ~ .checkmark:after { | ||
display: block; | ||
.toggleSwitchWrapper.checked:before { | ||
content: '\2713'; |
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.
replaced the hacky check done using css borders and rotation with a real check
character
@@ -3,29 +3,36 @@ input[type='range'] { | |||
max-width: 513px; | |||
} | |||
|
|||
.Accessibility > .settingsWrapper > .setting > .is-drop-down { | |||
background-position: calc(100% - 20px) calc(1em + -4px), | |||
calc(100% - 15px) calc(1em + -4px), calc(101% - 2.5em) calc(0.5em + -8px); |
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.
changed the main background properties so it works in smaller and bigger selects so this is not needed
const handleChangeLanguage = (language: string) => { | ||
storage.setItem('language', language) | ||
i18n.changeLanguage(language) | ||
} |
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.
language changes are handled by the LanguageSelector component directly
@@ -185,17 +185,10 @@ html, | |||
} | |||
|
|||
.material-icons.settings.folder { |
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.
One thing, not really related with the PR.
Have you noticed that we are using two different folder icons? one on the settings and another on the InstallModal.
I think we should pick one, maybe the one that we are using on the InstallModal looks a bit better imo.
But we can do that in another task if you think this could increase the scope of this PR.
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.
yeah, I didn't know the reason so I just skipped that, I agree that a single icon in all palces would look better
I'm also thinking about adding another component PathInputField
that would take care of the input with the folder icon, we use that in a lot of places, I think it's a good opportunity to simplify that
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.
I extracted a TextInputWithIconField component instead, maybe we can extract a PathInputField in the future, but not all path inputs behave the same so decided to go with a more generic input with icon
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.
Also added an extra Finally, I replaced all uses of a Folder icon with the one in the InstallDialog component |
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.
I think that looks great now!
Ready to merge! ⚔️
This PR is a refactor around how we use selects, text inputs, and the toggle switch tags.
There were some issues:
span.setting
, then a label with a specific code for RTL, then another element and so on), now each tag has it's own component so to add a select field (with a label and some extra stuff) we can use SelectField, similar with TextInputField, also each component handles the RTL variableI'll add more comments in the diff
Use the following Checklist if you have changed something on the Backend or Frontend: