-
Notifications
You must be signed in to change notification settings - Fork 198
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
fix(picker): quiet side label picker positioning #2465
Conversation
@@ -27,7 +27,7 @@ governing permissions and limitations under the License. | |||
--spectrum-fieldlabel-bottom-to-text: var(--spectrum-component-bottom-to-text-75); | |||
--spectrum-fieldlabel-font-size: var(--spectrum-font-size-75); | |||
|
|||
--spectrum-fieldlabel-side-padding-top: var(--spectrum-component-top-to-text-75); | |||
--spectrum-fieldlabel-side-margin-block-start: var(--spectrum-field-label-top-margin-small); |
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.
5c1e187
to
686b75e
Compare
@@ -449,7 +449,7 @@ governing permissions and limitations under the License. | |||
background-color: var(--highcontrast-picker-background-color, transparent); | |||
|
|||
&.spectrum-Picker--sideLabel { | |||
margin-block-start: calc(-1 * var(--spectrum-picker-spacing-top-to-text-side-label-quiet)); | |||
margin-block-start: 0; |
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.
686b75e
to
7c1526f
Compare
File metricsSummaryTotal size: 3.94 MB*
Detailsfieldlabel
picker
* Results are not gzipped or minified. * An ASCII character in UTF-8 is 8 bits or 1 byte. |
🚀 Deployed on https://pr-2465--spectrum-css.netlify.app |
62e0e4a
to
57cf5fe
Compare
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.
This is looking good to me. Just a couple nit picky comments/suggestions
${withSwitch ? | ||
Switch({ | ||
...globals, | ||
size, | ||
label: "Toggle switch", | ||
customStyles: { | ||
"padding-inline-start": "15px" | ||
} | ||
}) | ||
: null} |
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.
I wonder if we could use lit's when
here instead of a ternary 🤔 Would look something like:
${when(withSwitch, () =>
Switch({
...globals,
size,
label: "Toggle switch",
customStyles: {
"padding-inline-start": "15px"
}
})
}
@@ -35,6 +37,15 @@ export default { | |||
options: ["top", "left"], | |||
control: { type: "select" }, | |||
}, | |||
withSwitch: { | |||
name: "Display with a switch component", |
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.
Do we want this to show in the control table, or is this just intended for Chromatic? It looks a bit odd when the picker label is on the top. We could also maybe make this control only show in the table when picker label is "left." Just throwing ideas out there :)
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.
thanks for catching this, it does look wrong when the field label is top, but I do still think there is value in being able to toggle this control for the side label. Adjusted the control accordingly.
One other thing I just thought of: can the quiet picker label wrap? Have we accounted for that? |
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.
Thanks!
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.
Thanks for making those changes, LGTM!
633ff12
to
2684376
Compare
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.
Can you update the stories with the new syntax? Otherwise this looks great!
@@ -1,4 +1,6 @@ | |||
import { Default as MenuStories } from "@spectrum-css/menu/stories/menu.stories.js"; | |||
import { html } from "lit"; | |||
import isChromatic from "chromatic/isChromatic"; |
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.
Can you update this with the new window.isChromatic() syntax now that that tool is merged?
() => MenuStories(MenuStories.args) | ||
], | ||
}; | ||
|
||
export const WithForcedColors = Template.bind({ |
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.
Can you update the ForcedColors run to use the Group as well?
65adf1c
to
952d1df
Compare
43eee15
to
b4a7526
Compare
Description
Addresses concerned raised in adobe/spectrum-web-components#2963 where the quiet picker and it's associated side label does not align with text of other components, making it appear incorrect when used with other components.
For before look at #2231
Changes:
FieldLabel:
--spectrum-field-label-top-margin-*
tokens and margin to adjust position of side label to match design specsPicker
How and where has this been tested?
Please tag yourself on the tests you've marked complete to confirm the tests have been run by someone other than the author.
Validation steps
On the docs site for picker and field label
Storybook for picker
Chromatic
Regression testing
Validate:
Screenshots
T-shirt sizing with other components
Storybook Kitchen Sink
To-do list