From b777a8ed5cd24767294b7e489133a6ecceb00ea3 Mon Sep 17 00:00:00 2001 From: Brian Miller Date: Tue, 31 Jul 2018 09:13:14 -0500 Subject: [PATCH 01/13] Added Fallback logic on header not having an image --- src/components/Story/Body.jsx | 11 ++++++++++- src/components/Story/Header.jsx | 27 ++++++++++++++++----------- src/components/Story/HeaderText.jsx | 25 +++++++++++++++++++++++++ 3 files changed, 51 insertions(+), 12 deletions(-) create mode 100644 src/components/Story/HeaderText.jsx diff --git a/src/components/Story/Body.jsx b/src/components/Story/Body.jsx index 9220cee..276eacb 100644 --- a/src/components/Story/Body.jsx +++ b/src/components/Story/Body.jsx @@ -1,10 +1,11 @@ import React from 'react'; import PropTypes from 'prop-types'; +import Imgix from '../Imgix'; import { Container } from 'reactstrap'; const Body = (props) => { const { - body, teaser, + body, advertiser, teaser, } = props; const createMarkup = html => ({ __html: html }); @@ -62,6 +63,7 @@ const Body = (props) => { } `} +

{teaser} @@ -76,10 +78,17 @@ const Body = (props) => { Body.defaultProps = { teaser: '', + advertiser: { + name: '', + logo: { + src: '', + }, + }, }; Body.propTypes = { teaser: PropTypes.string, + advertiser: PropTypes.object, body: PropTypes.string.isRequired, }; diff --git a/src/components/Story/Header.jsx b/src/components/Story/Header.jsx index b9c051e..f9eb7bd 100644 --- a/src/components/Story/Header.jsx +++ b/src/components/Story/Header.jsx @@ -3,16 +3,28 @@ import PropTypes from 'prop-types'; import Head from 'next/head'; import { Row, Col, Container } from 'reactstrap'; import Imgix from '../Imgix'; +import HeaderText from './HeaderText'; import HeaderStyle from './HeaderStyle'; const Header = (props) => { const { title, + teaser, primaryImgSrc, primaryImgCaption, - teaser, } = props; + const headerHTML = primaryImgSrc + ? + + + + : +
+ +
+ ; + return (
@@ -20,15 +32,7 @@ const Header = (props) => { {title} - - - - -

{title}

- -
-
-
+ {headerHTML}
); }; @@ -36,12 +40,13 @@ const Header = (props) => { Header.defaultProps = { teaser: '', primaryImgCaption: '', + primaryImgSrc: '', }; Header.propTypes = { title: PropTypes.string.isRequired, teaser: PropTypes.string, - primaryImgSrc: PropTypes.string.isRequired, + primaryImgSrc: PropTypes.string, primaryImgCaption: PropTypes.string, }; diff --git a/src/components/Story/HeaderText.jsx b/src/components/Story/HeaderText.jsx new file mode 100644 index 0000000..94be030 --- /dev/null +++ b/src/components/Story/HeaderText.jsx @@ -0,0 +1,25 @@ +import React from 'react'; +import PropTypes from 'prop-types'; +import { Row, Col, Container } from 'reactstrap'; + +const HeaderText = (props) => { + const { + title, + } = props; + + return ( + + + +

{title}

+ +
+
+ ); +}; + +HeaderText.propTypes = { + title: PropTypes.string.isRequired, +}; + +export default HeaderText; From c91f85cf6d91ac0a1c1005c0d7a4dabd0f908d39 Mon Sep 17 00:00:00 2001 From: Brian Miller Date: Tue, 31 Jul 2018 10:17:53 -0500 Subject: [PATCH 02/13] Add Story Provider and Advertiser to Nav --- src/components/Navbar.jsx | 30 ++++++++++++++---- src/components/NavbarStyle.jsx | 2 +- src/components/Story/Body.jsx | 1 - src/components/StoryProvider.jsx | 32 +++++++++++++++++++ src/pages/story.jsx | 53 ++++++++++++-------------------- 5 files changed, 77 insertions(+), 41 deletions(-) create mode 100644 src/components/StoryProvider.jsx diff --git a/src/components/Navbar.jsx b/src/components/Navbar.jsx index 110da1f..80d5de2 100644 --- a/src/components/Navbar.jsx +++ b/src/components/Navbar.jsx @@ -2,14 +2,14 @@ import React from 'react'; import Link from 'next/link'; import { Navbar, NavbarBrand, Nav } from 'reactstrap'; import NavbarStyle from './NavbarStyle'; -// import Imgix from './Imgix'; +import { StoryContext } from './StoryProvider'; +import Imgix from './Imgix'; // import { AccountContext } from './AccountProvider'; export default () => ( - - +