Skip to content
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

Polish color indicator and itemgroup. #37028

Merged
merged 4 commits into from
Dec 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@
}

.block-editor-panel-color-gradient-settings {
.component-color-indicator {
vertical-align: text-bottom;
}
.block-editor-panel-color-gradient-settings__panel-title {
display: flex;
gap: $grid-unit-15;
Copy link
Contributor

Choose a reason for hiding this comment

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

👍


&__panel-title {
.component-color-indicator {
display: inline-block;
width: $grid-unit-15;
height: $grid-unit-15;
align-self: center;
}
}

Expand Down
1 change: 1 addition & 0 deletions packages/components/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
### Enhancements

- Wrapped `Modal` in a `forwardRef` call ([#36831](https://github.com/WordPress/gutenberg/pull/36831)).
- Unify styles for `ColorIndicator` with how they appear in Global Styles ([#37028](https://github.com/WordPress/gutenberg/pull/37028))

## 19.1.0

Expand Down
13 changes: 5 additions & 8 deletions packages/components/src/color-indicator/style.scss
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
.component-color-indicator {
width: 25px;
height: 16px;
margin-left: 0.8rem;
border: 1px solid #dadada;
width: $grid-unit-50 * 0.5;
height: $grid-unit-50 * 0.5;
border-radius: 50%;
border: $border-width solid $gray-300;
display: inline-block;

& + & {
margin-left: 0.5rem;
}
Comment on lines -8 to -10
Copy link
Contributor

Choose a reason for hiding this comment

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

This change could cause some layout glitches in other parts of Gutenberg

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I haven't found any places where this rule would apply. As is, I removed it because it appears to be dead CSS.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure it's dead CSS — this rule would potentially affect those situations where 2 or more ColorIndicators are rendered next to each other (at least in DOM order).

I scanned the codebase and found a few places that we should check to make sure we didn't introduce a layout regressions:

  • PanelColorGradientSettings
  • Global Styles' Palette (although this may be already tackled by the changes to packages/edit-site/src/components/global-styles/style.scss in this same PR)
  • Global Styles' Preview (although this may be OK because of the VStack element wrapping around them)

padding: 0;
}
17 changes: 0 additions & 17 deletions packages/edit-site/src/components/global-styles/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,6 @@
justify-content: center;
min-height: 152px;
line-height: 1;

.component-color-indicator {
border-radius: 50%;
border: 0;
height: 36px;
width: 36px;
margin-left: 0;
padding: 0;
}
}

.edit-site-typography-panel__preview {
Expand Down Expand Up @@ -43,14 +34,6 @@
margin: $grid-unit-20;

.component-color-indicator {
margin-left: 0;
display: block;
border-radius: 50%;
height: 24px;
width: 24px;
padding: 0;
border: $border-width solid $gray-300;

// Show a diagonal line (crossed out) for empty swatches.
background: linear-gradient(-45deg, transparent 48%, $gray-300 48%, $gray-300 52%, transparent 52%);
}
Expand Down