Skip to content

Commit

Permalink
feat(closebutton)!: migrate to S2 (#2564)
Browse files Browse the repository at this point in the history
BREAKING CHANGE: migrates Close Button to Spectrum 2

Additionally:
* test: increase chromatic coverage
* fix(closebutton): pass staticColor as arg for SB display
* chore(closebutton): remove themes dir
* docs(closebutton): adds s2 migration notes
* chore(closebutton): specify s2 tokens release for dependency

---------

Co-authored-by: Patrick Fulton <[email protected]>
  • Loading branch information
2 people authored and castastrophe committed Apr 18, 2024
1 parent 566ef4e commit 105e8c4
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 28 deletions.
6 changes: 3 additions & 3 deletions components/closebutton/metadata/closebutton.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ sections:
This component can be modified via its `--mod-*` prefixed custom properties. A list of those prefixed custom properties can be found <a class="spectrum-Link" href="https://github.com/adobe/spectrum-css/tree/main/components/closebutton/metadata/mods.md">here</a>.
- name: Migration Guide
description: |
### x/x/2024 - Version 5.0.0
### Version 5.0.0
#### Spectrum 2 release
Close button now uses Spectrum 2 tokens and specifications. A few notable changes and additions:
* Removes all static-specific `--mod` custom properties since they are no longer needed. The existing background-color mods can be used instead:
Expand All @@ -32,11 +32,11 @@ sections:
* The mod custom property `--mod-animation-duration-100` has been renamed to `--mod-button-animation-duration`.
* The regular and large "Icon size" variants have been removed.
### 8/16/2023 - Version 4.0.0
### Version 4.0.0
#### Remove focus-ring class
We've migrated away from the focus-ring class in favor of the native `:focus-visible` pseudo-class due to changes in browser support.
### 8/3/2022 - Version 2.0.0
### Version 2.0.0
#### Sizing and Spectrum tokens migration
Close button was migrated to use Spectrum tokens. Close button now supports different sizes. By default, the following icons should be used for each size:
Expand Down
4 changes: 2 additions & 2 deletions components/closebutton/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@spectrum-css/closebutton",
"version": "5.0.0-next.1",
"version": "5.0.0-next.2",
"description": "The Spectrum CSS close button component",
"license": "Apache-2.0",
"author": "Adobe",
Expand All @@ -19,7 +19,7 @@
"@spectrum-css/tokens": "^14.0.0-next.3"
},
"devDependencies": {
"@spectrum-css/commons": "^9.1.4-next.0"
"@spectrum-css/commons": "^9.1.4-next.1"
},
"publishConfig": {
"access": "public"
Expand Down
20 changes: 8 additions & 12 deletions components/closebutton/stories/closebutton.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,29 +55,25 @@ export default {
},
};

const CloseButton = ({
staticColor,
...args
}) => {
const CloseButton = (args) => {
return html`
<div
style=${ifDefined(styleMap({
padding: "1rem",
backgroundColor: staticColor === "white" ? "rgb(15, 121, 125)" : staticColor === "black" ? "rgb(181, 209, 211)" : undefined,
}))}
>
${Template({...args, staticColor})}
${Template(args)}
${when(window.isChromatic(), () =>
html`
${Template({
...args,
isDisabled: true,
})}
...args,
isDisabled: true,
})}
${html`
<div
style=${ifDefined(styleMap({
padding: "1rem",
backgroundColor: "rgb(15, 121, 125)"
background: "var(--spectrum-examples-gradient-static-white)"
}))}
>
${Template({
Expand All @@ -95,7 +91,7 @@ const CloseButton = ({
<div
style=${ifDefined(styleMap({
padding: "1rem",
backgroundColor: "rgb(181, 209, 211)"
background: "var(--spectrum-examples-gradient-static-black)"
}))}
>
${Template({
Expand All @@ -113,7 +109,7 @@ const CloseButton = ({
)}
</div>
`;
}
};

export const Default = CloseButton.bind({});
Default.args = {};
22 changes: 11 additions & 11 deletions components/closebutton/stories/template.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,17 @@ export const Template = ({
}) => {
let iconName = "Cross300";
switch (size) {
case "s":
iconName = "Cross200";
break;
case "l":
iconName = "Cross400";
break;
case "xl":
iconName = "Cross500";
break;
default:
iconName = "Cross300";
case "s":
iconName = "Cross200";
break;
case "l":
iconName = "Cross400";
break;
case "xl":
iconName = "Cross500";
break;
default:
iconName = "Cross300";
}

return html`
Expand Down

0 comments on commit 105e8c4

Please sign in to comment.