-
-
Notifications
You must be signed in to change notification settings - Fork 552
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
XWIKI 21833 - Provide better controls for editing the profile picture (avatar) #2862
Conversation
…(avatar) * Removed hardcoded reference to a Silk icon * Restyled the button to look like a link * Restyled the CSS on the profile image to clean it up
…(avatar) * Updated font-size
.buttonwrapper { | ||
a.button { | ||
background-color: inherit; | ||
background-image: none; | ||
border-color: unset; | ||
border-radius: unset; | ||
border: unset; | ||
color: @link-color; | ||
cursor: pointer; | ||
display: unset; | ||
font-size: @font-size-small; | ||
font-weight: normal; | ||
line-height: unset; | ||
margin: unset; | ||
padding: unset; | ||
text-align: center; | ||
vertical-align: middle; |
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 some LESS code, so you can probably use mixins https://lesscss.org/features/#mixins-feature to simplify this.
.btn; .btn-default;
will probably do the trick :)
See for example
Lines 104 to 112 in 0fbc4cc
input.button, .buttonwrapper button, .buttonwrapper a { | |
background-image: none; // XWIKI-7870 | |
.btn; | |
.btn-primary; | |
} | |
.buttonwrapper input.secondary, .buttonwrapper button.secondary, .buttonwrapper a.secondary { | |
.btn-default; | |
} |
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.
Forgot to explain it in the first comment, but IMO this is a button (action links very close to buttons semantically), so we should use a button presentation. .btn-default is pretty easy on the eye with the Iceberg color theme.
A lot of 'buttons' in the XWiki UI are not HTML buttons but actually action links on which we put these styles from bootstrap.
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.
No we don't have a tertiary button style.
Even the secondary button style is just the default color scheme ^^'
With this mixing, a nice thing is that you will probably need to unset
less properties, and be consistent for all the ones you don't want to reset.
E.g. font-size
, line-height
, font-weight
probably do not need to be unset
anymore. :)
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.
Nice, I will update these styles with the mixin and probably adjust it a little bit. 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.
I updated the styles a little bit using mixins and indeed the CSS is better managed this way. However, in doing so the styles didn't quite fit the photo above it, they seemed a little "sparse" and unintegrated. So I did a few more changes in the styles to keep them contained in a single element. IMO, it looks better while still maintaining the overall look of the theme. What do you think?
I also took some screenshots with different color themes to check them out.
One thing I noticed (but unrelated to this Jira) is that we have quite a few of button styles hurting our consistency, I will open a new Jira for this.
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.
So I did a few more changes in the styles to keep them contained in a single element.
Looking great!
Just as a side note, in order to keep two blocks together visually, you can "merge" their boxes by removing top/bottom padding and the border-radius in the right corners. See the styles of the Settings menu just under the picture for example.
One thing I noticed (but unrelated to this Jira) is that we have quite a few of button styles hurting our consistency, I will open a new Jira for this.
Looking forward to more detail about this 👍
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.
Just as a side note, in order to keep two blocks together visually, you can "merge" their boxes by removing top/bottom padding and the border-radius in the right corners.
Nice, the results turned out to be better with your suggestion, thanks! I will push them after some more tests with different themes and pictures.
...form-user-profile/xwiki-platform-user-profile-ui/src/main/resources/XWiki/XWikiUserSheet.xml
Outdated
Show resolved
Hide resolved
Good job! About the PR template, I personally use For your Jira issue, from what I remember it's nice to put an Affected version as soon as you open it (I checked it out and was surprised to see that we don't have a jira best practice about that). For improvements, I usually just put the last release as the Affected version. Here it'd be 16.0.0 :) Side note: I don't think this PR collides with #2771 , even though it's pretty close. |
Thank you @Sereza7 I will update the PR and Jira. |
…(avatar) * Updated code style
…(avatar) * Updated #avatar styles to keep it visually integrated with the button; * Updated button styles using mixins and a few layout rules to keep alignment;
width: ~"calc(100% - 0.6em)"; | ||
margin: 0 0.3em 0.3em 0.3em; |
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 was afraid that this calc would break responsiveness but apparently it's okay.
Instead of using calc and hard coded values, you can also use display: flex
on the parent (.wikilink here) and flex-grow
on the a.button . The button will grow to fill the whole line.
See https://css-tricks.com/snippets/css/a-guide-to-flexbox/ , flex is a really powerful tool :)
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.
Updated with 2b2162f
...form-user-profile/xwiki-platform-user-profile-ui/src/main/resources/XWiki/XWikiUserSheet.xml
Show resolved
Hide resolved
…(avatar) * Updated avatar and buttons styles * Updated the button container with flexbox layout instead of using calc()
p { | ||
text-align: center; | ||
} | ||
img{ |
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.
We should add a space here to keep consistency in the codestyle:
put a space between selector and declaration start, ex. "a {}"
from https://dev.xwiki.org/xwiki/bin/view/Community/CodeStyle/XhtmlCssCodeStyle/
z-index: 1; | ||
.attachment-picker { | ||
.buttonwrapper { | ||
.wikilink{ |
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.
We should add a space here to keep consistency in the codestyle:
put a space between selector and declaration start, ex. "a {}"
from https://dev.xwiki.org/xwiki/bin/view/Community/CodeStyle/XhtmlCssCodeStyle/
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.
So, here each rule also need to have a newline between them?
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.
Also, seeing the rest of this file, a lot of rules are not being followed, should I update the rest of the file as well?
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.
So, here each rule also need to have a newline between them?
Those are not next to each other but nested so it's not mandatory. As far as I know we usually don't do it for nested rulesets.
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.
Also, seeing the rest of this file, a lot of rules are not being followed, should I update the rest of the file as well?
From what I remember, it's okay to update codestyle in a file you're already editing.
If you want to do it, go for it, but there's no requirement as long as it's not code you've updated :)
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 adjusted my code with df059ae . I will do it for the rest of the file, but on a separate commit.
#avatar { | ||
p { | ||
text-align: center; | ||
} |
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.
Rulesets that are next to each other should be separated with an empty line. Here, this would mean adding back a line between the p
ruleset and the img
one :)
Separate adjacent rulesets with an empty line.
From https://dev.xwiki.org/xwiki/bin/view/Community/CodeStyle/XhtmlCssCodeStyle/
PS: It's a pretty new rule in the codestyle, so if you notice it's not followed somewhere, you're welcome to propose a fix for the file :)
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.
Adjusted with df059ae
…(avatar) * Codestyle update
…(avatar) * Codestyle update
width: 18px !important; | ||
z-index: 1; | ||
.attachment-picker { | ||
.buttonwrapper { |
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 is an unchanged style rule for .attachment-picker .buttonwrapper
right before this one, is it intentional that they are kept separate? Also, I'm wondering a bit if these style rules aren't too general (not really changed by this PR), and won't affect other attachment pickers that could, e.g., be present in the user profile's content.
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 is an unchanged style rule for .attachment-picker .buttonwrapper right before this one, is it intentional that they are kept separate? Also, I'm wondering a bit if these style rules aren't too general (not really changed by this PR), and won't affect other attachment pickers that could, e.g., be present in the user profile's content.
It's not intentional, from what I can see there's no reason to not include it in my changed code and remove from the first one. I'll do it.
Regarding the generality of rules, maybe we can add a general prefix to all rules and make them more specific. I will do some tests on this.
Thanks for the feedback.
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.
@tkrieck Do you still plan to add these changes to this PR, or shall we merge it without them?
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.
…(avatar) - Added an isolation for the .attachment-picker rules to reduce the risk of conflicts
Jira URL
https://jira.xwiki.org/browse/XWIKI-21833
Changes
Description
Clarifications
Screenshots & Video
Before
After
Executed Tests
Expected merging strategy
*