Skip to content

Frontend fix input styling#3865

Open
thisconnect wants to merge 4 commits intoBitBoxSwiss:masterfrom
thisconnect:frontend-fix-input-styling
Open

Frontend fix input styling#3865
thisconnect wants to merge 4 commits intoBitBoxSwiss:masterfrom
thisconnect:frontend-fix-input-styling

Conversation

@thisconnect
Copy link
Collaborator

In PR #3863 there are 2 CSS selectors that target the child components. For this reason I wanted to update Input and related components to accept class on the field element. So we don't have to do: .inputClassName > div

However I found some small bugs and regressions, which this PR should fix.

Input component already has default styling, and CSS variables
such as var(--color-primary-rgb) seem halucinated.

The selector didn't target the search input element anymore, but
when fixing the selectors the search field is invisible in dark mode.

Removing the unnecessary styling.

Related
- a45bb14
As parent element has a minimum height the margin after the choose
name input field has no effect.
Fee amount and fee unit in custom fee input did not perfectly align.

@media (max-width: 768px) {
.searchInput {
.searchInput > div {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to open a new PR building on top this one to remove the selector "hack".

But it would be great to merge this first.

.searchInput:focus {
outline: none;
border-color: var(--color-primary);
box-shadow: 0 0 0 2px rgba(var(--color-primary-rgb), 0.1);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AI hallucination? we never had --color-primary-rgb CSS varaiblae afaik.

margin-bottom: var(--space-half);
min-width: 320px;
width: 100%;
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The regression is that .searchInput was before added to the input element and now it's on a container element. So all these styles are on the container.

This would fix the selectors, but then the UI looks broken, not sure if these styles were ever used 🤔

diff --git a/frontends/web/src/routes/account/account.module.css b/frontends/web/src/routes/account/account.module.css
index 10c087201..ff3b578e9 100644
--- a/frontends/web/src/routes/account/account.module.css
+++ b/frontends/web/src/routes/account/account.module.css
@@ -187,7 +187,7 @@
     transform: translateY(-10px);
 }
 
-.searchInput {
+.searchInput > div {
     background-color: var(--color-background);
     border: 1px solid var(--color-border);
     border-radius: 4px;
@@ -200,18 +200,18 @@
     width: 100%;
 }
 
-.searchInput:focus {
+.searchInput > div:focus-within {
     outline: none;
     border-color: var(--color-primary);
     box-shadow: 0 0 0 2px rgba(var(--color-primary-rgb), 0.1);
 }
 
-.searchInput::placeholder {
+.searchInput input::placeholder {
     color: var(--color-secondary);
 }
 
 @media (max-width: 768px) {
-    .searchInput {
+    .searchInput > div {
         padding-right: 0;
     }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant