-
-
Notifications
You must be signed in to change notification settings - Fork 331
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
[Label] Right icon should have correct margin when placed after text #388
Conversation
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.
- Please rebase your branch to
develop
- The new invented code
ui icon label
andui right icon label
looks fine to me 🙂 - Don't remove the
delete
andclose
settings (this will also have impact inmultiple selection dropdown
), just keep them in addition to your new inventedhoverable
class to avoid a breaking change @deleteMargin
has a different size than@iconDistance
at least in the default theme: Keep this separated to avoid a breaking change
So i propose to change the PR to the following. Then it's fully backward compatible and not a breaking change anymore. Of course users have to add right icon
to their labels where they want to have a right positioned icon, but they don't need to do this for any existing close
or delete
icons, so it's more an enhancement then
/* Removable and Hoverable label */
.ui.label > .close.icon,
.ui.label > .delete.icon,
.ui.label > .hoverable.icon {
cursor: pointer;
font-size: @deleteSize;
opacity: @deleteOpacity;
transition: @deleteTransition;
}
/* Backward compatible positioning */
.ui.label:not(.icon) > .close.icon,
.ui.label:not(.icon) > .delete.icon {
margin: 0 0 0 @deleteMargin;
}
.ui.label > .delete.icon:hover,
.ui.label > .hoverable.icon:hover {
opacity: 1;
}
/* Label for only an icon */
.ui.icon.label > .icon {
margin: 0 auto;
}
/* Right Side Icon */
.ui.right.icon.label > .icon {
margin: 0 0 0 @iconDistance;
}
See here:
https://jsfiddle.net/6Lmh2k9p/
53677f0
to
d7a0cfb
Compare
@lubber-de However, close/delete icon will have incorrect margin when placed before text like
Do you have idea to fix this and keep backward-compatibility all together? BTW, there is |
6feccdd
to
cd15e1e
Compare
@exoego Having a close/delete to the left of a label was never proposed part of the framework, so although this is a valid visual point, it's not a breaking change, because old used code (if anywhere used by somebody anyway) like <div class="ui label">
<i class="delete icon"></i>
Delete me
</div> will work/look (as ugly) as before But it is a valid point. So to make this also work , what about inventing an explicit /* Icon */
.ui.left.icon.label > .icon,
.ui.label > .icon {
width: auto;
margin: 0 @iconDistance 0 0;
} Also in Addition: .ui.label.left.icon > .close.icon,
.ui.label.left.icon > .delete.icon {
margin: 0 @deleteMargin 0 0;
} See here: https://jsfiddle.net/6Lmh2k9p/1/ When doing FUI 3.0, we may take a look at it again to simplify the logic (at least getting rid of the separate |
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 do you think about my comment regarding the support of having close/delete to the left above?
I agree to keep backward compatibility as much as possible during Updated code, PR description, and example in docs(fomantic/Fomantic-UI-Docs#72). |
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.
LGTM now 🙂 Thanks for your patience
Removed Initially I thought I think that label module should focus on "A label displays content classification" as stated in the docs. |
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.
LGTM
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.
LGTM
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.
LGTM
Description
This PR is based on Semantic-Org/Semantic-UI#6210 by @w96k.
icon label
variation that allows to put an icon without text.right icon label
variation that allows to put an icon in the right side of label with correct margin.left icon label
variation to letdelete icon
andclose icon
be placed in left with correct margin for backward-compatibilityAddhoverable
class that makes icon to be used for action, as same style as currentclose
/delete
icon have.Testcase
Before
https://jsfiddle.net/oLc3pqeu/
After
https://jsfiddle.net/y4L7cadb/
Screenshot (when possible)
Normal Label
Ribbon Label
Closes
#222
Semantic-Org/Semantic-UI#6210
Semantic-Org/Semantic-UI#5328
Semantic-Org/Semantic-UI#5446
Semantic-Org/Semantic-UI#5619
Semantic-Org/Semantic-UI#6210