-
Notifications
You must be signed in to change notification settings - Fork 199
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
feat(colorslider): S2 migration #3424
Changes from all commits
4f525ca
8cf0539
fb4dd7a
7fa5ea9
b97e077
4791e31
83f1ebd
6d6f582
5a44d15
33f46a9
9f51f99
ff1607c
ec61ee2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
--- | ||
"@spectrum-css/colorslider": minor | ||
--- | ||
|
||
# S2 colorslider migration | ||
|
||
This migrates the `colorslider` component to S2. Custom properties have been remapped per the design spec. | ||
|
||
| Before | After | | ||
| ------------------------- | -------------------------- | | ||
| `--spectrum-gray-900-rgb` | `--spectrum-gray-1000-rgb` | |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,18 +19,20 @@ export default { | |
component: "ColorSlider", | ||
argTypes: { | ||
colorHandleStyle: { table: { disable: true } }, | ||
vertical: { table: { disable: true } }, | ||
isDisabled, | ||
isFocused: { | ||
...isFocused, | ||
if: { arg: "isDisabled", truthy: false }, | ||
}, | ||
gradientStops: { | ||
name: "Gradient stops", | ||
color: { | ||
cdransf marked this conversation as resolved.
Show resolved
Hide resolved
|
||
name: "Color", | ||
description: | ||
"The <linear-color-stop> value of the CSS linear-gradient. Can be multiple stops separated by commas.", | ||
type: { name: "array" }, | ||
table: { disable: true }, | ||
"Supports standard color input or any valid input for the <code>background</code> property such as, <code>linear-gradient(red, blue)</code>.", | ||
type: { name: "string", required: true }, | ||
table: { | ||
type: { summary: "string" }, | ||
}, | ||
control: "color", | ||
}, | ||
selectedColor: { | ||
name: "Selected color", | ||
|
@@ -40,12 +42,19 @@ export default { | |
control: "color", | ||
}, | ||
gradientType: { | ||
name: "Gradient type", | ||
description: "The gradient can be defined in the markup using CSS or with an image.", | ||
options: ["gradient", "image"], | ||
name: "Color type", | ||
description: | ||
"The color can be defined in the markup using CSS or with an image.", | ||
options: ["color", "image"], | ||
control: { type: "select" }, | ||
table: { disable: true }, | ||
}, | ||
vertical: { | ||
name: "Vertical", | ||
description: "The orientation of the component.", | ||
type: { name: "boolean" }, | ||
control: "boolean", | ||
}, | ||
Comment on lines
+52
to
+57
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I talked to @jawinn about this and the thinking at the time was that, since we've moved the color control to a string that the onus would then be on the user to change that direction. We could couple the two, I can investigate that a bit more and see what we'd need to do it. 😃 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think that's fine. We could add a little blurb in the Color control description about the gradient direction, maybe saying that the direction would need to be changed for the vertical variant. Not sure I feel strongly about that though, so I'll leave that up to you! |
||
}, | ||
args: { | ||
rootClass: "spectrum-ColorSlider", | ||
|
@@ -70,8 +79,8 @@ export default { | |
*/ | ||
export const Default = ColorSliderGroup.bind({}); | ||
Default.args = { | ||
gradientStops: | ||
["rgb(255, 0, 0) 0%", "rgb(255, 255, 0) 17%", "rgb(0, 255, 0) 33%", "rgb(0, 255, 255) 50%", "rgb(0, 0, 255) 67%", "rgb(255, 0, 255) 83%", "rgb(255, 0, 0) 100%"], | ||
color: | ||
"linear-gradient(to right, rgb(255, 0, 0) 0%, rgb(255, 255, 0) 17%, rgb(0, 255, 0) 33%, rgb(0, 255, 255) 50%, rgb(0, 0, 255) 67%, rgb(255, 0, 255) 83%, rgb(255, 0, 0) 100%)", | ||
}; | ||
|
||
// ********* VRT ONLY ********* // | ||
|
@@ -81,7 +90,7 @@ WithForcedColors.tags = ["!autodocs", "!dev"]; | |
WithForcedColors.parameters = { | ||
chromatic: { | ||
forcedColors: "active", | ||
modes: disableDefaultModes | ||
modes: disableDefaultModes, | ||
}, | ||
}; | ||
|
||
|
@@ -92,6 +101,8 @@ WithForcedColors.parameters = { | |
export const Vertical = Template.bind({}); | ||
Vertical.args = { | ||
vertical: true, | ||
color: | ||
"linear-gradient(to bottom, rgb(255, 0, 0) 0%, rgb(255, 255, 0) 17%, rgb(0, 255, 0) 33%, rgb(0, 255, 255) 50%, rgb(0, 0, 255) 67%, rgb(255, 0, 255) 83%, rgb(255, 0, 0) 100%)", | ||
}; | ||
Vertical.tags = ["!dev"]; | ||
Vertical.parameters = { | ||
|
@@ -100,7 +111,7 @@ Vertical.parameters = { | |
|
||
export const Alpha = Template.bind({}); | ||
Alpha.args = { | ||
gradientStops: ["rgba(0, 0, 0, 1) 0%", "rgba(0, 0, 0, 0) 100%"], | ||
color: "linear-gradient(to right, rgba(0, 0, 0, 1) 0%, rgba(0, 0, 0, 0) 100%)", | ||
selectedColor: "rgba(0, 0, 0, 1)", | ||
}; | ||
Alpha.tags = ["!dev"]; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alpha
It looks like the Alpha story is still using the


gradientStops
arg that renamed, so it's not displaying correctly:Prod:
Vertical
The Vertical story also still needs an update for its story in our docs, and the VRT tests file config. The gradient should be in the
to bottom
direction for these instances where we set the arg value, though we talked about not needing any complicated logic if someone is manually flipping the vertical control on the Default story:There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it! I renamed and updated that arg and updated the gradient direction in the tests you highlighted. ✨