Skip to content
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

add_named_slot_for_icon_to_design_system_components_with_label #386

Conversation

bereket-WMDE
Copy link
Contributor

Bug: T274346

@github-actions
Copy link

github-actions bot commented Mar 2, 2021

@bereket-WMDE bereket-WMDE force-pushed the add_named_slot_for_icon_to_design_system_components_with_label branch from 15be122 to 1ba92f2 Compare March 3, 2021 14:09
@@ -9,10 +9,13 @@
:checked="checked"
:disabled="disabled"
>
<slot v-if="this.textDirection == 'rtl'" name="suffix" />
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No. We don't want to explicitly specify with props whether this is ltr or rtl. There are HTML5 technologies that do this for us. The easiest might be flexbox.

Have a look at this commit: 667cb5b

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks much cleaner

@sai-san
Copy link
Collaborator

sai-san commented Mar 3, 2021

Finally leaving some comments here after some discussion and trying some things out. I already had a chat with Bereket about all this, but:

  • That "info outline" icon does definitely not look crisp. I tried some things locally (like replacing the svg path by that of the original WMF svg just in case, or applying shape-rendering="crispEdges") but nothing worked, so I guess that the design of this particular icon does not adjust properly to this small size (the same can be seen in OOUI)

  • It would be ideal if the icon could be aligned with the last line of the label in case they wrap (instead of being vertically centered). But I'm aware this might not be easy to achieve, so this is not a strict requirement.

Image Pasted at 2021-3-3 12-38

  • I noticed the following behavior where long labels take over a wider width, pushing the icon away.

Screenshot 2021-03-03 at 18 43 28

- implemented flexbox to auto detect text direction
@bereket-WMDE
Copy link
Contributor Author

* It would be ideal if the icon could be aligned with the last line of the label in case they wrap (instead of being vertically centered). But I'm aware this might not be easy to achieve, so this is not a strict requirement.

As far as i know, the Icon has to be part of the label, in order to to achieve the desired result. but we don't want that, since the Icon has a different purpose (opening the popover component). right now, clicking the label would check the checkbox. But that could be my limited styling knowledge :) I am happy to hear ideas from other devs.

@bereket-WMDE
Copy link
Contributor Author

* I noticed the following behavior where long labels take over a wider width, pushing the icon away.
Screenshot 2021-03-03 at 18 43 28

Fixed in the new commit.

@sai-san sai-san requested a review from micgro42 March 9, 2021 10:30
Copy link
Collaborator

@micgro42 micgro42 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks already pretty good, but there is some cleanup still needed.

@if $displayType == block {

@if $displayType == block or $displayType == inline-flex {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we don't. I forgot to remove that from a previous commit.
removed now

&__label {
@include Label( block );
display: inine;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo: this should probably be inline? Similarly in the other files.

However, this line can just be removed, it is obviously not needed as it is currently ignored and the every looks fine.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah.. ofc this line is useless. thanks

@micgro42
Copy link
Collaborator

micgro42 commented Mar 9, 2021

Not blocking this PR, but I'm now confused by the token that we are using. Why are we using $dimension-layout-xxsmall and not $dimension-spacing-small? To me that would feel more intuitive.

Ladsgroup added a commit to wmde/query-builder that referenced this pull request Mar 10, 2021
TODO:
 - Tests
 - (Maybe in another PR) once wmde/wikit#386 merged and release,
   use it to add tooltip to components

Bug: T275542
Copy link
Collaborator

@micgro42 micgro42 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good from my side but it looks like chromatic needs another poke? Though the diff seems to be only a anti-aliasing issue

@sai-san
Copy link
Collaborator

sai-san commented Mar 10, 2021

Approving this PR so we can move forward, although at some point (probably while working on this Phab ticket? Though the change does not only apply to checkboxes) we should come up with a way to align the icon with the top or the baseline of the first line of wrapping labels, instead of centering it in relation to the label text. This would prevent misalignment like the following:

Screenshot 2021-03-10 at 12 49 14

I'll document the fix in the linked ticket.

@bereket-WMDE
Copy link
Contributor Author

Approving this PR so we can move forward, although at some point (probably while working on this Phab ticket? Though the change does not only apply to checkboxes) we should come up with a way to align the icon with the top or the baseline of the first line of wrapping labels, instead of centering it in relation to the label text. This would prevent misalignment like the following:

Screenshot 2021-03-10 at 12 49 14

I'll document the fix in the linked ticket.

Yes, i agree with the approach

@bereket-WMDE bereket-WMDE merged commit 178aabb into master Mar 10, 2021
@bereket-WMDE bereket-WMDE deleted the add_named_slot_for_icon_to_design_system_components_with_label branch March 10, 2021 12:03
Ladsgroup added a commit that referenced this pull request Mar 10, 2021
 - Bug fix for icons being used multiple times #389
 - Add named slot for tooltip #386
Ladsgroup added a commit that referenced this pull request Mar 11, 2021
- Bug fix for icons being used multiple times #389
 - Add named slot for tooltip #386
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants