-
Notifications
You must be signed in to change notification settings - Fork 77
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(color-picker): enable responsive layout #10904
feat(color-picker): enable responsive layout #10904
Conversation
This PR has been automatically marked as stale because it has not had recent activity. Please close your PR if it is no longer relevant. Thank you for your contributions. |
This PR has been automatically marked as stale because it has not had recent activity. Please close your PR if it is no longer relevant. Thank you for your contributions. |
@ashetland Here's the latest screenshot build: https://www.chromatic.com/build?appId=6266d45509d7eb004aa254fb&number=7225. |
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.
🚀
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.
Visuals looking good!
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.
Looks good! 👍 💯
inline-size: 198px; | ||
} | ||
inline-size: 200px; | ||
min-inline-size: 200px; |
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.
Any future potential for a scale prop here for sizing?
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.
If you mean a custom CSS prop, it might be tricky since I also need static dimensions for canvas drawing.
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 should DRY this up though.
@@ -377,14 +294,19 @@ export class ColorPicker extends LitElement implements InteractiveComponent, Loa | |||
this.listen("keyup", this.handleChannelKeyUpOrDown, { capture: true }); | |||
} | |||
|
|||
connectedCallback(): void { | |||
if (this.hasUpdated) { |
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.
Could this check be moved inside resizeCanvas
?
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 think so. I might be able to remove the observeResize
in firstUpdated
this way too.
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.
Yeah that might be better 👍
const previewWidth = hasAlpha ? STATIC_DIMENSIONS["l"].preview.size : activeStaticDimensions.preview.size; | ||
const effectiveWidth = availableWidth - inlineSizeBorderTotalWidth; | ||
|
||
return Math.max(effectiveWidth - activeStaticDimensions.gap * 3 - previewWidth, 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.
What is the 3
for? Just curious.
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.
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.
Ah, yeah i was just wondering where the magic number came from :)
Related Issue: #8463
Summary
This updates
color-picker
to adjust its layout for custom width values larger than the default width for each scale.Notes
inline-size
Dimensions
interface