Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,17 @@ class App extends React.Component {
super(props);
this.state = {
count: 5,
posts1: []
posts1: [],
isDark: false
}
}

isDarkTheme = (dark) => {
this.setState({
isDark: dark
})
}

componentDidMount() {
var newPosts = [];
const posts = markdownFiles.forEach(
Expand Down Expand Up @@ -96,8 +103,10 @@ class App extends React.Component {
return (
<div>
<BrowserRouter>
<Navigation />
<Route exact path="/" component={Herocontent} />
<Navigation dark = {this.isDarkTheme}/>
<Route exact path="/" component={() => (
<Herocontent isDark = {this.state.isDark}/>
)} />
<Route path="/login" component={Login} />
<Fragment>
<section className="section">
Expand Down
4 changes: 2 additions & 2 deletions src/Components/Herocontent.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { Fragment } from 'react';
import Main from './Main';

const Herocontent = () => (
const Herocontent = (props) => (
<Fragment>
<div className="main thememain-blue">
<div className="container main hero-content-main">
Expand Down Expand Up @@ -32,7 +32,7 @@ const Herocontent = () => (
</div>
</div>
</div>
<Main />
<Main isDark = {props.isDark}/>
</Fragment>
);

Expand Down
2 changes: 1 addition & 1 deletion src/Components/Main.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class Main extends React.Component {

render() {
return (
<div className="main thememain-white">
<div className={this.props.isDark ? 'main thememain-dark' : 'main thememain-white'}>
{
titleMetaData.map((title) =>
<div className="container content-main">
Expand Down
6 changes: 3 additions & 3 deletions src/Components/Navigation.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import React from "react";
import { Link } from 'react-router-dom';

const Navigation = () => {
const Navigation = (props) => {
const [currentmode, changeState] = React.useState("Light Mode");
const DocBody = document.getElementById("Apptheme");
const changemode = () => {
currentmode === "Light Mode"
? ((DocBody.className = "thememain-dark"), changeState("Dark Mode"))
: ((DocBody.className = "thememain-white "), changeState("Light Mode"));
? ((DocBody.className = "thememain-dark"), changeState("Dark Mode"), props.dark(true))
: ((DocBody.className = "thememain-white "), changeState("Light Mode"), props.dark(false));
};
return (
<div className="main thememain-header">
Expand Down
4 changes: 4 additions & 0 deletions src/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@
background: #fff;
}

.thememain-white h3 {
color: #333;
}

.thememain-white .thememain-header {
background: linear-gradient(165deg, #6e60cc, #484389);
color: #fff;
Expand Down