From 4f42b5a2b35cf61d6042562195755699f9de177f Mon Sep 17 00:00:00 2001
From: Renard
Date: Sun, 22 Sep 2019 00:28:21 -0300
Subject: Nightmode
---
src/App.css | 19 +++++++++++++++++++
src/App.js | 43 +++++++++++++++++++++++++++++++++++++++----
src/Board.js | 11 +++++++----
src/Home.js | 10 +++++++++-
src/Post.js | 4 ++--
src/ReplyForm.js | 10 ++++------
src/Thread.js | 21 ++++++++++++++-------
7 files changed, 94 insertions(+), 24 deletions(-)
(limited to 'src')
diff --git a/src/App.css b/src/App.css
index a4cf972..9486e24 100644
--- a/src/App.css
+++ b/src/App.css
@@ -76,4 +76,23 @@
.playerContainer {
max-width: 400px;
padding-bottom: 0.75em;
+}
+
+.ui.attached:not(.top).header {
+ border-top: 1px solid !important;
+ border-radius: 0.28571429rem 0.28571429rem 0 0;
+}
+
+.ui.inverted.attached.header {
+ border-color: #555555 !important;
+}
+
+.ui.container.inverted {
+ background-color: #1c1c1c;
+ padding: 1em 2em;
+}
+
+.homeContainer.inverted {
+ color: #eaeaea !important;
+ background-color: #454647 !important;
}
\ No newline at end of file
diff --git a/src/App.js b/src/App.js
index ff5e712..9ea8330 100644
--- a/src/App.js
+++ b/src/App.js
@@ -22,8 +22,10 @@ class App extends Component {
super();
this.state = {
boardList: [],
- isLoaded: false
+ isLoaded: false,
+ nightMode: true
};
+ this.toggleTheme = this.toggleTheme.bind(this);
}
componentDidMount() {
@@ -36,6 +38,18 @@ class App extends Component {
});
}
+ componentDidUpdate() {
+ if (this.state.nightMode) {
+ document.body.style.backgroundColor = "#313233";
+ } else {
+ document.body.style.backgroundColor = "#FFFFFF";
+ }
+ }
+
+ toggleTheme() {
+ this.setState({ nightMode: !this.state.nightMode });
+ }
+
render() {
if (!this.state.isLoaded) {
if (!this.state.isLoaded) {
@@ -87,15 +101,36 @@ class App extends Component {
)}
+
+
+ {this.state.nightMode ? (
+
+ ) : (
+
+ )}
+
+
-
-
+
+
-
+
diff --git a/src/Board.js b/src/Board.js
index 34e3f52..5dd00a2 100644
--- a/src/Board.js
+++ b/src/Board.js
@@ -109,10 +109,11 @@ class Board extends Component {
return board.dir === this.props.dir;
});
document.title = currentBoard.name + " - B.a.I";
+ const nightMode = this.props.nightMode;
return (
-
+
Home
@@ -121,7 +122,7 @@ class Board extends Component {
{threadList.map(thread => (
-
+
{thread.subject}
@@ -129,14 +130,15 @@ class Board extends Component {
{thread.total_replies} respuestas
-
-
+
+
{thread.replies.map((reply, index, replies) => (
@@ -147,6 +149,7 @@ class Board extends Component {
threadId={thread.id}
key={"reply_" + reply.id}
currentBoard={currentBoard}
+ nightMode={nightMode}
/>
))}
diff --git a/src/Home.js b/src/Home.js
index 292b8a1..5832ce4 100644
--- a/src/Home.js
+++ b/src/Home.js
@@ -106,7 +106,15 @@ class Home extends Component {
const { newThreadsList, lastAgeThreads, latestNews } = this.state;
document.title = "B.a.I Home";
return (
-
+
diff --git a/src/Post.js b/src/Post.js
index b3e47ea..1140d49 100644
--- a/src/Post.js
+++ b/src/Post.js
@@ -22,7 +22,7 @@ const ImageModal = ({ href, trigger }) => (
);
-const Post = ({ index, post, locked, threadId, currentBoard }) => {
+const Post = ({ index, post, locked, threadId, currentBoard, nightMode }) => {
if (post.IS_DELETED > 0) {
return (
@@ -102,7 +102,7 @@ const Post = ({ index, post, locked, threadId, currentBoard }) => {
const youtubeVideos = post.message.match(youtubeRe);
return (
-
+
diff --git a/src/ReplyForm.js b/src/ReplyForm.js
index a9f461d..564ed88 100644
--- a/src/ReplyForm.js
+++ b/src/ReplyForm.js
@@ -73,7 +73,7 @@ class ReplyForm extends Component {
render() {
const { name, email, message, replyRes, attachment } = this.state;
- const { currentBoard } = this.props;
+ const { currentBoard, nightMode } = this.props;
if (this.props.locked === 1) {
return (
@@ -83,7 +83,7 @@ class ReplyForm extends Component {
);
}
return (
-
+
{replyRes !== null ? (
replyRes.state === "success" ? (
@@ -101,7 +101,7 @@ class ReplyForm extends Component {
)
) : null}
-
-
+
);
diff --git a/src/Thread.js b/src/Thread.js
index b390f54..fe9efff 100644
--- a/src/Thread.js
+++ b/src/Thread.js
@@ -6,7 +6,8 @@ import {
Message,
Comment,
Breadcrumb,
- Divider
+ Divider,
+ Container
} from "semantic-ui-react";
import Moment from "react-moment";
import "moment/locale/es";
@@ -100,6 +101,7 @@ class Thread extends Component {
render() {
const { isLoading, error } = this.state;
+ const { nightMode } = this.props;
if (isLoading) {
return (
@@ -135,8 +137,8 @@ class Thread extends Component {
document.title = subject + " - " + currentBoard.name + "@B.a.I";
return (
-
-
+
+
Home
@@ -147,7 +149,7 @@ class Thread extends Component {
{subject}
-
+
{subject}
{locked ? : null}
@@ -162,7 +164,7 @@ class Thread extends Component {
-
+
{posts.map((post, index) => (
-
+
API Link
-
+
);
}
}
--
cgit v1.2.1-18-gbd029