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.

Issue fork drupal-3332462

Command icon 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:

Comments

Stockfoot created an issue. See original summary.

starshaped’s picture

Assigned: Unassigned » starshaped

Actively working on this at Florida Drupal Camp 2023.

starshaped’s picture

Issue tags: +fldc23
gauravvvv’s picture

Version: 10.0.x-dev » 10.1.x-dev

gauravvvv’s picture

Status: Active » Needs review
StatusFileSize
new128.55 KB
new127.65 KB

Here are the before/after patch screenshots. please review
Before patch:

After patch:

smustgrave’s picture

Status: Needs review » Needs work
Issue tags: +Needs Review Queue Initiative

Thanks for the screenshots

Appears there are failures in the MR.

starshaped’s picture

Status: Needs work » Needs review

I'm going to be working on this tonight and tomorrow to further clean up the CSS and fix the MR failures.

smustgrave’s picture

Status: Needs review » Needs work

Sounds good! But needs review isn’t the right status if there’s work to still be done.

starshaped’s picture

Yeah, that was a mistake on my end, I didn't realize I had changed the status! I'll set it to needs review once I get my work done.

smustgrave’s picture

Will keep an eye out to re-review

starshaped’s picture

Status: Needs work » Needs review

Code has been cleaned up and tests are passing. Ready for review!

smustgrave’s picture

Status: Needs review » Needs work
Issue tags: +Needs screenshots

Since you made additional changes since the last set of screenshots. Think we are going to need new ones since the .css file has changed.

starshaped’s picture

Status: Needs work » Needs review
StatusFileSize
new50.95 KB
new51.92 KB

Readded the RTL styles as they only apply on an RTL layout, and added before and after screenshots.

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: -Needs screenshots

From what I can see everything has been covered with the nesting, variables, etc.

  • lauriii committed 138349bf on 10.1.x
    Issue #3332462 by starshaped, Gauravvv, smustgrave: Refactor Claro's...

lauriii’s picture

Assigned: starshaped » Unassigned
Status: Reviewed & tested by the community » Fixed

Committed 138349b and pushed to 10.1.x. Thanks!

Discovered some pre-existing inconsistencies with the RTL styles. Opened a follow-up to address those #3344765: Inconsistencies in system-status-counter RTL styles.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.