diff --git a/components/Article/index.jsx b/components/Article/index.jsx index 66b66a4..9c8edc0 100644 --- a/components/Article/index.jsx +++ b/components/Article/index.jsx @@ -51,7 +51,9 @@ export default class Article extends React.Component { margin: 20px 0; `} > +
{moment.utc(this.props.date).format("MMM D, YYYY h:mm a")} @@ -227,7 +230,7 @@ export default class Article extends React.Component { css={css` font-size: 12px; font-family: ${globals.bodyFont}; - color: ${globals.darkGray}; + color: ${this.props.darkmode ? "#fff" : globals.darkGray}; max-width: 640px; margin: 20px auto 0; `} @@ -243,7 +246,7 @@ export default class Article extends React.Component { text-align: left; line-height: 1.75; - color: #000000; + color: ${this.props.darkmode ? "#fff" : "#000"}; display: block; max-width: 640px; margin: auto; @@ -294,6 +297,7 @@ export default class Article extends React.Component { } & iframe { + ${this.props.darkmode ? "filter: brightness(0.6);" : ""} width: 100%; } @@ -338,6 +342,7 @@ export default class Article extends React.Component { />
diff --git a/components/ArticleCard/Full.jsx b/components/ArticleCard/Full.jsx index 8259ca0..fbb4d78 100644 --- a/components/ArticleCard/Full.jsx +++ b/components/ArticleCard/Full.jsx @@ -14,7 +14,7 @@ export default function Full(props) { display: block; padding: 10px; box-shadow: ${globals.cardShadow}; - background-color: #ffffff; + background-color: ${props.darkmode ? "#222" : "#fff"}; `} > @@ -43,9 +43,9 @@ export default function Full(props) { dangerouslySetInnerHTML={{ __html: props.category.name }} /> - {moment(props.date).format("MMM D, YYYY h:mm a")} @@ -62,7 +64,7 @@ export default function Full(props) {
@@ -110,7 +113,8 @@ export default function Full(props) { font-weight: bold; font-size: 11px; - color: #000000; + color: ${props.darkmode ? "#ddd" : "#000"}; + `} > By {utilities.renderAuthors(props.authors)} diff --git a/components/ArticleCard/Horz.jsx b/components/ArticleCard/Horz.jsx index 9cc6184..5fd7cd8 100644 --- a/components/ArticleCard/Horz.jsx +++ b/components/ArticleCard/Horz.jsx @@ -14,7 +14,7 @@ export default function Horz(props) { display: flex; box-shadow: ${globals.cardShadow}; padding: 0px; - background-color: #ffffff; + background-color: ${props.darkmode ? "#222" : "#fff"}; `} >
{props.photographer} @@ -99,7 +99,7 @@ export default function Horz(props) { {moment(props.date).format("MMM D, YYYY h:mm a")} @@ -116,7 +118,7 @@ export default function Horz(props) {
@@ -141,7 +143,8 @@ export default function Horz(props) { font-weight: bold; font-size: 11px; - color: #000000; + color: ${props.darkmode ? "#ddd" : "#000"}; + `} > By {utilities.renderAuthors(props.authors)} diff --git a/components/ArticleCard/Long.jsx b/components/ArticleCard/Long.jsx index 2f9234c..3b3debf 100644 --- a/components/ArticleCard/Long.jsx +++ b/components/ArticleCard/Long.jsx @@ -14,7 +14,7 @@ export default function Long(props) { box-shadow: ${globals.cardShadow}; height: 100%; padding: 0px; - background-color: #ffffff; + background-color: ${props.darkmode ? "#222" : "#fff"}; `} >
{moment(props.date).format("MMM D, YYYY h:mm a")} @@ -68,7 +69,7 @@ export default function Long(props) {

@@ -94,7 +95,7 @@ export default function Long(props) { font-weight: bold; font-size: 11px; - color: #000000; + color: ${props.darkmode ? "#ddd" : "#000"}; `} > By {utilities.renderAuthors(props.authors)} diff --git a/components/ArticleCard/Mini.jsx b/components/ArticleCard/Mini.jsx index 3467fca..fa0da80 100644 --- a/components/ArticleCard/Mini.jsx +++ b/components/ArticleCard/Mini.jsx @@ -14,7 +14,7 @@ export default function Mini(props) { display: flex; box-shadow: ${globals.cardShadow}; padding: 0px; - background-color: #ffffff; + background-color: ${props.darkmode ? "#222" : "#fff"}; `} >
@@ -50,7 +50,7 @@ export default function Podcast(props) { font-size: 8px; text-align: right; - color: #000000; + color: ${props.darkmode ? "#ddd" : "#000"}; `} > {props.photographer} @@ -83,7 +83,7 @@ export default function Podcast(props) { {moment(props.date).format("MMM D, YYYY h:mm a")} @@ -100,14 +101,14 @@ export default function Podcast(props) {
@@ -121,7 +122,7 @@ export default function Podcast(props) { font-weight: 700; font-size: 11px; - color: #000000; + color: ${props.darkmode ? "#ddd" : "#000"}; `} > By {utilities.renderAuthors(props.authors)} diff --git a/components/ArticleCard/Vert.jsx b/components/ArticleCard/Vert.jsx index c8358dc..b84d3eb 100644 --- a/components/ArticleCard/Vert.jsx +++ b/components/ArticleCard/Vert.jsx @@ -14,7 +14,7 @@ export default function Vert(props) { display: block; padding: 10px; box-shadow: ${globals.cardShadow}; - background-color: #ffffff; + background-color: ${props.darkmode ? "#222" : "#fff"}; `} > @@ -36,7 +36,7 @@ export default function Vert(props) { font-size: 8px; text-align: right; - color: #000000; + color: ${props.darkmode ? "#ddd" : "#000"}; `} > {props.photographer} @@ -69,7 +69,7 @@ export default function Vert(props) { {moment(props.date).format("MMM D, YYYY h:mm a")} @@ -86,7 +88,7 @@ export default function Vert(props) {
@@ -111,7 +113,8 @@ export default function Vert(props) { font-weight: 700; font-size: 11px; - color: #000000; + color: ${props.darkmode ? "#ddd" : "#000"}; + `} > By {utilities.renderAuthors(props.authors)} diff --git a/components/ArticleCard/Video.jsx b/components/ArticleCard/Video.jsx index c90fcec..d4285b7 100644 --- a/components/ArticleCard/Video.jsx +++ b/components/ArticleCard/Video.jsx @@ -14,10 +14,11 @@ export default function Video(props) { display: block; padding: 10px; box-shadow: ${globals.cardShadow}; - background-color: #ffffff; + background-color: ${props.darkmode ? "#222" : "#fff"}; height: 100%; `} > +
+

{props.photographer} @@ -83,7 +85,7 @@ export default function Video(props) { {moment(props.date).format("MMM D, YYYY h:mm a")} @@ -100,14 +103,14 @@ export default function Video(props) {
@@ -121,7 +124,7 @@ export default function Video(props) { font-weight: 700; font-size: 11px; - color: #000000; + color: ${props.darkmode ? "#ddd" : "#000"};; `} > By {utilities.renderAuthors(props.authors)} diff --git a/components/ArticleCard/locals.js b/components/ArticleCard/locals.js index 3d75b6c..982aace 100644 --- a/components/ArticleCard/locals.js +++ b/components/ArticleCard/locals.js @@ -6,7 +6,18 @@ export const headline = ` font-weight: bold; font-size: 1.5rem; line-height: 1.25; - color: #000000; + color: #000; + &:hover { + color: ${globals.DBblue}; + }`; + +export const darkheadline = ` + font-family: ${globals.headlineFont}; + font-style: normal; + font-weight: 550; + font-size: 1.5rem; + line-height: 1.25; + color: #ddd; &:hover { color: ${globals.DBblue}; }`; @@ -15,7 +26,22 @@ export const excerpt = ` font-family: ${globals.bodyFont}; font-weight: 300; font-size: 0.75rem; - color: #000000; + color: #000; + + p { + margin: 0; + } + + br { + display: none; + } + `; + +export const darkexcerpt = ` + font-family: ${globals.bodyFont}; + font-weight: 300; + font-size: 0.75rem; + color: #ddd; p { margin: 0; diff --git a/components/AuthorCard/index.jsx b/components/AuthorCard/index.jsx index 8765654..8a237a8 100644 --- a/components/AuthorCard/index.jsx +++ b/components/AuthorCard/index.jsx @@ -47,7 +47,8 @@ export default class AuthorCard extends React.Component { return (
@@ -117,6 +119,7 @@ export default class AuthorCard extends React.Component { + let c = (); + this.renderedClassifieds.push( +
+ {React.cloneElement(c, { + darkmode: this.props.darkmode + })} +
); } } @@ -75,12 +83,11 @@ export default class ClassifiedsCard extends React.Component {
{this.props.header} @@ -99,9 +107,11 @@ export default class ClassifiedsCard extends React.Component {
- {renderedClassifieds} + {this.renderedClassifieds}
COMMENTS diff --git a/components/EmailSignUp/index.jsx b/components/EmailSignUp/index.jsx index a4102d1..4bb9c34 100644 --- a/components/EmailSignUp/index.jsx +++ b/components/EmailSignUp/index.jsx @@ -45,7 +45,7 @@ export default class EmailPopUp extends React.Component { top: 29%; left: 0; right: 0; - background-color: #ffffff; + background-color: ${this.props.darkmode ? "#222" : "#fff"}; box-shadow: ${globals.cardShadow}; z-index: 3001; `} @@ -60,7 +60,7 @@ export default class EmailPopUp extends React.Component { border: none; font-family: ${globals.menuFont}; font-weight: 700; - color: #000; + color: ${this.props.darkmode ? "#ddd" : "#474747"}; font-size: 18px; z-index: 3002; cursor: pointer; @@ -123,7 +123,7 @@ export default class EmailPopUp extends React.Component { font-family: "PT Serif"; font-weight: bold; font-size: 30px; - color: #474747; + color: ${this.props.darkmode ? "#ddd" : "#474747"}; // text-align: left; text-align: center; z-index: 3001; @@ -162,7 +162,7 @@ export default class EmailPopUp extends React.Component { top: 40px; left: 20px; padding-left: 5px; - border: 2px solid #cccccc; + border: 2px solid #ccc; font-family: "PT Serif"; font-size: 15px; font-weight: bold; @@ -189,7 +189,7 @@ export default class EmailPopUp extends React.Component { font-family: "PT Serif"; font-weight: bolder; font-size: 16px; - color: #ffffff; + color: #fff; z-index: 3001; cursor: pointer; border-radius: 0; diff --git a/components/FeatureArticle/index.jsx b/components/FeatureArticle/index.jsx index f078678..384913f 100644 --- a/components/FeatureArticle/index.jsx +++ b/components/FeatureArticle/index.jsx @@ -11,7 +11,7 @@ import Tag from "./Tag"; import Landing from "./Landing"; import MiniArticleCard from "../ArticleCard/Mini"; - +// TODO export default class FeatureArticle extends React.Component { constructor(props) { super(props); @@ -29,6 +29,8 @@ export default class FeatureArticle extends React.Component { display: inline-block; padding: 6px 12px; white-space: initial; + /* background-color: ${this.props.darkmode? "#222" : "#fff"}; + color: ${this.props.darkmode? "#fff" : "#000"}; */ &:first-of-type { margin-left: 20px; @@ -39,6 +41,7 @@ export default class FeatureArticle extends React.Component { `} > @@ -219,6 +227,7 @@ export default class FeatureArticle extends React.Component { margin-left: 20px; margin-bottom: 5px; max-width: 400px; + `} > {renderedInfobox} @@ -245,12 +254,12 @@ export default class FeatureArticle extends React.Component { line-height: 21px; padding: 5px 0 0; - color: #000000; + color: ${this.props.darkmode ? "#ddd" : "#000"}; a { text-decoration: none; color: #0080c6; - background-color: #ffffff; + background-color: ${this.props.darkmode ? "#222" : "#fff"}; } a:hover { text-decoration: underline; @@ -283,7 +292,8 @@ export default class FeatureArticle extends React.Component { text-align: left; line-height: 1.75; - color: #000000; + background: ${this.props.darkmode ? "#222" : "#fff"}; + color: ${this.props.darkmode ? "#ddd" : "#000"}; display: block; max-width: 640px; margin: auto; @@ -299,7 +309,8 @@ export default class FeatureArticle extends React.Component { min-width: 150px; font-family: "Playfair Display", serif; font-size: 1.1rem; - color: #000; + background: ${this.props.darkmode ? "#222" : "#fff"}; + color: ${this.props.darkmode ? "#ddd" : "#000"}; } @media (max-width: 40em) { aside { @@ -345,6 +356,7 @@ export default class FeatureArticle extends React.Component { } iframe { + ${this.props.darkmode ? "filter: brightness(0.6);" : ""} width: 100%; } diff --git a/components/InTheNewsBanner/index.jsx b/components/InTheNewsBanner/index.jsx index e48d7c1..5b5cb84 100644 --- a/components/InTheNewsBanner/index.jsx +++ b/components/InTheNewsBanner/index.jsx @@ -21,7 +21,7 @@ export default class InTheNewsBanner extends React.Component { padding: 2px 5px; font-family: ${globals.bodyFont}; font-weight: 700; - color: #000; + color: ${this.props.darkmode ? "#ddd" : "#000"}; text-decoration: none; &:hover { color: ${globals.DBblue}; @@ -36,7 +36,8 @@ export default class InTheNewsBanner extends React.Component { return (
{propLink.category} @@ -128,7 +128,7 @@ class HeaderBar extends React.Component< box-shadow: ${MainSiteStyles.cardShadow}; font-family: ${MainSiteStyles.headlineFont}; font-weight: ${MainSiteStyles.boldFont}; - color: '#000'; + color: #f50505; `} >
{ display: block; } display: none; - background-color: #fff; + background-color: ${globals.darkMode ? "#000" : "#fff"}; `} > @@ -44,7 +44,7 @@ class MainSiteHeader extends React.Component { display: none; } display: block; - background-color: #fff; + background-color: ${globals.darkMode ? "#000" : "#fff"}; `} > diff --git a/components/Masthead/Desktop.jsx b/components/Masthead/Desktop.jsx index 415f91a..aee8019 100644 --- a/components/Masthead/Desktop.jsx +++ b/components/Masthead/Desktop.jsx @@ -10,17 +10,21 @@ import logo from "./dailybruin.svg"; import menuIcon from "./menu.svg"; import searchIcon from "./search.svg"; import minisearchIcon from "./minisearch.svg"; +import { BsMoonStarsFill, BsFillSunFill } from "react-icons/bs"; let expandedHeight = "106px"; let collapsedHeight = "60px"; + + export default class Desktop extends React.Component { constructor(props) { super(props); this.state = { menuExpanded: true, - searchExpanded: false + searchExpanded: false, }; + this.MastheadCard = React.createRef(); this.SearchBar = React.createRef(); this.Logo = React.createRef(); @@ -95,7 +99,7 @@ export default class Desktop extends React.Component { font-weight: bold; text-decoration: none; text-transform: uppercase; - color: #000; + color: ${this.props.darkmode ? "#ddd" : "#000"}; white-space: nowrap; &:hover { text-decoration: underline; @@ -115,7 +119,8 @@ export default class Desktop extends React.Component {

{today}

+ +
+ this.props.onToggle(e)} + /> + +
+
Advertise @@ -435,6 +509,8 @@ export default class Desktop extends React.Component { transition-delay: 100ms; width: 36px; height: 36px; + ${this. props.darkmode ? "filter: invert(1);" : ""}; + `} src={searchIcon} > @@ -459,7 +535,8 @@ export default class Desktop extends React.Component {
@@ -280,6 +283,7 @@ export default class Mobile extends React.Component { transition: all 200ms; transition-delay: 100ms; height: 100%; + ${this. props.darkmode ? "filter: invert(1);" : ""}; `} src={searchIcon} > @@ -293,7 +297,7 @@ export default class Mobile extends React.Component { css={css` position: absolute; margin: 0px; - background-color: #fff; + background-color: ${this.props.darkmode ? "#222" : "#fff"}; padding: 0 6px; height: 0; overflow-y: scroll; @@ -316,9 +320,12 @@ export default class Mobile extends React.Component { css={css` vertical-align: top; display: inline-block; + flex: 1; width: 40%; padding: 6px; text-align: center; + align-items: center; + justify-content: center; font-family: ${globals.menuFont}; font-size: 14px; font-weight: bold; @@ -328,6 +335,52 @@ export default class Mobile extends React.Component { a:hover { text-decoration: underline; } + #darkmode{ + display: 'flexbox'; + align-items: 'center'; + margin-top: 20px; + margin-right: 2.3vw; + + + } + #darkmode .checkbox { + opacity: 0; + position: relative; + width: 0; + } + #darkmode .label { + width: 48px; + height: 14px; + background-color: ${globals.DBblue}; + display: inline; + border-radius:50px; + padding: 8px 10px 5px 6px; + position: relative; + cursor: pointer; + } + #darkmode .moon { + margin-left: 0px; + } + #darkmode .sun { + margin-left: 10px; + } + #darkmode .ball { + width: 24px; + height: 24px; + background-color: white; + position: absolute; + top: 3.5px; + left: 3px; + border-radius: 50%; + transition: transform 0.2s linear; + } + #darkmode .checkbox:checked + .label .ball{ + transform: translateX(24px); + background-color: #111; + } + #darkmode .checkbox:checked + .label{ + background-color: #ddd; + } `} > Submit + {/* Darkmode toggle button */} +
+ this.props.onToggle(e)} + /> + +
diff --git a/components/MultimediaScroller/index.jsx b/components/MultimediaScroller/index.jsx index 1424dec..38ccfb5 100644 --- a/components/MultimediaScroller/index.jsx +++ b/components/MultimediaScroller/index.jsx @@ -29,7 +29,7 @@ export default class MultimediaScroller extends React.Component { border-top: 10px solid black; background: #474747; box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.25); - color: #ffffff; + color: #fff; box-sizing: border-box; `} > diff --git a/components/Page/index.jsx b/components/Page/index.jsx index c4b1f74..2d125db 100644 --- a/components/Page/index.jsx +++ b/components/Page/index.jsx @@ -8,16 +8,20 @@ import { date2string } from "./utilities.js"; export default class Page extends React.Component { constructor(props) { super(props); + + this.Page = React.createRef(); } render() { return (
@@ -27,10 +31,9 @@ export default class Page extends React.Component { font-style: normal; font-weight: normal; font-size: 14px; - - color: #000000; margin: auto; display: block; + a img, img { diff --git a/components/PhotoCard/index.jsx b/components/PhotoCard/index.jsx index 9b3c77a..b7823b2 100644 --- a/components/PhotoCard/index.jsx +++ b/components/PhotoCard/index.jsx @@ -35,7 +35,7 @@ export default function PhotoCard(props) { css={css` display: block; width: 100%; - border: 15px solid #ffffff; + border: 15px solid ${props.darkmode ? "#444" : "#fff"}; `} >
@@ -70,9 +70,10 @@ export default function PhotoCard(props) {

diff --git a/components/PhotoGallery/ContainerItem.jsx b/components/PhotoGallery/ContainerItem.jsx index a2d7d0f..885bc2f 100644 --- a/components/PhotoGallery/ContainerItem.jsx +++ b/components/PhotoGallery/ContainerItem.jsx @@ -21,10 +21,13 @@ function ContainerItem(props) { // } // This code below should work with the most up-to-date API (not yet avail on the web) and allow for article-text and center-photo + // className={`${css['row']} ${props.darkmode ? css[dark] : ""}`} + let classNameRow = `${css['row']} ${props.darkmode ? css['dark'] : ""}`; + let classNameNoRow = `${props.darkmode ? css['dark'] : ""}`; if (props.type == 'center-photo') { return ( -
+
gallery-image {/*
{props.description}
@@ -36,7 +39,7 @@ function ContainerItem(props) { } else if (props.type == 'article-text') { if (props.layout_type == 'alternating') { // only alternating layout needs to use rows return ( -
+

@@ -44,7 +47,7 @@ function ContainerItem(props) { ); } else { - return
+ return

@@ -58,7 +61,7 @@ function ContainerItem(props) { textAlign: 'right' }; return ( -
+
gallery-image @@ -68,7 +71,7 @@ function ContainerItem(props) { ); } else { return ( -
+
gallery-image

{props.credits}

@@ -80,14 +83,14 @@ function ContainerItem(props) { } else if (props.type == 'big-center-photo') { return ( -
+
big-center-photo

{props.credits}

) } else if (props.type == 'corrections-text') { return ( -
+

diff --git a/components/PhotoGallery/Header.jsx b/components/PhotoGallery/Header.jsx index 46b09bb..fa13bc3 100644 --- a/components/PhotoGallery/Header.jsx +++ b/components/PhotoGallery/Header.jsx @@ -34,7 +34,8 @@ export default function Header(props) {
@@ -105,12 +107,12 @@ export default function Header(props) { line-height: 21px; padding: 5px 0 0; - color: #000000; + color: ${props.darkmode? "#fff" : "#000"}; a { text-decoration: none; color: #0080c6; - background-color: #ffffff; + background-color: ${props.darkmode? "#222" : "#fff"}; } a:hover { text-decoration: underline; diff --git a/components/PhotoGallery/PGallery.jsx b/components/PhotoGallery/PGallery.jsx index a58c468..30241f9 100644 --- a/components/PhotoGallery/PGallery.jsx +++ b/components/PhotoGallery/PGallery.jsx @@ -238,6 +238,7 @@ function PGallery(props) { `} >
- +
{ entries.map((entry, index) => ( diff --git a/components/PhotoGallery/Photo.jsx b/components/PhotoGallery/Photo.jsx index 92e8f58..e321b8f 100644 --- a/components/PhotoGallery/Photo.jsx +++ b/components/PhotoGallery/Photo.jsx @@ -69,7 +69,8 @@ export default class Photo extends React.Component { max-width: 400px; padding: 20px; margin: 6px; - background-color: #fff; + background-color: ${this.props.darkmode? "#222" : "#fff"}; + color: ${this.props.darkmode? "#fff" : "#000"}; @media (max-width: 800px) { max-width: initial; min-width: initial; diff --git a/components/PhotoGallery/index.jsx b/components/PhotoGallery/index.jsx index cab23ff..1e5cbb3 100644 --- a/components/PhotoGallery/index.jsx +++ b/components/PhotoGallery/index.jsx @@ -18,6 +18,7 @@ export default class PhotoGallery extends React.Component { for (let i in this.props.photos) { renderedGallery.push(
{renderedGallery} - + {renderedAuthorCards} -
+
); } diff --git a/components/PhotoGrid/Photo.jsx b/components/PhotoGrid/Photo.jsx index 79c27b1..4a28e5c 100644 --- a/components/PhotoGrid/Photo.jsx +++ b/components/PhotoGrid/Photo.jsx @@ -41,7 +41,7 @@ export default class Photo extends React.Component { css={css` display: block; width: 100%; - border: 15px solid #ffffff; + border: 15px solid #fff; `} >
search: {this.props.query}
- -
+ {/*
*/} +
+ {/*
*/}
); } diff --git a/components/SectionHeader/index.jsx b/components/SectionHeader/index.jsx index 6a12bda..6616dba 100644 --- a/components/SectionHeader/index.jsx +++ b/components/SectionHeader/index.jsx @@ -23,6 +23,7 @@ export default class SectionHeader extends React.Component { max-height: 64px; margin: 0px; padding: 0px; + ${this. props.darkmode ? "filter: invert(100%);" : ""}; `} > ); @@ -47,7 +48,7 @@ export default class SectionHeader extends React.Component { font-weight: bold; font-size: 12px; padding: 1px 5px; - color: black; + color: ${this.props.darkmode ? "#ddd" : "#000"}; text-decoration: none; &:hover { text-decoration: underline; @@ -62,7 +63,7 @@ export default class SectionHeader extends React.Component {
- diff --git a/components/ShareButtons/index.jsx b/components/ShareButtons/index.jsx index 290d6ab..4c038f0 100644 --- a/components/ShareButtons/index.jsx +++ b/components/ShareButtons/index.jsx @@ -53,6 +53,7 @@ export default function ShareButtons(props) { @media (max-width: 450px) { display: block; } + color: ${props.darkmode ? '#fff' : '#000'}; `} > Share this story: diff --git a/components/ShareButtons/reddit.svg b/components/ShareButtons/reddit.svg index b4f4c6d..d259e98 100644 --- a/components/ShareButtons/reddit.svg +++ b/components/ShareButtons/reddit.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/components/ShareButtons/twitter.svg b/components/ShareButtons/twitter.svg index 57e01fe..8601cea 100644 --- a/components/ShareButtons/twitter.svg +++ b/components/ShareButtons/twitter.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/components/SponsoredArticle/index.jsx b/components/SponsoredArticle/index.jsx index 33223c3..268bdfa 100644 --- a/components/SponsoredArticle/index.jsx +++ b/components/SponsoredArticle/index.jsx @@ -10,7 +10,7 @@ import AuthorCard from "../AuthorCard"; import Tag from "./Tag"; import Landing from "./Landing"; import Logo from "./dailybruin.svg"; - +// TODO export default class FeatureArticle extends React.Component { constructor(props) { super(props); @@ -26,6 +26,7 @@ export default class FeatureArticle extends React.Component { `} > @@ -169,12 +170,12 @@ export default class FeatureArticle extends React.Component { line-height: 21px; padding: 5px 0 0; - color: #000000; + color: #000; a { text-decoration: none; color: #0080c6; - background-color: #ffffff; + background-color: ${this.props.darkmode ? "#222" : "#fff"}; } a:hover { text-decoration: underline; @@ -206,7 +207,7 @@ export default class FeatureArticle extends React.Component { text-align: left; line-height: 1.75; - color: #000000; + color: #000; display: block; max-width: 640px; margin: auto; @@ -268,6 +269,7 @@ export default class FeatureArticle extends React.Component { } iframe { + ${this.props.darkmode ? "filter: brightness(0.6);" : ""} width: 100%; } diff --git a/components/SponsoredLinks/index.jsx b/components/SponsoredLinks/index.jsx index 2723e9d..2d0108c 100644 --- a/components/SponsoredLinks/index.jsx +++ b/components/SponsoredLinks/index.jsx @@ -12,7 +12,8 @@ export default class SponsoredLinks extends React.Component { return (
{this.props.team1} diff --git a/components/SportsTournamentScoreboard/Scoreboard.jsx b/components/SportsTournamentScoreboard/Scoreboard.jsx index 2eb1c0c..b37954f 100644 --- a/components/SportsTournamentScoreboard/Scoreboard.jsx +++ b/components/SportsTournamentScoreboard/Scoreboard.jsx @@ -17,7 +17,7 @@ export default class Scoreboard extends React.Component { border-collapse: collapse; border-style: hidden; border: none !important; - color: #000000; + color: #000; `} > @@ -46,7 +46,7 @@ export default class Scoreboard extends React.Component { diff --git a/components/SportsTournamentScoreboard/index.jsx b/components/SportsTournamentScoreboard/index.jsx index d3aeaaa..d0b083d 100644 --- a/components/SportsTournamentScoreboard/index.jsx +++ b/components/SportsTournamentScoreboard/index.jsx @@ -20,7 +20,7 @@ export default class SportsTournamentScoreboard extends React.Component {

( Tweets by dailybruin diff --git a/components/VideoCard/index.jsx b/components/VideoCard/index.jsx index 791d89b..beee931 100644 --- a/components/VideoCard/index.jsx +++ b/components/VideoCard/index.jsx @@ -14,7 +14,7 @@ export default function VideoCard(props) { display: block; padding: 10px; box-shadow: ${globals.cardShadow}; - background-color: #ffffff; + background-color: #fff; `} > @@ -63,19 +63,20 @@ export default function VideoCard(props) {
By {utilities.renderAuthors(props.authors)} diff --git a/components/WelcomePopUp/index.jsx b/components/WelcomePopUp/index.jsx index b738bf6..0c7027e 100644 --- a/components/WelcomePopUp/index.jsx +++ b/components/WelcomePopUp/index.jsx @@ -43,7 +43,7 @@ export default class WelcomePopUp extends React.Component { top: 29%; left: 0; right: 0; - background-color: #ffffff; + background-color: ${this.props.darkmode ? "#222" : "#fff"}; box-shadow: ${globals.cardShadow}; z-index: 3001; `} @@ -58,7 +58,7 @@ export default class WelcomePopUp extends React.Component { border: none; font-family: Source Sans Pro; font-weight: bold; - color: #000; + color: ${this.props.darkmode ? "#ddd" : "#474747"}; font-size: 18px; z-index: 3002; cursor: pointer; @@ -113,7 +113,7 @@ export default class WelcomePopUp extends React.Component { font-size: 16px; font-family: "PT Serif"; font-weight: bold; - color: #474747; + color: ${this.props.darkmode ? "#ddd" : "#474747"}; z-index: 3001; text-align: left; margin: 20px; diff --git a/components/globals.js b/components/globals.js index dc05a19..4127a2c 100644 --- a/components/globals.js +++ b/components/globals.js @@ -1,6 +1,8 @@ import { css } from "@emotion/core"; +import * as React from "react"; /** Reusable common CSS attributes */ + /** Colors */ export const gray = "rgb(197, 197, 197)"; export const lightGray = "rgb(242, 242, 242)"; diff --git a/layouts/Article/index.jsx b/layouts/Article/index.jsx index c8342a0..60e4cc9 100644 --- a/layouts/Article/index.jsx +++ b/layouts/Article/index.jsx @@ -14,8 +14,10 @@ import CommentsCard from "components/CommentsCard"; class ArticleLayout extends React.Component { constructor(props) { super(props); + this.article = (
); + + this.classifiedsCards = ( + + ) } render() { @@ -47,7 +56,7 @@ class ArticleLayout extends React.Component { for (let relatedPost of this.props.relatedPosts) { renderedRelatedPosts.push(
- {buildArticleCard(relatedPost, "mini")} + {buildArticleCard(relatedPost, "mini", this.props.darkmode)}
); } @@ -60,7 +69,8 @@ class ArticleLayout extends React.Component { desktop: "(min-width: 901px)" }} defaultMatches={{ desktop: true }} - > + > + {matches => (
{matches.phone && ( @@ -72,12 +82,16 @@ class ArticleLayout extends React.Component { width: "100%" }} > -
{this.article}
+
+ {React.cloneElement(this.article, { + darkmode: this.props.darkmode + })} +
Related Posts @@ -105,10 +119,9 @@ class ArticleLayout extends React.Component {
- + {React.cloneElement(this.classifiedsCards, { + darkmode: this.props.darkmode + })}
@@ -122,7 +135,9 @@ class ArticleLayout extends React.Component { width: "100%" }} > -
{this.article}
+
{React.cloneElement(this.article, { + darkmode: this.props.darkmode + })}
Related Posts @@ -166,10 +181,9 @@ class ArticleLayout extends React.Component { }} >
- + {React.cloneElement(this.classifiedsCards, { + darkmode: this.props.darkmode + })}
-
{this.article}
+
+ {React.cloneElement(this.article, { + darkmode: this.props.darkmode + })} +
- + {React.cloneElement(this.classifiedsCards, { + darkmode: this.props.darkmode + })}
Related Posts diff --git a/layouts/Author/index.jsx b/layouts/Author/index.jsx index 6d8c5b8..5d0c802 100644 --- a/layouts/Author/index.jsx +++ b/layouts/Author/index.jsx @@ -19,6 +19,14 @@ export default class Author extends React.Component { more: true }; this.getPosts = this.getPosts.bind(this); + + this.classifiedsCards = ( + + ); + } getPosts(page) { @@ -81,6 +89,7 @@ export default class Author extends React.Component { >
{utilities.renderPostArray( this.state.otherArticleCards, - "full" + "full", + this.props.darkmode )} {!this.state.more ? ( @@ -140,6 +150,7 @@ export default class Author extends React.Component { >
{utilities.renderPostArray( this.state.otherArticleCards, - "horz" + "horz", + this.props.darkmode )} {!this.state.more ? ( @@ -209,10 +221,9 @@ export default class Author extends React.Component {
- + {React.cloneElement(this.classifiedsCards, { + darkmode: this.props.darkmode + })}
@@ -239,6 +250,7 @@ export default class Author extends React.Component {
*/}
{utilities.renderPostArray( this.state.otherArticleCards, - "long" + "long", + this.props.darkmode )} {!this.state.more ? ( @@ -292,10 +305,9 @@ export default class Author extends React.Component {
- + {React.cloneElement(this.classifiedsCards, { + darkmode: this.props.darkmode + })}
diff --git a/layouts/Category/index.jsx b/layouts/Category/index.jsx index 074b85e..24dabcd 100644 --- a/layouts/Category/index.jsx +++ b/layouts/Category/index.jsx @@ -13,14 +13,21 @@ export default class CategoryLayout extends React.Component { constructor(props) { super(props); this.state = { - aArticleCard: utilities.buildArticleCard(this.props.posts[0]), - bArticleCard: utilities.buildArticleCard(this.props.posts[1]), - cArticleCard: utilities.buildArticleCard(this.props.posts[2]), - otherArticleCards: utilities.buildArticleList(this.props.posts.slice(3)), + aArticleCard: utilities.buildArticleCard(this.props.posts[0], "", this.props.darkmode), + bArticleCard: utilities.buildArticleCard(this.props.posts[1], "", this.props.darkmode), + cArticleCard: utilities.buildArticleCard(this.props.posts[2], "", this.props.darkmode), + otherArticleCards: utilities.buildArticleList(this.props.posts.slice(3), "", this.props.darkmode), more: true }; this.getPosts = this.getPosts.bind(this); + + this.classifiedsCards = ( + + ) } getPosts(page) { @@ -83,17 +90,17 @@ export default class CategoryLayout extends React.Component { >
{React.cloneElement(this.state.aArticleCard, { - displayType: "full" + darkmode: this.props.darkmode, displayType: "full" })}
{React.cloneElement(this.state.bArticleCard, { - displayType: "full" + darkmode: this.props.darkmode, displayType: "full" })}
{React.cloneElement(this.state.cArticleCard, { - displayType: "full" + darkmode: this.props.darkmode, displayType: "full" })}
{utilities.renderPostArray( this.state.otherArticleCards, - "full" + "full", + this.props.darkmode )} {!this.state.more ? ( @@ -137,7 +145,7 @@ export default class CategoryLayout extends React.Component { >
{React.cloneElement(this.state.aArticleCard, { - displayType: "full" + darkmode: this.props.darkmode, displayType: "full" })}
@@ -152,7 +160,8 @@ export default class CategoryLayout extends React.Component { > {utilities.renderPostArray( this.state.otherArticleCards, - "horz" + "horz", + this.props.darkmode )} {!this.state.more ? ( @@ -179,19 +188,18 @@ export default class CategoryLayout extends React.Component { >
{React.cloneElement(this.state.bArticleCard, { - displayType: "vert" + darkmode: this.props.darkmode, displayType: "vert" })}
{React.cloneElement(this.state.cArticleCard, { - displayType: "mini" + darkmode: this.props.darkmode, displayType: "mini" })}
- + {React.cloneElement(this.classifiedsCards, { + darkmode: this.props.darkmode + })}
@@ -212,7 +220,7 @@ export default class CategoryLayout extends React.Component { >
{React.cloneElement(this.state.aArticleCard, { - displayType: "full" + darkmode: this.props.darkmode, displayType: "full" })}
@@ -226,12 +234,12 @@ export default class CategoryLayout extends React.Component { >
{React.cloneElement(this.state.bArticleCard, { - displayType: "vert" + darkmode: this.props.darkmode, displayType: "vert" })}
{React.cloneElement(this.state.cArticleCard, { - displayType: "mini" + darkmode: this.props.darkmode, displayType: "mini" })}
@@ -248,7 +256,8 @@ export default class CategoryLayout extends React.Component { > {utilities.renderPostArray( this.state.otherArticleCards, - "long" + "long", + this.props.darkmode )} {!this.state.more ? ( @@ -276,10 +285,9 @@ export default class CategoryLayout extends React.Component {
- + {React.cloneElement(this.classifiedsCards, { + darkmode: this.props.darkmode + })}
diff --git a/layouts/Feature/index.jsx b/layouts/Feature/index.jsx index 131f2d0..8d67cfb 100644 --- a/layouts/Feature/index.jsx +++ b/layouts/Feature/index.jsx @@ -9,39 +9,45 @@ import FeatureArticle from "../../components/FeatureArticle"; class FeatureLayout extends React.Component { constructor(props) { super(props); + this.featurearticle = ( + article.slug != this.props.article.slug + )} + relatedPosts={this.props.relatedPosts} + /> + ) } render() { return ( <> - article.slug != this.props.article.slug - )} - relatedPosts={this.props.relatedPosts} - /> + {React.cloneElement(this.featurearticle, { + darkmode: this.props.darkmode + })} ); } diff --git a/layouts/Home/index.jsx b/layouts/Home/index.jsx index 9adbca9..5a5a51e 100644 --- a/layouts/Home/index.jsx +++ b/layouts/Home/index.jsx @@ -11,6 +11,7 @@ import Poll from "../../components/Poll"; import StoryList from "../../components/StoryList"; import SponsoredLinks from "../../components/SponsoredLinks"; import TwitterFeed from "../../components/TwitterFeed"; +import * as globals from "../../components/globals"; const ArticleAdStyle = { width: "100%", @@ -25,47 +26,62 @@ export default class HomeLayout extends React.Component { constructor(props) { super(props); this.cards = { - aArticleCard: utilities.buildArticleCard(this.props.posts.aStory[0]), - bArticleCard: utilities.buildArticleCard(this.props.posts.bStory[0]), - c1ArticleCard: utilities.buildArticleCard(this.props.posts.c1Story[0]), - c2ArticleCard: utilities.buildArticleCard(this.props.posts.c2Story[0]), - dArticleCard: utilities.buildArticleCard(this.props.posts.dStory[0]), - eArticleCard: utilities.buildArticleCard(this.props.posts.eStory[0]), - f1ArticleCard: utilities.buildArticleCard(this.props.posts.f1Story[0]), - f2ArticleCard: utilities.buildArticleCard(this.props.posts.f2Story[0]), + aArticleCard: utilities.buildArticleCard(this.props.posts.aStory[0],"",this.props.darkmode), + bArticleCard: utilities.buildArticleCard(this.props.posts.bStory[0],"",this.props.darkmode), + c1ArticleCard: utilities.buildArticleCard(this.props.posts.c1Story[0],"",this.props.darkmode), + c2ArticleCard: utilities.buildArticleCard(this.props.posts.c2Story[0],"",this.props.darkmode), + dArticleCard: utilities.buildArticleCard(this.props.posts.dStory[0],"",this.props.darkmode), + eArticleCard: utilities.buildArticleCard(this.props.posts.eStory[0],"",this.props.darkmode), + f1ArticleCard: utilities.buildArticleCard(this.props.posts.f1Story[0],"",this.props.darkmode), + f2ArticleCard: utilities.buildArticleCard(this.props.posts.f2Story[0],"",this.props.darkmode), m1MultimediaScroller: utilities.buildMultimediaScroller(this.props.media), qdStoryList: utilities.buildStoryList( "THE QUAD", this.props.posts.quadList, - "/category/quad" + "/category/quad", + this.props.darkmode ), nsStoryList: utilities.buildStoryList( "NEWS", this.props.posts.newsList, - "/category/news" + "/category/news", + this.props.darkmode ), enStoryList: utilities.buildStoryList( "ENTERPRISE", this.props.posts.enterpriseList, - "/category/enterprise" + "/category/enterprise", + this.props.darkmode ), opStoryList: utilities.buildStoryList( "OPINION", this.props.posts.opinionList, - "/category/opinion" + "/category/opinion", + this.props.darkmode ), aeStoryList: utilities.buildStoryList( "A&E", this.props.posts.artsList, - "/category/arts-entertainment" + "/category/arts-entertainment", + this.props.darkmode ), spStoryList: utilities.buildStoryList( "SPORTS", this.props.posts.sportsList, - "/category/sports" - ) + "/category/sports", + this.props.darkmode + ), + classifieds: (), + sponsored: () }; } @@ -91,27 +107,27 @@ export default class HomeLayout extends React.Component { >
{React.cloneElement(this.cards.c1ArticleCard, { - displayType: "full" + darkmode: this.props.darkmode, displayType: "full" })}
{React.cloneElement(this.cards.c2ArticleCard, { - displayType: "full" + darkmode: this.props.darkmode, displayType: "full" })}
{React.cloneElement(this.cards.aArticleCard, { - displayType: "full" + darkmode: this.props.darkmode, displayType: "full" })}
{React.cloneElement(this.cards.bArticleCard, { - displayType: "full" + darkmode: this.props.darkmode, displayType: "full" })}
{this.props.mappedBreaking != null && (
- +
)}
- {this.cards.qdStoryList} + {React.cloneElement(this.cards.qdStoryList, { + darkmode: this.props.darkmode + })}
{React.cloneElement(this.cards.dArticleCard, { - displayType: "mini" + darkmode: this.props.darkmode, displayType: "mini" })}
{React.cloneElement(this.cards.eArticleCard, { - displayType: "mini" + darkmode: this.props.darkmode, displayType: "mini" })}
@@ -139,23 +157,22 @@ export default class HomeLayout extends React.Component {
{this.props.mappedBreaking == null && (
- +
)}
- + {React.cloneElement(this.cards.classifieds, { + darkmode: this.props.darkmode + })}
{React.cloneElement(this.cards.f1ArticleCard, { - displayType: "mini" + darkmode: this.props.darkmode, displayType: "mini" })}
{React.cloneElement(this.cards.f2ArticleCard, { - displayType: "mini" + darkmode: this.props.darkmode, displayType: "mini" })}
- {this.cards.nsStoryList} + {React.cloneElement(this.cards.nsStoryList, { + darkmode: this.props.darkmode, displayType: "mini" + })}
- {this.cards.enStoryList} + {React.cloneElement(this.cards.enStoryList, { + darkmode: this.props.darkmode, displayType: "mini" + })}
- {this.cards.opStoryList} + {React.cloneElement(this.cards.opStoryList, { + darkmode: this.props.darkmode, displayType: "mini" + })}
- {this.cards.aeStoryList} + {React.cloneElement(this.cards.aeStoryList, { + darkmode: this.props.darkmode, displayType: "mini" + })}
- {this.cards.spStoryList} + {React.cloneElement(this.cards.spStoryList, { + darkmode: this.props.darkmode, displayType: "mini" + })}
@@ -194,7 +221,7 @@ export default class HomeLayout extends React.Component { >
{React.cloneElement(this.cards.aArticleCard, { - displayType: "vert" + darkmode: this.props.darkmode, displayType: "vert" })}
{React.cloneElement(this.cards.bArticleCard, { - displayType: "vert" + darkmode: this.props.darkmode, displayType: "vert" })}
- {this.cards.qdStoryList} + {React.cloneElement(this.cards.qdStoryList, { + darkmode: this.props.darkmode + })}
- + {React.cloneElement(this.cards.classifieds, { + darkmode: this.props.darkmode + })}
{React.cloneElement(this.cards.f1ArticleCard, { - displayType: "mini" + darkmode: this.props.darkmode, displayType: "mini" })}
{this.props.mappedBreaking != null && (
- +
)}
{React.cloneElement(this.cards.f2ArticleCard, { - displayType: "mini" + darkmode: this.props.darkmode, displayType: "mini" })}
{this.props.mappedBreaking == null && (
- +
)}
@@ -255,12 +283,12 @@ export default class HomeLayout extends React.Component { >
{React.cloneElement(this.cards.c1ArticleCard, { - displayType: "full" + darkmode: this.props.darkmode, displayType: "full" })}
{React.cloneElement(this.cards.c2ArticleCard, { - displayType: "horz" + darkmode: this.props.darkmode, displayType: "horz" })}
{React.cloneElement(this.cards.dArticleCard, { - displayType: "mini" + darkmode: this.props.darkmode, displayType: "mini" })}
@@ -286,7 +314,7 @@ export default class HomeLayout extends React.Component { >
{React.cloneElement(this.cards.eArticleCard, { - displayType: "mini" + darkmode: this.props.darkmode, displayType: "mini" })}
@@ -295,21 +323,31 @@ export default class HomeLayout extends React.Component {
- {this.cards.nsStoryList} + {React.cloneElement(this.cards.nsStoryList, { + darkmode: this.props.darkmode, displayType: "mini" + })}
- {this.cards.enStoryList} + {React.cloneElement(this.cards.enStoryList, { + darkmode: this.props.darkmode, displayType: "mini" + })}
- {this.cards.aeStoryList} + {React.cloneElement(this.cards.aeStoryList, { + darkmode: this.props.darkmode, displayType: "mini" + })}
- {this.cards.opStoryList} + {React.cloneElement(this.cards.opStoryList, { + darkmode: this.props.darkmode, displayType: "mini" + })}
- {this.cards.spStoryList} + {React.cloneElement(this.cards.spStoryList, { + darkmode: this.props.darkmode, displayType: "mini" + })}
@@ -322,7 +360,9 @@ export default class HomeLayout extends React.Component {
- + {React.cloneElement(this.cards.sponsored, { + darkmode: this.props.darkmode + })}
@@ -341,28 +381,31 @@ export default class HomeLayout extends React.Component { >
{React.cloneElement(this.cards.aArticleCard, { - displayType: "vert" + darkmode: this.props.darkmode, displayType: "vert" })}
{React.cloneElement(this.cards.bArticleCard, { - displayType: "vert" + darkmode: this.props.darkmode, displayType: "vert" })}
- + {React.cloneElement(this.cards.classifieds, { + darkmode: this.props.darkmode + })}
- {this.cards.nsStoryList} + {React.cloneElement(this.cards.nsStoryList, { + darkmode: this.props.darkmode + })}
- {this.cards.enStoryList} + {React.cloneElement(this.cards.enStoryList, { + darkmode: this.props.darkmode + })}
{React.cloneElement(this.cards.c1ArticleCard, { - displayType: "full" + darkmode: this.props.darkmode, displayType: "full" })}
{React.cloneElement(this.cards.c2ArticleCard, { - displayType: "horz" + darkmode: this.props.darkmode, displayType: "horz" })}
@@ -387,22 +430,26 @@ export default class HomeLayout extends React.Component {
{React.cloneElement(this.cards.f1ArticleCard, { - displayType: "horz" + darkmode: this.props.darkmode, displayType: "horz" })}
{React.cloneElement(this.cards.f2ArticleCard, { - displayType: "horz" + darkmode: this.props.darkmode, displayType: "horz" })}
- {this.cards.opStoryList} + {React.cloneElement(this.cards.opStoryList, { + darkmode: this.props.darkmode, displayType: "mini" + })}
- {this.cards.aeStoryList} + {React.cloneElement(this.cards.aeStoryList, { + darkmode: this.props.darkmode, displayType: "mini" + })}
@@ -413,7 +460,7 @@ export default class HomeLayout extends React.Component { > {this.props.mappedBreaking != null && (
- +
)}
- {this.cards.qdStoryList} + {React.cloneElement(this.cards.qdStoryList, { + darkmode: this.props.darkmode + })}
{React.cloneElement(this.cards.dArticleCard, { - displayType: "mini" + darkmode: this.props.darkmode, displayType: "mini" })}
{React.cloneElement(this.cards.eArticleCard, { - displayType: "mini" + darkmode: this.props.darkmode, displayType: "mini" })}
{this.props.mappedBreaking == null && (
- +
)}
- {this.cards.spStoryList} + {React.cloneElement(this.cards.spStoryList, { + darkmode: this.props.darkmode + })}
*/}
- + {React.cloneElement(this.cards.sponsored, { + darkmode: this.props.darkmode + })}
diff --git a/layouts/Multimedia/index.jsx b/layouts/Multimedia/index.jsx index aef571d..2d513c8 100644 --- a/layouts/Multimedia/index.jsx +++ b/layouts/Multimedia/index.jsx @@ -56,7 +56,7 @@ export default class MultimediaLayout extends React.Component { } render() { - let rendered = utilities.buildPhotoList(this.state.cards); + let rendered = utilities.buildPhotoList(this.state.cards, this.props.darkmode); return ( <> - ) - }; + this.page = ( + ); } render() { - return
{this.state.page}
; + return (
+ {React.cloneElement(this.page, {darkmode: this.props.darkmode})} +
); } } diff --git a/layouts/PageWrapper.jsx b/layouts/PageWrapper.jsx index b01d3ff..065eef3 100644 --- a/layouts/PageWrapper.jsx +++ b/layouts/PageWrapper.jsx @@ -1,4 +1,4 @@ -import React, { Component } from "react"; +import React, { Component, useState } from "react"; import { Config } from "../config.js"; import Head from "next/head"; @@ -9,13 +9,7 @@ import Masthead from "components/Masthead"; import CommentFAB from "components/CommentFAB"; import css from "./style.module.css"; - -const wrapperStyle = { - padding: "6px", - backgroundColor: "#f1f1f1", - width: "100%", - height: "100%" -}; +import * as globals from "../components/globals"; const layoutStyle = { maxWidth: 1248, @@ -24,6 +18,12 @@ const layoutStyle = { const PageWrapper = Comp => class extends Component { + constructor(props) { + super(props); + this.state = {} + } + + static async getInitialProps(ctx) { // Load the categories for the header // TODO: can we load this once each browser session? @@ -77,7 +77,28 @@ const PageWrapper = Comp => }; } + onToggle = (e) => { + localStorage.setItem('darkmode', JSON.stringify(e.target.checked)); + this.setState({ + darkmode: JSON.parse(localStorage.getItem('darkmode')) + }) + + } + + componentDidMount() { + this.setState({ + darkmode: JSON.parse(localStorage.getItem('darkmode')) + }) + } + render() { + const style = { + padding: "6px", + backgroundColor: this.state.darkmode ? "#010101" : "#f1f1f1", + width: "100%", + height: "100%" + } + if (this.props.feature == true) { return ; } @@ -85,7 +106,7 @@ const PageWrapper = Comp => if (this.props.mappedBreaking != null) { renderedBreakingCard = (
- +
); } @@ -93,23 +114,23 @@ const PageWrapper = Comp => if (this.props.mappedITN != null && this.props.mappedBreaking == null) { renderedInTheNews = (
- +
); } return ( -
+
- + {renderedBreakingCard} {renderedInTheNews} - -
- + +
+
diff --git a/layouts/PhotoGallery/PGalleryLayout.jsx b/layouts/PhotoGallery/PGalleryLayout.jsx index 7ac6a6a..83ff8a6 100644 --- a/layouts/PhotoGallery/PGalleryLayout.jsx +++ b/layouts/PhotoGallery/PGalleryLayout.jsx @@ -14,6 +14,7 @@ export default class PGalleryLayout extends React.Component { super(props); this.pgallery = (
- {this.pgallery} + {React.cloneElement(this.pgallery, { + darkmode: this.props.darkmode + })}
+ ) } render() { return ( <>
- + {React.cloneElement(this.photogallery, { + darkmode: this.props.darkmode + })}
+ ) } getPosts(page) { @@ -30,7 +37,7 @@ export default class PodcastsLayout extends React.Component { if (json.data == undefined) { this.setState({ otherArticleCards: this.state.otherArticleCards.concat( - utilities.buildArticleList(json) + utilities.buildArticleList(json, this.props.darkmode) ) }); } else { @@ -89,7 +96,8 @@ export default class PodcastsLayout extends React.Component { > {utilities.renderPodcastArray( this.state.otherArticleCards, - "podcast" + "podcast", + this.props.darkmode )} {!this.state.more ? ( @@ -136,7 +144,8 @@ export default class PodcastsLayout extends React.Component { > {utilities.renderPodcastArray( this.state.otherArticleCards, - "podcast" + "podcast", + this.props.darkmode )}
@@ -163,10 +172,9 @@ export default class PodcastsLayout extends React.Component { }} >
- + {React.cloneElement(this.classifiedsCards, { + darkmode: this.props.darkmode + })}
@@ -197,7 +205,8 @@ export default class PodcastsLayout extends React.Component { > {utilities.renderPodcastArray( this.state.otherArticleCards, - "podcast" + "podcast", + this.props.darkmode )}
@@ -226,10 +235,9 @@ export default class PodcastsLayout extends React.Component {
- + {React.cloneElement(this.classifiedsCards, { + darkmode: this.props.darkmode + })}

diff --git a/layouts/Sponsored/index.jsx b/layouts/Sponsored/index.jsx index b7543cb..4d33fea 100644 --- a/layouts/Sponsored/index.jsx +++ b/layouts/Sponsored/index.jsx @@ -5,7 +5,7 @@ import Media from "react-media"; import moment from "moment"; import SponsoredArticle from "components/SponsoredArticle"; - +// TODO class SponsoredLayout extends React.Component { constructor(props) { super(props); @@ -15,6 +15,7 @@ class SponsoredLayout extends React.Component { return ( <> + ) } getPosts(page) { @@ -88,7 +95,8 @@ export default class TagLayout extends React.Component { > {utilities.renderPostArray( this.state.otherArticleCards, - "full" + "full", + this.props.darkmode )} {!this.state.more ? ( @@ -122,7 +130,8 @@ export default class TagLayout extends React.Component { > {utilities.renderPostArray( this.state.otherArticleCards, - "horz" + "horz", + this.props.darkmode )} {!this.state.more ? ( @@ -151,10 +160,9 @@ export default class TagLayout extends React.Component {
- + {React.cloneElement(this.classifiedsCards, { + darkmode: this.props.darkmode + })}
@@ -178,7 +186,8 @@ export default class TagLayout extends React.Component { > {utilities.renderPostArray( this.state.otherArticleCards, - "long" + "long", + this.props.darkmode )} {!this.state.more ? ( @@ -206,10 +215,9 @@ export default class TagLayout extends React.Component {

- + {React.cloneElement(this.classifiedsCards, { + darkmode: this.props.darkmode + })}
diff --git a/layouts/USACOfficerEvaluations1920/index.jsx b/layouts/USACOfficerEvaluations1920/index.jsx index 811b24c..7b37d20 100644 --- a/layouts/USACOfficerEvaluations1920/index.jsx +++ b/layouts/USACOfficerEvaluations1920/index.jsx @@ -4,6 +4,7 @@ import { css, jsx } from "@emotion/core"; import * as globals from "../../components/globals"; import style from "../style.module.css"; +// TODO export default class ColumnsFromQuarantineLayout extends React.Component { constructor(props) { super(props); diff --git a/layouts/USACOfficerEvaluations2021Layout/index.jsx b/layouts/USACOfficerEvaluations2021Layout/index.jsx index d961aac..643e502 100644 --- a/layouts/USACOfficerEvaluations2021Layout/index.jsx +++ b/layouts/USACOfficerEvaluations2021Layout/index.jsx @@ -3,7 +3,7 @@ import React from "react"; import { css, jsx } from "@emotion/core"; import * as globals from "../../components/globals"; import style from "../style.module.css"; - +// TODO export default class ColumnsFromQuarantineLayout extends React.Component { constructor(props) { super(props); diff --git a/layouts/Video/index.jsx b/layouts/Video/index.jsx index 3b90098..f617586 100644 --- a/layouts/Video/index.jsx +++ b/layouts/Video/index.jsx @@ -19,6 +19,13 @@ export default class VideoLayout extends React.Component { more: true }; this.getPosts = this.getPosts.bind(this); + + this.classifiedsCards = ( + + ) } getPosts(page) { @@ -31,7 +38,7 @@ export default class VideoLayout extends React.Component { if (json.data == undefined) { this.setState({ otherArticleCards: this.state.otherArticleCards.concat( - utilities.buildArticleList(json) + utilities.buildArticleList(json, this.props.darkmode) ) }); } else { @@ -81,7 +88,7 @@ export default class VideoLayout extends React.Component { >
{React.cloneElement(this.state.aArticleCard, { - displayType: "video" + displayType: "video", darkmode: this.props.darkmode })}
{utilities.renderVideoArray( this.state.otherArticleCards, - "video" + "video", + this.props.darkmode )} {!this.state.more ? ( @@ -125,7 +133,7 @@ export default class VideoLayout extends React.Component { >
{React.cloneElement(this.state.aArticleCard, { - displayType: "full" + displayType: "full", darkmode: this.props.darkmode })}
@@ -147,7 +155,8 @@ export default class VideoLayout extends React.Component { > {utilities.renderVideoArray( this.state.otherArticleCards, - "video" + "video", + this.props.darkmode )}
@@ -174,10 +183,9 @@ export default class VideoLayout extends React.Component { }} >
- + {React.cloneElement(this.classifiedsCards, { + darkmode: this.props.darkmode + })}
@@ -198,7 +206,7 @@ export default class VideoLayout extends React.Component { >
{React.cloneElement(this.state.aArticleCard, { - displayType: "full" + displayType: "full", darkmode: this.props.darkmode })}
@@ -221,7 +229,8 @@ export default class VideoLayout extends React.Component { > {utilities.renderVideoArray( this.state.otherArticleCards, - "video" + "video", + this.props.darkmode )}
@@ -250,10 +259,9 @@ export default class VideoLayout extends React.Component {
- + {React.cloneElement(this.classifiedsCards, { + darkmode: this.props.darkmode + })}
diff --git a/layouts/style.module.css b/layouts/style.module.css index 1228a5e..cd1046b 100644 --- a/layouts/style.module.css +++ b/layouts/style.module.css @@ -1,8 +1,19 @@ +.dark { + background-color: #222 !important; + color: #fff; +} + .card { display: block; padding: 6px; } +.card_dark { + display: block; + padding: 6px; + background-color: #222; +} + .video-card { display: inline-block; padding: 6px; diff --git a/layouts/utilities.jsx b/layouts/utilities.jsx index 4a0096d..51f86f7 100644 --- a/layouts/utilities.jsx +++ b/layouts/utilities.jsx @@ -4,10 +4,12 @@ import MultimediaScroller from "../components/MultimediaScroller"; import css from "./style.module.css"; import moment from "moment"; -export function buildArticleCard(story, type = "") { +export function buildArticleCard(story, type = "", darkmode = false) { if (story != null && story != undefined && story.data == undefined) { return ( + { return { title: index.title.rendered, @@ -58,6 +60,7 @@ export function buildStoryList(type, list, link) { mappedList[2].text = ""; return ( ; } -export function buildArticleList(stories) { +export function buildArticleList(stories, darkmode = false) { let postArray = []; for (let i = 0; i < stories.length; i++) { - postArray.push(buildArticleCard(stories[i])); + postArray.push(buildArticleCard(stories[i], "", darkmode)); } return postArray; } -export function renderPostArray(otherArticleCards, type) { +export function renderPostArray(otherArticleCards, type, darkmode = false) { let renderedPostArray = []; for (let i = 0; i < otherArticleCards.length; i++) { renderedPostArray.push(
{React.cloneElement(otherArticleCards[i], { - displayType: type + displayType: type, darkmode: darkmode })}
); @@ -108,13 +111,13 @@ export function renderPostArray(otherArticleCards, type) { return renderedPostArray; } -export function renderVideoArray(otherArticleCards, type) { +export function renderVideoArray(otherArticleCards, type, darkmode = false) { let renderedPostArray = []; for (let i = 0; i < otherArticleCards.length; i++) { renderedPostArray.push(
{React.cloneElement(otherArticleCards[i], { - displayType: type + displayType: type, darkmode: darkmode })}
); @@ -122,13 +125,13 @@ export function renderVideoArray(otherArticleCards, type) { return renderedPostArray; } -export function renderPodcastArray(otherArticleCards, type) { +export function renderPodcastArray(otherArticleCards, type, darkmode = false) { let renderedPostArray = []; for (let i = 0; i < otherArticleCards.length; i++) { renderedPostArray.push(
{React.cloneElement(otherArticleCards[i], { - displayType: type + displayType: type, darkmode: darkmode })}
); diff --git a/package.json b/package.json index 7762c6e..3564fb9 100644 --- a/package.json +++ b/package.json @@ -22,6 +22,7 @@ "next-plugin-transpile-modules": "^2.0.0", "react": "16.13.1", "react-dom": "16.11.0", + "react-icons": "^4.7.1", "react-infinite-scroller": "^1.2.4", "react-markdown": "^6.0.1", "react-masonry-component": "^6.2.1", diff --git a/pages/[year]/[month]/[day]/[slug].jsx b/pages/[year]/[month]/[day]/[slug].jsx index 2c52213..90bedfc 100644 --- a/pages/[year]/[month]/[day]/[slug].jsx +++ b/pages/[year]/[month]/[day]/[slug].jsx @@ -116,6 +116,7 @@ class Post extends Component { {this.props.feature == true && ( - )} + )} {this.props.photos == undefined && this.props.feature != true && this.props.gallery != true && ( ; + return ; } } diff --git a/pages/advertise.jsx b/pages/advertise.jsx index 3233b53..960449d 100644 --- a/pages/advertise.jsx +++ b/pages/advertise.jsx @@ -12,7 +12,7 @@ class Page extends Component { return { page }; } render() { - return ; + return ; } } diff --git a/pages/category/[slug].jsx b/pages/category/[slug].jsx index e0c48e7..3b2f89a 100755 --- a/pages/category/[slug].jsx +++ b/pages/category/[slug].jsx @@ -66,11 +66,13 @@ class Category extends Component {
{ diff --git a/pages/category/cartoons.jsx b/pages/category/cartoons.jsx index b0b69e6..71407f9 100644 --- a/pages/category/cartoons.jsx +++ b/pages/category/cartoons.jsx @@ -69,12 +69,14 @@ class Cartoons extends Component {
diff --git a/pages/category/graphics.jsx b/pages/category/graphics.jsx index c93c895..ebb3aba 100644 --- a/pages/category/graphics.jsx +++ b/pages/category/graphics.jsx @@ -69,12 +69,14 @@ class Graphics extends Component {
diff --git a/pages/category/illo.jsx b/pages/category/illo.jsx index cb9febf..a804fbd 100644 --- a/pages/category/illo.jsx +++ b/pages/category/illo.jsx @@ -69,11 +69,13 @@ class Illo extends Component {
diff --git a/pages/category/podcasts.jsx b/pages/category/podcasts.jsx index 0b89de9..9e43d2f 100755 --- a/pages/category/podcasts.jsx +++ b/pages/category/podcasts.jsx @@ -61,12 +61,14 @@ class Category extends Component {
{ return { diff --git a/pages/category/spectrum.jsx b/pages/category/spectrum.jsx index bb0cb56..3fe3862 100644 --- a/pages/category/spectrum.jsx +++ b/pages/category/spectrum.jsx @@ -69,11 +69,13 @@ class Spectrum extends Component {
diff --git a/pages/category/video.jsx b/pages/category/video.jsx index 1ffa1e6..2e3858a 100755 --- a/pages/category/video.jsx +++ b/pages/category/video.jsx @@ -61,6 +61,7 @@ class Category extends Component {
@@ -68,6 +69,7 @@ class Category extends Component { { return { category: { diff --git a/pages/comment.jsx b/pages/comment.jsx index 8ad7cdb..0018d0b 100644 --- a/pages/comment.jsx +++ b/pages/comment.jsx @@ -12,7 +12,7 @@ class Page extends Component { return { page }; } render() { - return ; + return ; } } diff --git a/pages/contact.jsx b/pages/contact.jsx index 600e2f1..5acb132 100644 --- a/pages/contact.jsx +++ b/pages/contact.jsx @@ -12,7 +12,7 @@ class Page extends Component { return { page }; } render() { - return ; + return ; } } diff --git a/pages/editorial-board.jsx b/pages/editorial-board.jsx index 81ae763..7ec7c50 100644 --- a/pages/editorial-board.jsx +++ b/pages/editorial-board.jsx @@ -12,7 +12,7 @@ class Page extends Component { return { page }; } render() { - return ; + return ; } } diff --git a/pages/index.jsx b/pages/index.jsx index e2346a4..f395f67 100644 --- a/pages/index.jsx +++ b/pages/index.jsx @@ -202,6 +202,7 @@ class Index extends Component { /> { @@ -217,12 +218,14 @@ class Index extends Component { /> {this.state.showPopUp && !this.state.showWelcome ? ( ) : null} {this.state.showWelcome ? ( diff --git a/pages/page/[slug].jsx b/pages/page/[slug].jsx index ae530d8..53f9b49 100644 --- a/pages/page/[slug].jsx +++ b/pages/page/[slug].jsx @@ -30,7 +30,7 @@ class Page extends Component { }} /> - +
); } diff --git a/pages/post/[slug].jsx b/pages/post/[slug].jsx index 95e08c5..198aa71 100644 --- a/pages/post/[slug].jsx +++ b/pages/post/[slug].jsx @@ -105,35 +105,46 @@ class Post extends Component { {renderedMeta} - {this.props.feature == true && ( - - )} - {this.props.oldGallery == true && ( - - )} - {this.props.gallery == true && ( - - )} - {this.props.photos == undefined && - this.props.feature != true && - this.props.gallery != true && ( + + { + this.props.feature == true && ( + + ) + } + { + this.props.oldGallery == true && ( + + ) + } + { + this.props.gallery == true && ( + + ) + } + { + this.props.photos == undefined && this.props.feature != true && this.props.gallery != true && ( + { return { diff --git a/pages/privacy.jsx b/pages/privacy.jsx index a318ac8..a51da14 100644 --- a/pages/privacy.jsx +++ b/pages/privacy.jsx @@ -12,7 +12,7 @@ class Page extends Component { return { page }; } render() { - return ; + return ; } } diff --git a/pages/records-requests.jsx b/pages/records-requests.jsx index 984f531..a43f912 100644 --- a/pages/records-requests.jsx +++ b/pages/records-requests.jsx @@ -12,7 +12,7 @@ class Page extends Component { return { page }; } render() { - return ; + return ; } } diff --git a/pages/search.jsx b/pages/search.jsx index e7ae238..b9ff900 100644 --- a/pages/search.jsx +++ b/pages/search.jsx @@ -39,7 +39,9 @@ class Search extends React.Component { {`Search: ${decodeURIComponentSafe(this.props.q)} - Daily Bruin`} - + + + ); } diff --git a/pages/sponsored/[slug].jsx b/pages/sponsored/[slug].jsx index 1f6b869..b3a0e62 100644 --- a/pages/sponsored/[slug].jsx +++ b/pages/sponsored/[slug].jsx @@ -56,6 +56,7 @@ class SponsoredPost extends Component { ); diff --git a/pages/staff.jsx b/pages/staff.jsx index 7d27ba5..97f9c8f 100644 --- a/pages/staff.jsx +++ b/pages/staff.jsx @@ -12,7 +12,7 @@ class Page extends Component { return { page }; } render() { - return ; + return ; } } diff --git a/pages/stonewall.jsx b/pages/stonewall.jsx index 8e6bee3..a7f57db 100644 --- a/pages/stonewall.jsx +++ b/pages/stonewall.jsx @@ -66,7 +66,7 @@ class Stonewall extends Component { display: block; padding: 10px 30px; box-shadow: ${globals.cardShadow}; - background-color: #ffffff; + background-color: #fff; margin: 6px; .accordion { @@ -76,7 +76,7 @@ class Stonewall extends Component { .accordion .accordion-navigation > a { background: none; - color: #222222 !important; + color: #222 !important; display: block; font-family: ${globals.bodyFont}; font-size: 1.5rem; diff --git a/pages/submit.jsx b/pages/submit.jsx index 45b5f81..4629fc4 100644 --- a/pages/submit.jsx +++ b/pages/submit.jsx @@ -12,7 +12,7 @@ class Page extends Component { return { page }; } render() { - return ; + return ; } } diff --git a/pages/tag/[slug].jsx b/pages/tag/[slug].jsx index d3e66a3..2ffd31e 100644 --- a/pages/tag/[slug].jsx +++ b/pages/tag/[slug].jsx @@ -49,6 +49,7 @@ class Tag extends Component { { return { category: { diff --git a/pages/tag/usac-officer-evaluations-20-21.jsx b/pages/tag/usac-officer-evaluations-20-21.jsx index c18db31..b0b1830 100644 --- a/pages/tag/usac-officer-evaluations-20-21.jsx +++ b/pages/tag/usac-officer-evaluations-20-21.jsx @@ -76,6 +76,7 @@ class USACOfficerEvaluations2021 extends React.Component {
diff --git a/pages/the-daily-bruin-community-guide.jsx b/pages/the-daily-bruin-community-guide.jsx index 9802047..ca253bf 100644 --- a/pages/the-daily-bruin-community-guide.jsx +++ b/pages/the-daily-bruin-community-guide.jsx @@ -12,7 +12,7 @@ class Page extends Component { return { page }; } render() { - return ; + return ; } } diff --git a/yarn.lock b/yarn.lock index fe09f6f..2871229 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5318,6 +5318,11 @@ react-event-listener@^0.6.0: prop-types "^15.6.0" warning "^4.0.1" +react-icons@^4.7.1: + version "4.7.1" + resolved "https://registry.yarnpkg.com/react-icons/-/react-icons-4.7.1.tgz#0f4b25a5694e6972677cb189d2a72eabea7a8345" + integrity sha512-yHd3oKGMgm7zxo3EA7H2n7vxSoiGmHk5t6Ou4bXsfcgWyhfDKMpyKfhHR6Bjnn63c+YXBLBPUql9H4wPJM6sXw== + react-infinite-scroller@^1.2.4: version "1.2.4" resolved "https://registry.yarnpkg.com/react-infinite-scroller/-/react-infinite-scroller-1.2.4.tgz#f67eaec4940a4ce6417bebdd6e3433bfc38826e9"