Skip to content

Commit

Permalink
feat(thumbnail-opacity-checkboard): S2 migration (#3394)
Browse files Browse the repository at this point in the history
* feat(thumbnail-opacity-checkboard): s2 migration
* feat(thumbnail-opacity-checkboard): fix token rule
* feat(thumbnail-opacity-checkboard): fix typo, update changeset, move rule
* feat(thumbnail-opacity-checkboard): drop unnecessary styles
* feat(thumbnail-opacity-checkboard): update token
* feat(thumbnail-opacity-checkboard): update changeset
  • Loading branch information
cdransf authored and castastrophe committed Jan 17, 2025
1 parent 9b3d6ea commit 4d2efb8
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 9 deletions.
10 changes: 10 additions & 0 deletions .changeset/twenty-tables-know.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
"@spectrum-css/opacitycheckerboard": major
"@spectrum-css/thumbnail": minor
---

# thumbnail-opacity-checkerboard S2 migration

Adds thumbnail specific `thumbnail-opacity-checkerboard-square-size` token aliased to `--spectrum-opacity-checkerboard-size`. This impacts the display of the `opacity-checkerboard` when used within the `thumbnail` component.

This also corrects an issue with a token name in the `thumbnail` component by renaming `--spectrum-thumbnail-border-color-opacity` to `--spectrum-thumbnail-border-opacity`.
6 changes: 1 addition & 5 deletions components/opacitycheckerboard/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,7 @@
}

.spectrum-OpacityCheckerboard {
background:
repeating-conic-gradient(var(--spectrum-opacity-checkerboard-light) 0% 25%, var(--spectrum-opacity-checkerboard-dark) 0% 50%)
var(--spectrum-opacity-checkerboard-position) /
calc(var(--spectrum-opacity-checkerboard-size) * 2)
calc(var(--spectrum-opacity-checkerboard-size) * 2);
background: repeating-conic-gradient(var(--spectrum-opacity-checkerboard-light) 0% 25%, var(--spectrum-opacity-checkerboard-dark) 0% 50%) var(--spectrum-opacity-checkerboard-position) / calc(var(--spectrum-opacity-checkerboard-size) * 2) calc(var(--spectrum-opacity-checkerboard-size) * 2);
}

@media (forced-colors: active) {
Expand Down
3 changes: 2 additions & 1 deletion components/thumbnail/dist/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
"--spectrum-thumbnail-layer-border-color-outer",
"--spectrum-thumbnail-layer-border-width-inner",
"--spectrum-thumbnail-layer-border-width-outer",
"--spectrum-thumbnail-opacity-checkerboard-square-size",
"--spectrum-thumbnail-opacity-disabled",
"--spectrum-thumbnail-size",
"--spectrum-thumbnail-size-100",
Expand Down Expand Up @@ -88,7 +89,7 @@
"--spectrum-white"
],
"system-theme": [],
"passthroughs": [],
"passthroughs": ["--mod-opacity-checkerboard-size"],
"high-contrast": [
"--highcontrast-thumbnail-border-color",
"--highcontrast-thumbnail-border-color-selected",
Expand Down
3 changes: 3 additions & 0 deletions components/thumbnail/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@
--spectrum-thumbnail-focus-indicator-color: var(--spectrum-focus-indicator-color);

--spectrum-thumbnail-color-opacity-disabled: var(--spectrum-thumbnail-opacity-disabled);

/* @passthrough -- custom sizing for opacity checkerboard */
--mod-opacity-checkerboard-size: var(--spectrum-thumbnail-opacity-checkerboard-square-size);
}

.spectrum-Thumbnail--size50 {
Expand Down
3 changes: 0 additions & 3 deletions components/thumbnail/stories/template.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,6 @@ export const Template = ({
${OpacityCheckerboard({
rootClass: backgroundColor ? `${rootClass}-image-wrapper` : undefined,
customClasses: isLayer ? [`${rootClass}-layer-inner`] : !backgroundColor ? [`${rootClass}-image-wrapper`] : [],
customStyles: {
"--spectrum-opacity-checkerboard-size": "var(--spectrum-thumbnail-opacity-checkerboard-square-size)"
},
content: image ? [image] : [],
}, context)}
</div>
Expand Down

0 comments on commit 4d2efb8

Please sign in to comment.