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

style(avatar): oversizing of avatar on small screens #757

Closed
wants to merge 1 commit into from

Conversation

hritvi
Copy link
Contributor

@hritvi hritvi commented Apr 5, 2019

fixes #661
ref #7051.

For a tall sample image:
Screenshot from 2019-04-03 10-33-14

@lmorchard could you please review it now. Thanks!!

@vbudhram vbudhram requested a review from lmorchard April 5, 2019 15:29
Copy link
Contributor

@shane-tomlinson shane-tomlinson left a comment

Choose a reason for hiding this comment

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

Thanks @hritvi, and sorry for the delay reviewing!

I tested this today and it's an improvement for tall images, I think it can be improved for wide images.

For example, on a mobile screen, when I first load an image there is still a black border to left even though the image isn't centered and the right is cropped.

Screenshot 2019-04-11 at 12 17 30

If I go into "tablet" mode, then there is a large black space to the right rather than the left:

Screenshot 2019-04-11 at 12 18 31

I suspect CSS isn't the only thing at play here, the cropper sets the top and left of the image and may need updated for mobile.

Also, we really try hard to not use !important within CSS unless absolutely necessary. See https://css-tricks.com/when-using-important-is-the-right-choice/ for a good reference.


img {
position: absolute;
@include respond-to('small') {
left: (420 - $avatar-size) / 6 !important;
Copy link
Contributor

Choose a reason for hiding this comment

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

Is the !important really needed here? Is there a way to do without?

@lmorchard
Copy link
Contributor

I think @shane-tomlinson already had this in review - pending some requested changes

@hritvi
Copy link
Contributor Author

hritvi commented May 7, 2019

Sorry, I actually got a little busy with my exams stuff. Now that they are over, I would complete it as soon as possible.

@hritvi
Copy link
Contributor Author

hritvi commented May 18, 2019

I tried to modify the scripts written in the cropper a lot but nothing changed the position of the image. I guess that works when the image is zoomed or something like that.

I even tried to change the horizontal and vertical gutter in avatar_crop but that wasn't working too.

I guess we have to modify some code written in the CSS file. I figured out that it seems to work perfectly for screen sizes greater than 420. The only reason I could figure out for it was that the code was written in a way to support screen sizes greater than 420px and that's why 420 is taken as the base to distribute the left and right padding.

@hritvi
Copy link
Contributor Author

hritvi commented May 24, 2019

@shane-tomlinson @lmorchard can I get some insights into this?

@shane-tomlinson
Copy link
Contributor

We have decided to put this on hold for now to focus on the React project. We can re-open this PR if/when we get back to it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

iOS avatars are 90° CW and squished
3 participants