Skip to content

Commit

Permalink
Fix alignment on Welcome page content
Browse files Browse the repository at this point in the history
Content was not centered causing a bad UI. This commit fix that.

fix brave/brave-browser#6846
  • Loading branch information
cezaraugusto authored and petemill committed Dec 4, 2019
1 parent 381e31b commit 4e90a33
Showing 1 changed file with 13 additions and 19 deletions.
32 changes: 13 additions & 19 deletions components/brave_welcome_ui/components/wrapper/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import styled, { css, keyframes } from 'styled-components'
import { backgroundHeight } from '../images'

const contentMaxWidth = 580
const slideContentHeight = 540
const footerHeight = 52
const footerTopMargin = 24
Expand Down Expand Up @@ -42,7 +43,8 @@ export const Footer = styled(BaseGrid.withComponent('footer'))`
grid-template-columns: 1fr 1fr 1fr;
grid-template-rows: ${footerHeight}px;
max-width: 540px;
margin: ${footerTopMargin}px 0 0 0;
margin: ${footerTopMargin}px auto 0;
height: auto;
`

export const FooterLeftColumn = styled(BaseColumn)`
Expand Down Expand Up @@ -72,15 +74,20 @@ export const Content = styled<ContentProps, 'section'>('section')`
will-change: transform;
transform: translateX(${p => p.isPrevious ? '-' + p.screenPosition : p.screenPosition}) scale(0.8);
transition: opacity 600ms, transform 600ms ease-in-out;
position: absolute;
z-index: ${p => p.zIndex};
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
flex: 1;
max-width: 580px;
max-width: ${contentMaxWidth}px;
padding: 24px;
margin: auto;
/*
inactive elements need to be absolute positioned to prevent pilling up
in the background making visible elements misaligned. In this case display:none
would prevent us from seeing the ransition animation. See comment below.
*/
position: ${p => p.active ? 'static' : 'absolute'};
/*
prevents focus on all content's child elements if the parent is not active.
Expand All @@ -106,12 +113,7 @@ interface PageProps {
export const Page = styled<PageProps, 'div'>('div')`
width: inherit;
height: inherit;
display: flex;
align-items: flex-start;
justify-content: center;
background: ${p => p.theme.color.panelBackground};
flex-direction: column;
position: relative;
overflow-x: hidden;
overflow-y: ${p => p.shouldUpdateElementOverflow ? 'initial' : 'hidden' };
`
Expand All @@ -128,23 +130,15 @@ export const Panel = styled('div')`
animation-fill-mode: forwards;
/* end of animation stuff */
box-sizing: border-box;
position: relative;
max-width: 800px;
max-width: ${contentMaxWidth}px;
width: 100%;
display: flex;
flex-direction: column;
margin: 0 auto;
font-size: inherit;
align-items: center;
min-height: ${slideContentHeight + footerTopMargin + footerHeight}px;
height: calc(100vh - ${backgroundHeight}px);
`

export const SlideContent = styled<{}, 'div'>('div')`
max-width: inherit;
width: inherit;
min-height: ${slideContentHeight}px;
display: flex;
justify-content: center;
align-items: center;
height: ${slideContentHeight}px;
`

0 comments on commit 4e90a33

Please sign in to comment.