Skip to content

Commit

Permalink
Ch/layout (#457)
Browse files Browse the repository at this point in the history
* starting styling layout and structure of mobile

* added styling for desktop layout

* tweaked heading margin

* ran yarn format

* ran yarn format

* removed prettier dev dependency

* Ch/qa scrolling (#458)
  • Loading branch information
Chloe Hwang authored Jan 3, 2018
1 parent 08c0151 commit 9e05947
Show file tree
Hide file tree
Showing 12 changed files with 236 additions and 74 deletions.
2 changes: 1 addition & 1 deletion packages/microcosm-www-next/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"gatsby-link": "^1.6.22",
"gatsby-plugin-react-helmet": "^1.0.8",
"gatsby-plugin-sass": "^1.0.12",
"react-intersection-observer": "^2.0.3"
"intersection-observer": "^0.5.0"
},
"keywords": [
"gatsby"
Expand Down
14 changes: 6 additions & 8 deletions packages/microcosm-www-next/src/components/graphic.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
import React from 'react'

const Graphic = ({ section, graphicUrl }) => (
<figure>
<img
src={graphicUrl}
alt="TODO"
className="section__graphic__figure"
data-module="ObserveGraphic"
data-section={section}
/>
<figure
className="section__graphic__figure"
data-module="ObserveGraphic"
data-section={section}
>
<img src={graphicUrl} alt="TODO" />
</figure>
)

Expand Down
5 changes: 5 additions & 0 deletions packages/microcosm-www-next/src/images/arrow.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions packages/microcosm-www-next/src/layouts/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import Link from 'gatsby-link'
import Helmet from 'react-helmet'
import VigetLogo from '../components/viget-logo'

import 'intersection-observer'
import '../stylesheets/app.scss'

const Navigation = () => (
Expand Down
77 changes: 49 additions & 28 deletions packages/microcosm-www-next/src/pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ export default class IndexPage extends React.Component {
}
}

componentWillMount() {
this.sections = this.createSectionsArray()
}

componentDidMount() {
this.setVars()
this.beginObserve()
Expand All @@ -27,6 +31,16 @@ export default class IndexPage extends React.Component {
}
}

createSectionsArray() {
let arr = []

for (let i = 0; i < this.state.numSections; i++) {
arr.push(i + 1)
}

return arr
}

beginObserve() {
//create new Observer instance
let observer = new IntersectionObserver(
Expand All @@ -35,7 +49,9 @@ export default class IndexPage extends React.Component {
)

//start observing each graphic
this.graphics.forEach(graphic => observer.observe(graphic))
for (let i = 0; i < this.graphics.length; i++) {
observer.observe(this.graphics[i])
}
}

onIntersection = observed => {
Expand Down Expand Up @@ -72,36 +88,41 @@ export default class IndexPage extends React.Component {
<div className="wrapper">
<section className="section">
<div className="section__content">
<h2
className="section__content__heading"
dangerouslySetInnerHTML={{ __html: sectionData.heading }}
/>

<h3 className={'section__content__subheading -top' + browserClass}>
In
</h3>
<p
className="section__content__text"
dangerouslySetInnerHTML={{ __html: text }}
/>

<h3
className={'section__content__subheading -bottom' + browserClass}
>
Meanwhile, in
</h3>
<button
onClick={this.switchView}
className={'section__browser-btn' + browserClass}
/>
<div className="text-container">
<h2
className="section__content__heading"
dangerouslySetInnerHTML={{ __html: sectionData.heading }}
/>
<h3
className={'section__content__subheading -top' + browserClass}
>
In
</h3>
<p
className="section__content__text"
dangerouslySetInnerHTML={{ __html: text }}
/>
</div>

<div className="toggle-container">
<h3
className={
'section__content__subheading -bottom' + browserClass
}
>
Meanwhile, in
</h3>
<button
onClick={this.switchView}
className={'section__toggle-btn' + browserClass}
/>
</div>
</div>

<div className="section__graphic">
{Array(this.state.numSections)
.fill()
.map((el, i) => (
<Graphic key={i} section={i + 1} graphicUrl={graphicUrl} />
))}
{this.sections.map(num => (
<Graphic key={num} section={num} graphicUrl={graphicUrl} />
))}
</div>
</section>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@ svg {
max-width: 100%;
}

a {
color: white;
}

button {
cursor: pointer;
}

// box-sizing -- http://css-tricks.com/inheriting-box-sizing-probably-slightly-better-best-practice/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ $breakpoints : (
small-desktop-up : 'min-width: 840px',
small-desktop-down : 'max-width: 959px',
medium-desktop-up : 'min-width: 960px',
medium-desktop-down: 'max-width: 1279px',
large-desktop-up : 'min-width: 1280px',
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@
$colors: (
bg-1-top: #293256,
bg-1-bottom: #5572a4,
bg-1-nav: #1d243c,
bg-1-footer: #3b4f72,
bg-1-nav: #1d233c,
bg-1-footer: #293256,
bg-2-top: #ffa991,
bg-2-bottom: #dd5757,
bg-2-nav: #b27665,
bg-2-footer: #9a3c3d,
bg-2-footer: #c34040,
bg-3-top: #3e9e94,
bg-3-bottom: #19594d,
bg-3-nav: #2c6e67,
bg-3-footer: #123d36,
bg-3-footer: #10453b,

// elements
text : #fff,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

$page-gutter: 20px;
$nav-height: 76px;
$footer-height: 167px;
$footer-height: 145px;

$section-count: 3;
Original file line number Diff line number Diff line change
@@ -1,16 +1,24 @@
$split-bg-height-mobile: 471px;
$split-bg-height-desktop: 291px;

body {
background-color: color(bg-1-bottom);
position: relative;
transition: transition(background-color);

&::before { //top of half split bg
background-color: color(bg-1-top);
content: '';
height: 281px;
height: $split-bg-height-mobile;
position: fixed;
top: 0;
transition: transition(background-color);
width: 100%;
z-index: -1;

@include breakpoint(large-desktop-up) {
height: $split-bg-height-desktop;
}
}

@for $i from 1 through $section-count {
Expand Down
35 changes: 26 additions & 9 deletions packages/microcosm-www-next/src/stylesheets/structure/_footer.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,10 @@ $cta-border-height: 3px;
$cta-bottom-padding: 6px;

.footer {
align-items: center;
background-color: color(bg-1-footer);
bottom: 0;
display: flex;
height: $footer-height;
justify-content: center;
position: fixed;
position: relative;
transition: transition(background-color);
width: 100%;
z-index: 2;
Expand All @@ -19,23 +16,43 @@ $cta-bottom-padding: 6px;
}
}

@include breakpoint(large-desktop-up) {
position: fixed;

@media (max-height: 900px) { // if browser is shorter than 900px, don't fix footer to bottom
position: absolute;
}
}

.wrapper {
padding-bottom: $cta-border-height + $cta-bottom-padding + 3px;
align-items: center;
display: flex;
flex-direction: column;
height: 100%;
justify-content: center;

@include breakpoint(large-desktop-up) {
flex-direction: row;
}
}

.viget-logo {
display: block;
margin-bottom: 5px;
margin-bottom: rem(10);

@include breakpoint(large-desktop-up) {
margin-bottom: 0;
margin-right: rem(30);
}

svg {
fill: rgba(#fff, 0.55);
fill: rgba(#fff, 0.5);
}
}
}

.footer__cta {
border-bottom: $cta-border-height solid;
color: rgba(#fff, 0.55);
color: rgba(#fff, 0.5);
font-size: rem(14);
padding-bottom: $cta-bottom-padding;
text-decoration: none;
Expand Down
Loading

0 comments on commit 9e05947

Please sign in to comment.