diff --git a/.gitignore b/.gitignore index b841e9a96..4e3544788 100644 --- a/.gitignore +++ b/.gitignore @@ -66,3 +66,4 @@ typings/ /asset-manifest.json .DS_Store +stats.json diff --git a/app/assets/images/malibu-logo.jpg b/app/assets/images/malibu-logo.jpg new file mode 100644 index 000000000..11248c214 Binary files /dev/null and b/app/assets/images/malibu-logo.jpg differ diff --git a/app/assets/images/user-icon.svg b/app/assets/images/user-icon.svg new file mode 100644 index 000000000..1feb2b311 --- /dev/null +++ b/app/assets/images/user-icon.svg @@ -0,0 +1,6 @@ + \ No newline at end of file diff --git a/app/assets/images/user.svg b/app/assets/images/user.svg new file mode 100644 index 000000000..1d6f3a0e2 --- /dev/null +++ b/app/assets/images/user.svg @@ -0,0 +1,22 @@ + + \ No newline at end of file diff --git a/app/assets/stylesheets/app.scss b/app/assets/stylesheets/app.scss index 6e6112838..c8b8a22bf 100644 --- a/app/assets/stylesheets/app.scss +++ b/app/assets/stylesheets/app.scss @@ -4,6 +4,12 @@ @import "./base/z-index.scss"; @import "./base/colors.scss"; +@import "./base/normalize.scss"; +@import "./base/typography.scss"; + +:root { + --container-width: 1280px; +} *, *::after, @@ -19,6 +25,7 @@ html { body { margin: 0; + background-color: var(--white); } img { @@ -30,49 +37,6 @@ a { font-weight: normal; } -/* Menu */ -#main-navigation { - position: fixed; - left: 0; - right: 0; - top: 0; - bottom: 0; - z-index: 10; - transform: translateY(-100%); - background-color: black; - transition: all 0.5s; -} - -#main-navigation ul { - list-style: none; - padding: 0; - max-width: 400px; - margin: 0 auto; - text-align: center; -} - -#main-navigation li { - padding: 10px 0; - color: white; -} - -#main-navigation li a { - color: white; - font-size: 32px; - text-transform: uppercase; - font-family: var(--title-font); - text-decoration: none; - transition: all 0.5s; -} - -#main-navigation li a:hover { - border-bottom: 1px solid white; -} - -#main-navigation:target { - transform: translateY(0); -} - #breaking-news-container { min-height: 71px; @@ -82,79 +46,11 @@ a { } .container { - max-width: 1000px; + max-width: var(--container-width); margin: 0 auto; padding: 0 16px; } -h1 { - font-family: var(--title-font); - font-size: 30px; - font-weight: 800; - margin: 10px 0; - text-align: center; - text-transform: uppercase; -} - -h1 span { - font-family: var(--content-font); - font-size: 24px; - font-style: italic; - font-weight: 400; - margin: 0 5px; - text-transform: none; -} - -.toggle { - display: block; - width: 28px; - height: 30px; - margin: 30px auto 10px; -} - -.toggle span::after, -.toggle span::before { - content: ""; - position: absolute; - left: 0; - top: -9px; -} - -.toggle span::after { - top: 9px; -} - -.toggle span { - position: relative; - display: block; -} - -.toggle span, -.toggle span::after, -.toggle span::before { - width: 100%; - height: 5px; - background-color: black; - transition: all 0.3s; - backface-visibility: hidden; - border-radius: 2px; -} - -/* on activation */ -.toggle.on span { - background-color: transparent; -} - -.toggle.on span::before { - background-color: white; - transform: rotate(45deg) translate(5px, 5px); -} - -.toggle.on span::after { - background-color: white; - transform: rotate(-45deg) translate(7px, -8px); -} - .app-loading { width: 100%; height: 300px; @@ -184,7 +80,7 @@ h1 span { } } -.story-grid-item h2 { +.story-grid-item h3 { font-size: 16px; text-align: center; height: 100px; @@ -261,3 +157,20 @@ h1 span { } } } + +.topbar-wrapper { + display: flex; + justify-content: space-between; + align-items: center; +} + +.sticky-header { + position: sticky; + top: 0; + z-index: 1; +} + +.logo-wrapper { + line-height: 0; + padding: 16px 0; +} diff --git a/app/assets/stylesheets/base/colors.scss b/app/assets/stylesheets/base/colors.scss index 0e0f776a1..7cc03479b 100644 --- a/app/assets/stylesheets/base/colors.scss +++ b/app/assets/stylesheets/base/colors.scss @@ -1,6 +1,15 @@ :root { --white: #ffffff; - --rgbBlack: 0, 0, 0; + --rgb-black: 0, 0, 0; + --brand-primary: #2cc7a4; + --brand-primary-dark: #108167; + --brand-secondary: #1e1e1e; + --grey-light: #e8e8e8; + --grey-dark: #9c9c9c; + + --meta-color: var(--brand-primary); + --title-color: var(--brand-secondary); + --border-color: var(--grey-light); --malibu-gray9: #9c9c9c; --torch-red: #ff0033; --lime-green: #4bb543; diff --git a/app/assets/stylesheets/base/normalize.scss b/app/assets/stylesheets/base/normalize.scss new file mode 100644 index 000000000..59db9346d --- /dev/null +++ b/app/assets/stylesheets/base/normalize.scss @@ -0,0 +1,343 @@ +/*! normalize.css v8.0.0 | MIT License | github.com/necolas/normalize.css */ + +/* Document + ========================================================================== */ + +/** + * 1. Correct the line height in all browsers. + * 2. Prevent adjustments of font size after orientation changes in iOS. + */ + +html { + line-height: 1.15; /* 1 */ + -webkit-text-size-adjust: 100%; /* 2 */ +} + +/* Sections + ========================================================================== */ + +/** + * Remove the margin in all browsers. + */ + +body { + margin: 0; +} + +/** + * Correct the font size and margin on `h1` elements within `section` and + * `article` contexts in Chrome, Firefox, and Safari. + */ + +h1 { + font-size: 2em; + margin: 0.67em 0; +} + +/* Grouping content + ========================================================================== */ + +/** + * 1. Add the correct box sizing in Firefox. + * 2. Show the overflow in Edge and IE. + */ + +hr { + box-sizing: content-box; /* 1 */ + height: 0; /* 1 */ + overflow: visible; /* 2 */ +} + +/** + * 1. Correct the inheritance and scaling of font size in all browsers. + * 2. Correct the odd `em` font sizing in all browsers. + */ + +pre { + font-family: monospace; /* 1 */ + font-size: 1em; /* 2 */ +} + +/* Text-level semantics + ========================================================================== */ + +/** + * Remove the gray background on active links in IE 10. + */ + +a { + background-color: transparent; +} + +/** + * 1. Remove the bottom border in Chrome 57- + * 2. Add the correct text decoration in Chrome, Edge, IE, Opera, and Safari. + */ + +abbr[title] { + border-bottom: none; /* 1 */ + text-decoration: underline; /* 2 */ + text-decoration: underline dotted; /* 2 */ +} + +/** + * Add the correct font weight in Chrome, Edge, and Safari. + */ + +b, +strong { + font-weight: bolder; +} + +/** + * 1. Correct the inheritance and scaling of font size in all browsers. + * 2. Correct the odd `em` font sizing in all browsers. + */ + +code, +kbd, +samp { + font-family: monospace; /* 1 */ + font-size: 1em; /* 2 */ +} + +/** + * Add the correct font size in all browsers. + */ + +small { + font-size: 80%; +} + +/** + * Prevent `sub` and `sup` elements from affecting the line height in + * all browsers. + */ + +sub, +sup { + font-size: 75%; + line-height: 0; + position: relative; + vertical-align: baseline; +} + +sub { + bottom: -0.25em; +} + +sup { + top: -0.5em; +} + +/* Embedded content + ========================================================================== */ + +/** + * Remove the border on images inside links in IE 10. + */ + +img { + border-style: none; +} + +/* Forms + ========================================================================== */ + +/** + * 1. Change the font styles in all browsers. + * 2. Remove the margin in Firefox and Safari. + */ + +button, +input, +optgroup, +select, +textarea { + font-family: inherit; /* 1 */ + font-size: 100%; /* 1 */ + line-height: 1.15; /* 1 */ + margin: 0; /* 2 */ +} + +/** + * Show the overflow in IE. + * 1. Show the overflow in Edge. + */ + +button, +input { + /* 1 */ + overflow: visible; +} + +/** + * Remove the inheritance of text transform in Edge, Firefox, and IE. + * 1. Remove the inheritance of text transform in Firefox. + */ + +button, +select { + /* 1 */ + text-transform: none; +} + +/** + * Correct the inability to style clickable types in iOS and Safari. + */ + +button, +[type="button"], +[type="reset"], +[type="submit"] { + -webkit-appearance: button; +} + +/** + * Remove the inner border and padding in Firefox. + */ + +button::-moz-focus-inner, +[type="button"]::-moz-focus-inner, +[type="reset"]::-moz-focus-inner, +[type="submit"]::-moz-focus-inner { + border-style: none; + padding: 0; +} + +/** + * Restore the focus styles unset by the previous rule. + */ + +button:-moz-focusring, +[type="button"]:-moz-focusring, +[type="reset"]:-moz-focusring, +[type="submit"]:-moz-focusring { + outline: 1px dotted ButtonText; +} + +/** + * Correct the padding in Firefox. + */ + +fieldset { + padding: 0.35em 0.75em 0.625em; +} + +/** + * 1. Correct the text wrapping in Edge and IE. + * 2. Correct the color inheritance from `fieldset` elements in IE. + * 3. Remove the padding so developers are not caught out when they zero out + * `fieldset` elements in all browsers. + */ + +legend { + box-sizing: border-box; /* 1 */ + color: inherit; /* 2 */ + display: table; /* 1 */ + max-width: 100%; /* 1 */ + padding: 0; /* 3 */ + white-space: normal; /* 1 */ +} + +/** + * Add the correct vertical alignment in Chrome, Firefox, and Opera. + */ + +progress { + vertical-align: baseline; +} + +/** + * Remove the default vertical scrollbar in IE 10+. + */ + +textarea { + overflow: auto; +} + +/** + * 1. Add the correct box sizing in IE 10. + * 2. Remove the padding in IE 10. + */ + +[type="checkbox"], +[type="radio"] { + box-sizing: border-box; /* 1 */ + padding: 0; /* 2 */ +} + +/** + * Correct the cursor style of increment and decrement buttons in Chrome. + */ + +[type="number"]::-webkit-inner-spin-button, +[type="number"]::-webkit-outer-spin-button { + height: auto; +} + +/** + * 1. Correct the odd appearance in Chrome and Safari. + * 2. Correct the outline style in Safari. + */ + +[type="search"] { + -webkit-appearance: textfield; /* 1 */ + outline-offset: -2px; /* 2 */ +} + +/** + * Remove the inner padding in Chrome and Safari on macOS. + */ + +[type="search"]::-webkit-search-decoration { + -webkit-appearance: none; +} + +/** + * 1. Correct the inability to style clickable types in iOS and Safari. + * 2. Change font properties to `inherit` in Safari. + */ + +::-webkit-file-upload-button { + -webkit-appearance: button; /* 1 */ + font: inherit; /* 2 */ +} + +/* Interactive + ========================================================================== */ + +/* + * Add the correct display in Edge, IE 10+, and Firefox. + */ + +details { + display: block; +} + +/* + * Add the correct display in all browsers. + */ + +summary { + display: list-item; +} + +/* Misc + ========================================================================== */ + +/** + * Add the correct display in IE 10+. + */ + +template { + display: none; +} + +/** + * Add the correct display in IE 10. + */ + +[hidden] { + display: none; +} diff --git a/app/assets/stylesheets/base/typography.scss b/app/assets/stylesheets/base/typography.scss new file mode 100644 index 000000000..3e8414ce1 --- /dev/null +++ b/app/assets/stylesheets/base/typography.scss @@ -0,0 +1,54 @@ +:root { + --base-smallest: 1.2rem; + --base-smaller: 1.4rem; + --base-regular: 1.3rem; + --base-small: 1.5rem; + --base: 1.6rem; + --base-medium: 1.8rem; + --base-large: 2rem; + --base-larger: 2.4rem; + --medium: 2.6rem; + --large: 3.2rem; + --jumbo: 5.4rem; + + --regular: 400; + --semi-bold: 600; + --bold: 700; +} + +a { + text-decoration: none; + color: inherit; +} + +html { + font-size: 62.5%; +} + +body { + font-family: var(--content-font); + font-weight: var(--regular); + font-size: var(--base); + text-rendering: optimizeLegibility; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + -moz-font-feature-settings: "liga" on; +} +h1, +h2, +h3, +h4, +h5, +h6, +p, +ul, +ol { + margin: 0; + padding: 0; + font-family: var(--content-font); +} + +p, +li { + font-size: var(--base); +} diff --git a/app/assets/stylesheets/base/z-index.scss b/app/assets/stylesheets/base/z-index.scss index 412433a78..9ec4e2b1f 100644 --- a/app/assets/stylesheets/base/z-index.scss +++ b/app/assets/stylesheets/base/z-index.scss @@ -1,4 +1,8 @@ :root { - --z-level-1: 100; - --modal: var(--z-level-1); + --zlevel-1: -1; + --zlevel0: 1; + --zlevel1: 2; + --zlevel2: 3; + --zlevel3: 4; + --zlevel100: 100; } diff --git a/app/assets/stylesheets/modal.scss b/app/assets/stylesheets/modal.scss index 46bdf35b3..da392fd7e 100644 --- a/app/assets/stylesheets/modal.scss +++ b/app/assets/stylesheets/modal.scss @@ -12,8 +12,8 @@ left: 0; right: 0; bottom: 0; - z-index: var(--modal); - background: rgba(var(--rgbBlack), 0.5); + background: rgba(var(--rgb-black), 0.5); + z-index: var( --zlevel3); } .modal-content { diff --git a/app/client/app.js b/app/client/app.js index e3056f988..f8af58baa 100644 --- a/app/client/app.js +++ b/app/client/app.js @@ -1,9 +1,9 @@ /* eslint-disable global-require */ -import wretch from "wretch"; import { startApp } from "@quintype/framework/client/start"; +import wretch from "wretch"; + import { renderApplication, preRenderApplication } from "./render"; import { REDUCERS } from "../isomorphic/components/store/reducers"; - import "../../app/assets/stylesheets/app.scss"; const opts = { diff --git a/app/client/render.js b/app/client/render.js index 762435d39..a77de85e8 100644 --- a/app/client/render.js +++ b/app/client/render.js @@ -3,8 +3,9 @@ import get from "lodash/get"; import { pickComponent } from "../isomorphic/pick-component"; import { BreakingNewsView } from "../isomorphic/components/breaking-news-view"; -import { Header } from "../isomorphic/components/header"; import { Footer } from "../isomorphic/components/layouts/footer"; +import { NavbarSearch } from "../isomorphic/components/header/navbar-search"; +import { NavBar } from "../isomorphic/components/header/nav-bar"; export function preRenderApplication(store) { const hydrate = { hydrate: !global.qtLoadedFromShell }; @@ -16,7 +17,8 @@ export function preRenderApplication(store) { updateInterval: breakingNewsInterval * 1000 }; - renderComponent(Header, "header", store, hydrate); + renderComponent(NavbarSearch, "search-bar", store, hydrate); + renderComponent(NavBar, "nav-bar", store, hydrate); breakingNewsConfig.is_enable && renderBreakingNews("breaking-news-container", store, BreakingNewsView, breakingNewsbaseProps); renderComponent(Footer, "footer", store, hydrate); diff --git a/app/isomorphic/components/atoms/hamburger-menu/hamburger-menu.m.css b/app/isomorphic/components/atoms/hamburger-menu/hamburger-menu.m.css new file mode 100644 index 000000000..9553ca087 --- /dev/null +++ b/app/isomorphic/components/atoms/hamburger-menu/hamburger-menu.m.css @@ -0,0 +1,37 @@ +.hamburger { + background-color: transparent; + border: 0; + box-shadow: none; + cursor: pointer; + padding: 0; + margin: 12px 0; +} + +.hamburger:focus { + outline: none; +} + +.line { + background-color: var(--brand-secondary); + display: block; + height: 3px; + width: 22px; + transition: all 0.1s ease-in; + border-radius: 2px; +} + +.line:nth-child(2) { + margin: 4px 0; +} + +.hamburger.is-open span:nth-child(1) { + transform: translateY(4px) rotate(45deg); +} + +.hamburger.is-open span:nth-child(2) { + opacity: 0; +} + +.hamburger.is-open span:nth-child(3) { + transform: translateY(-10px) rotate(-45deg); +} diff --git a/app/isomorphic/components/atoms/hamburger-menu/index.js b/app/isomorphic/components/atoms/hamburger-menu/index.js new file mode 100644 index 000000000..f2c1b5c49 --- /dev/null +++ b/app/isomorphic/components/atoms/hamburger-menu/index.js @@ -0,0 +1,22 @@ +import React from "react"; +import PT from "prop-types"; + +import "./hamburger-menu.m.css"; + +export const HamburgerMenu = ({ onMenuToggle, isMegaMenuOpen }) => ( + +); + +HamburgerMenu.propTypes = { + onMenuToggle: PT.func, + isMegaMenuOpen: PT.bool +}; + +export default HamburgerMenu; diff --git a/app/isomorphic/components/atoms/icons/arrow-down.svg b/app/isomorphic/components/atoms/icons/arrow-down.svg new file mode 100644 index 000000000..f0dc531a8 --- /dev/null +++ b/app/isomorphic/components/atoms/icons/arrow-down.svg @@ -0,0 +1 @@ + diff --git a/app/isomorphic/components/atoms/icons/google.js b/app/isomorphic/components/atoms/icons/google.js index ea5d4f0b5..d0f9ae638 100644 --- a/app/isomorphic/components/atoms/icons/google.js +++ b/app/isomorphic/components/atoms/icons/google.js @@ -1,5 +1,5 @@ import React from "react"; -import { number } from "prop-types"; +import PT from "prop-types"; export const Google = ({ width = 13, height = 13 }) => { return ( @@ -25,6 +25,6 @@ export const Google = ({ width = 13, height = 13 }) => { }; Google.propTypes = { - width: number, - height: number + width: PT.number, + height: PT.number }; diff --git a/app/isomorphic/components/breaking-news-view.js b/app/isomorphic/components/breaking-news-view.js index d53a62305..ce8a6e56a 100644 --- a/app/isomorphic/components/breaking-news-view.js +++ b/app/isomorphic/components/breaking-news-view.js @@ -49,7 +49,7 @@ export const BreakingNewsViewBase = ({ breakingNews = [], breakingNewsConfig = { } return ( -