Skip to content
This repository has been archived by the owner on May 13, 2024. It is now read-only.

Commit

Permalink
scale height of creator custom header image in siteBanner
Browse files Browse the repository at this point in the history
This fixes vertical clipping of the header image when the browser is
very wide.

See brave/brave-browser#2015.
  • Loading branch information
cg505 committed Jun 18, 2019
1 parent 7ceda45 commit f5304fe
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/features/rewards/siteBanner/__snapshots__/spec.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ exports[`List tests basic tests matches the snapshot 1`] = `
font-weight: 600;
line-height: 0.74;
color: #d1d1db;
height: 176px;
min-height: 176px;
overflow: hidden;
background: url(test-file-stub) no-repeat top left,url(test-file-stub) no-repeat top right,#9e9fab;
}
Expand Down
3 changes: 2 additions & 1 deletion src/features/rewards/siteBanner/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
StyledDonation,
StyledContent,
StyledBanner,
StyledBannerFiller,
StyledBannerImage,
StyledClose,
StyledContentWrapper,
Expand Down Expand Up @@ -263,7 +264,7 @@ export default class SiteBanner extends React.PureComponent<Props, State> {
{
!bgImage
? this.getBannerImageContent(name, screenName, domain, provider)
: null
: <StyledBannerFiller />
}
</StyledBannerImage>
<StyledContentWrapper>
Expand Down
8 changes: 7 additions & 1 deletion src/features/rewards/siteBanner/style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,19 @@ export const StyledBannerImage = styled<Partial<Props>, 'div'>('div')`
font-weight: 600;
line-height: 0.74;
color: #d1d1db;
height: 176px;
min-height: 176px;
overflow: hidden;
background: ${p => p.bgImage
? `url(${p.bgImage}) no-repeat top center / cover`
: `url(${bg1Url}) no-repeat top left, url(${bg2Url}) no-repeat top right, #9e9fab`
};
`

// 900:176 is the aspect ratio for banner images.
export const StyledBannerFiller = styled<{}, 'div'>('div')`
padding-top: calc(176 / 900 * 100%);
`

export const StyledClose = styled<{}, 'button'>('button')`
top: 16px;
right: 16px;
Expand Down

0 comments on commit f5304fe

Please sign in to comment.