-
Notifications
You must be signed in to change notification settings - Fork 9
refactor(styles): remove hardcoded styles #1760
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
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
d8bdf66
refactor(styles): remove hardcoded styles
Marina-L-Stoyanova 8b0f20c
Potential fix for pull request finding
Marina-L-Stoyanova 4cd5ff0
refactor(styles): remove hardcoded styles from Login and Register com…
Marina-L-Stoyanova 25c17f3
Merge branch 'mstoyanova/remove-hardcoded-styles-react' of https://gi…
Marina-L-Stoyanova e80eaea
refactor(styles): replace hardcoded styles with CSS variables in mult…
Marina-L-Stoyanova 25a33cc
Merge branch 'master' into mstoyanova/remove-hardcoded-styles-react
ivanvpetrov 48a7046
fix(templates): react templates was missing theme import and some css
ivanvpetrov 9bdd778
Merge branch 'master' into mstoyanova/remove-hardcoded-styles-react
ivanvpetrov File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 5 additions & 26 deletions
31
...igr-ts/projects/side-nav-auth/files/src/app/authentication/components/LoginBar.module.css
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,42 +1,21 @@ | ||
| .loginBtn::part(base) { | ||
| color: #0075d2; | ||
| background: #fff; | ||
| border-color: rgba(0, 117, 210, 0.35); | ||
| color: var(--ig-primary-500); | ||
| background: var(--ig-surface-500); | ||
| border-color: var(--ig-primary-500); | ||
| font-weight: 600; | ||
| white-space: nowrap; | ||
| transition: background .15s; | ||
| } | ||
|
|
||
| .loginBtn::part(base):hover { | ||
| background: #e8f3fc; | ||
| background: var(--ig-primary-100); | ||
| } | ||
|
|
||
| .profileAvatar { | ||
| cursor: pointer; | ||
| color: #0075d2; | ||
| --ig-avatar-background: #fff; | ||
| --ig-avatar-color: #0075d2; | ||
| } | ||
|
|
||
| :global(igc-dropdown-item:hover), | ||
| :global(igc-dropdown-item[active]:hover) { | ||
| background: #e8f3fc; | ||
| color: #0075d2; | ||
| } | ||
|
|
||
| :global(igc-dropdown-item[active]) { | ||
| background: #e8f3fc; | ||
| color: #0075d2; | ||
| } | ||
|
|
||
| :global(igc-dropdown-item[selected]), | ||
| :global(igc-dropdown-item[selected]:hover), | ||
| :global(igc-dropdown-item[selected][active]) { | ||
| background: #e8f3fc; | ||
| color: #0075d2; | ||
| } | ||
|
|
||
| .profileAvatar:focus-visible { | ||
| outline: 2px solid #fff; | ||
| outline: 2px solid var(--ig-surface-500); | ||
| outline-offset: 2px; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,7 +6,6 @@ | |
| .dialog::part(title) { | ||
| font-size: 1.125rem; | ||
| font-weight: 600; | ||
| color: #2d2d2d; | ||
| } | ||
|
|
||
| .body { | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Okay, not sure why those ended up staying (most the other similar stylings are correctly gone); Surely the items already use similar (e.g. primary-500) values already?
Also, there should be CSS variables for exactly these modifications and (assuming derived states are in, might need to check on that) those will correctly handle combinatory states (such as color when hovered, selected, active, disabled) and might even do the default icon styling, since that's likely driven by that as well.
The reason I raised those in the PR was for such cases too - there should be a CSS var like
--ig-navdrawer-item-backgroundor an -active such that should be used as the primary customization API for components, if/when needed. Touching the part elements directly is an escape hatch that requires both other options to be exhausted and great care taken when applying styles. That's IMO, but you could verify and adjust guidance if needed (docs, mcp-s, although theming mcp will rarely give you this as a result I think).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.
Edit: Okay, https://www.infragistics.com/products/ignite-ui-web-components/web-components/components/menus/navigation-drawer#styling does use the parts. I've no idea why you'd do it like that. Is it outdated from before we had CSS vars?
Cuz note there's already

--ig-nav-drawer-item-active-backgroundand-colorthat are exposed for customization, (although the default value is already--ig-primary-500in bootstrap). There's also icon color and actually a few colors (like hover, which this setup doesn't style)Don't think I see computed/derived states unf.
Anyway, this can and should be compressed to