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

Don't vertically clip creator header images in tip UI #484

Merged
merged 3 commits into from Jul 1, 2019
Merged

Conversation

@cg505
Copy link
Contributor

cg505 commented May 29, 2019

Changes

See brave/brave-browser#2015. The banner image for the tip interface now scales height dynamically.
image
image

Also resolves #483 and #488.

Test plan

With header image

  • Launch with --rewards=staging=false.
  • Visit brave.com and make sure browser width is at least 1500px or so.
  • Open rewards box. If it says "Not yet verified" click "Check again...".
  • Click "SEND A TIP..." button.
  • The header image should say "Brave the new internet. Fast, safe, secure, corageous." Make sure this image is not vertically clipped.
  • Try again at a small browser width (~1000px). It should work as before.

Without header image

  • Visit any site without a verified publisher and make sure browser width is at least 1500px or so.
  • Open rewards box and click "SEND A TIP..." button.
  • The header should look normal and should be 176px tall.
Link / storybook path to visual changes

https://brave-ui-6cuwjq0t3.now.sh?path=/story/feature-components-rewards-concepts-desktop--site-banner (toggle "Show bg image" knob)

Integration

  • Does this contain changes to src/components or src/

    • Will you publish to npm immediately after this PR, or wait until sometime in the future?
    • Incompatible API change to something existing (major version increase)
    • Adding new backwards-compatible functionality? (minor version increase)
    • Fixing a bug backwards-compatibly? (patch version increase)
  • Does this contain changes to src/features for brave-core?

    • Are there non backwards-compatible changes required for brave-core? Do not merge until brave-core PR is approvable. Link to brave-core PR:
    • Will you create brave-core PR to update to this commit after it is merged?
    • Wants uplift to brave-core feature branch?
      • When uplift-approved, merge to brave-core-0.VV.x feature branch
      • Create additional brave-core PRs for each feature branch to update commit
@cg505 cg505 added the rewards label May 29, 2019
@cg505 cg505 changed the title Site banner height Don't vertically clip creator header images in tip UI May 29, 2019
@cg505 cg505 marked this pull request as ready for review May 30, 2019
@cg505 cg505 requested review from NejcZdovc and ryanml and removed request for NejcZdovc May 30, 2019
Copy link
Member

ryanml left a comment

Overall things are looking good, but can you add either a knob or a demonstration in to the storybook concept for siteBanner so we can see how it looks between images of varying heights? You can just make a toggle knob like shortBgImage/tallBgImage even :)

@cg505
Copy link
Contributor Author

cg505 commented May 30, 2019

@ryanml Actually all the banner images are the same aspect ratio, so the existing knobs are sufficient. The only thing to check is the different widths.

@dlipeles
Copy link
Member

dlipeles commented May 30, 2019

all the banner images are the same aspect ratio, so the existing knobs are sufficient. The only thing to check is the different widths.

I can attest to this, we store all of our images server side at 2700 x 528 👍

That said, things could change in the future, might not hurt to create more knobs just for testing purposes.

@NejcZdovc
Copy link
Member

NejcZdovc commented May 30, 2019

One thing that we need to keep is height of the image to be fixed, otherwise height will be too big and small screens will have problems. So what we need to achieve is, with height that we have defined, how to best fit it in there.

@cg505
Copy link
Contributor Author

cg505 commented May 30, 2019

@NejcZdovc Since the aspect ratio is so wide (900 by 176) you will have to have a really wide and really short screen for it to be a problem (like 2 or 3x as wide as tall). If we're worried about it, we could either cap the width of the image or vertically center it past a certain point. Not sure what the best approach would be in that case.

@cg505
Copy link
Contributor Author

cg505 commented May 30, 2019

The dialog box height is capped at 700px. We can add a max-height to the banner image so that everything should fit even if your screen is super wide.

@cg505 cg505 force-pushed the site-banner-height branch from 5011793 to e3ea148 May 30, 2019
@cg505
Copy link
Contributor Author

cg505 commented May 30, 2019

Pushed a change to cap the height of the banner image at 350px. This will avoid creating a scrollbar even on really wide screens. Looks like this:
image
This change doesn't affect the screenshots in the OP.

Do we want to handle this case some other way as well (like max-width or vertical centering)?

cg505 added a commit to cg505/brave-core that referenced this pull request May 30, 2019
@cg505 cg505 mentioned this pull request May 31, 2019
8 of 29 tasks complete
@dlipeles
Copy link
Member

dlipeles commented Jun 3, 2019

Is there anyway we can handle these images in a way that doesn't clip, especially important if the image contains text @NejcZdovc @cg505

@cg505
Copy link
Contributor Author

cg505 commented Jun 3, 2019

@dlipeles When the screen is really wide, we could somehow restrict the width of the banner image, but I'm not sure exactly how that will work. (What should be the background color? Should we restrict the width of the entire dialog?)

@dlipeles
Copy link
Member

dlipeles commented Jun 3, 2019

I think setting a max-width on the entire banner might be a good idea, I will defer to @NejcZdovc

@cg505 cg505 force-pushed the site-banner-height branch from e3ea148 to 455524d Jun 3, 2019
cg505 added a commit to brave/brave-core that referenced this pull request Jun 3, 2019
@cg505
Copy link
Contributor Author

cg505 commented Jun 3, 2019

Enforced a maximum width in the brave/brave-core#2566 so that the maximum height is no longer needed.

@@ -25,9 +25,16 @@ describe('WalletSummary tests', () => {

describe('basic tests', () => {
it('matches the snapshot', () => {
const RealDate = Date
global.Date = class extends RealDate {
constructor () {

This comment has been minimized.

Copy link
@petemill
cg505 added a commit to brave/brave-core that referenced this pull request Jun 3, 2019
@ryanml ryanml self-requested a review Jun 4, 2019
@ryanml ryanml requested a review from petemill Jun 4, 2019
@cg505 cg505 requested a review from NejcZdovc Jun 4, 2019
@cg505 cg505 force-pushed the site-banner-height branch from 455524d to 47148ed Jun 18, 2019
cg505 added a commit to brave/brave-core that referenced this pull request Jun 18, 2019
@cg505 cg505 force-pushed the site-banner-height branch from 47148ed to f5304fe Jun 19, 2019
cg505 added a commit to brave/brave-core that referenced this pull request Jun 19, 2019
cg505 added a commit to brave/brave-core that referenced this pull request Jun 19, 2019
cg505 added 3 commits May 29, 2019
This component is no longer used in mobile.

Resolves #483.
This fixes vertical clipping of the header image when the browser is
very wide.

See brave/brave-browser#2015.
cg505 added a commit to brave/brave-core that referenced this pull request Jun 29, 2019
@cg505 cg505 force-pushed the site-banner-height branch from f5304fe to 8052f76 Jun 29, 2019
Copy link
Member

petemill left a comment

Graceful solve. Nice cleanup too!

@cg505 cg505 merged commit 0220a24 into master Jul 1, 2019
1 check passed
1 check passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
cg505 added a commit to brave/brave-core that referenced this pull request Jul 1, 2019
@petemill petemill deleted the site-banner-height branch Jul 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

5 participants
You can’t perform that action at this time.