fix: style flashes, app start_url, and quotes
This commit is contained in:
@@ -26,7 +26,7 @@ module.exports = {
|
|||||||
options: {
|
options: {
|
||||||
name: `Sol Journal`,
|
name: `Sol Journal`,
|
||||||
short_name: `Sol Journal`,
|
short_name: `Sol Journal`,
|
||||||
start_url: `/`,
|
start_url: `/app`,
|
||||||
background_color: `#FFF`,
|
background_color: `#FFF`,
|
||||||
theme_color: `#FFF`,
|
theme_color: `#FFF`,
|
||||||
display: `standalone`,
|
display: `standalone`,
|
||||||
|
|||||||
@@ -17,10 +17,21 @@ class ThemeToggler extends React.Component {
|
|||||||
: "DARK",
|
: "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 { themeName } = this.state
|
||||||
const body = document.body
|
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(
|
body.style.setProperty(
|
||||||
"background-color",
|
"background-color",
|
||||||
theme[newTheme].colors.bodyBackground
|
theme[newTheme].colors.bodyBackground
|
||||||
|
|||||||
@@ -62,5 +62,13 @@
|
|||||||
{
|
{
|
||||||
"quote": "A diary is useful during conscious, intentional, and painful spiritual evolutions.",
|
"quote": "A diary is useful during conscious, intentional, and painful spiritual evolutions.",
|
||||||
"author": "André Gide"
|
"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"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
Reference in New Issue
Block a user