Problem/Motivation
This is a child of #3324398: [META] Update Claro CSS with new coding standards and part of #3254529: [PLAN] Drupal CSS Modernization Initiative.
Steps to reproduce
The stylesheet at https://git.drupalcode.org/project/drupal/-/blob/10.0.x/core/themes/clar... needs to be refactored to make use of modern CSS and Drupal core's PostCSS tooling.
@todo: Add clear testing instructions to test this manually on the UI.
Proposed resolution
- Use CSS Logical Properties where appropriate.
- Use CSS nesting where appropriate.
- Use existing variables (
variables.pcss.css) where appropriate. Follow the proposed Drupal CSS coding standards to name the variables. - Add a comment when there's a value where there is not a variable like
font-size: 1.23rem; /* @todo One off value. */ - When possible, set variables at the root of the component and then map them to global theme variables:
.entity-meta { --entity-meta-title-font-size: var(--font-size-h5); ... more style } .entity-meta__title { font-size: var(--entity-meta-title-font-size); }
Out of scope
- Changing CSS classes
- Drupal 9 patches
User interface changes
None. There should be no visual differences.
Please post before/after screenshots and make sure they look the same.
| Comment | File | Size | Author |
|---|---|---|---|
| #8 | Screenshot 2023-02-14 at 11.39.40 AM.png | 56.21 KB | gauravvvv |
| #7 | Screenshot 2023-02-14 at 11.25.49 AM.png | 92.81 KB | gauravvvv |
| #7 | Screenshot 2023-02-14 at 11.25.11 AM.png | 69.58 KB | gauravvvv |
Issue fork drupal-3332459
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
- 3332459-refactor-claros-system-admin--panel
changes, plain diff MR !3461
Comments
Comment #2
bspeare commentedComment #3
royalpinto007Comment #5
royalpinto007I've built the file and ran some local tests, and it looks like everything is working as expected.
No errors were encountered during testing.
Comment #6
cilefen commentedThe issue summary says:
Comment #7
gauravvvv commentedBefore patch:
After patch #4:
Some selectors are changed, which needs to fixed. moving to NW.
Comment #8
gauravvvv commentedI have corrected the selectors and improved the nesting. Updated MR for same. Please review
After patch:
Comment #9
royalpinto007Comment #10
smustgrave commentedNesting looks good
Variables are being used
before/after screenshots added.
Comment #11
nod_The specificity of the selector is changed (increased) by the patch and it's not clear that this is necessary, if there are no other changes or justification that'd be a won't fix for me.
Comment #12
gauravvvv commentedSpecificity is updated just to improve nesting.
Comment #13
nod_right, but that can cause issues with projects that override just a few things.
My understanding is that we'd use nesting if that simplify generating the same output as before. In this case the code before refactoring didn't use selectors that could be simplified with nesting, so nesting shouldn't be necessary.
Comment #14
lauriii+1 for #11. We should not increase the selector specificity here.
Comment #15
nod_Thanks, since this is the only change in this MR, I'm closing as works a designed.
See you in the other CSS issues :)
Comment #16
nod_Actually we could use some logical properties in this file. Not that we have a need for RTL styles but it can't hurt :)
Comment #17
gauravvvv commentedUpdated MR with logical properties and removed the increased selector specificity. please review
Comment #18
guru2023 commentedComment #19
guru2023 commentedComment #20
smustgrave commentedChanges look good @Gauravvvv
Comment #22
nod_Committed 28e4c1f and pushed to 10.1.x. Thanks!