fix: style flashes, app start_url, and quotes

This commit is contained in:
Kyle Gill
2019-05-29 22:36:24 -06:00
parent 4ebe1ec1de
commit 5d46b17eef
3 changed files with 22 additions and 3 deletions

View File

@@ -26,7 +26,7 @@ module.exports = {
options: {
name: `Sol Journal`,
short_name: `Sol Journal`,
start_url: `/`,
start_url: `/app`,
background_color: `#FFF`,
theme_color: `#FFF`,
display: `standalone`,

View File

@@ -17,10 +17,21 @@ class ThemeToggler extends React.Component {
: "DARK",
}
toggle = () => {
componentDidMount() {
// set the body style property on mount so routes don't flash between transitions
const { themeName } = this.state
this.toggle(themeName)
}
toggle = newThemeName => {
const { themeName } = this.state
const body = document.body
const newTheme = themeName === "LIGHT" ? "DARK" : "LIGHT"
let newTheme
if (newThemeName) {
newTheme = newThemeName
} else {
newTheme = themeName === "LIGHT" ? "DARK" : "LIGHT"
}
body.style.setProperty(
"background-color",
theme[newTheme].colors.bodyBackground

View File

@@ -62,5 +62,13 @@
{
"quote": "A diary is useful during conscious, intentional, and painful spiritual evolutions.",
"author": "André Gide"
},
{
"quote": "Most folks are about as happy as they make up their minds to be.",
"author": "Abraham Lincoln"
},
{
"quote": "It takes no more time to see the good side of life than it takes to see the bad.",
"author": "Jimmy Buffet"
}
]