chore: swap loading component for react-spinner

This commit is contained in:
Kyle Gill
2019-03-29 09:38:21 -06:00
parent 8b83dd8c6d
commit faf5473d5d
6 changed files with 40 additions and 13 deletions

7
.prettierrc Normal file
View File

@@ -0,0 +1,7 @@
{
"endOfLine": "lf",
"semi": false,
"singleQuote": false,
"tabWidth": 2,
"trailingComma": "es5"
}

View File

@@ -14,6 +14,7 @@
"react-feather": "^1.1.6", "react-feather": "^1.1.6",
"react-router-dom": "^5.0.0", "react-router-dom": "^5.0.0",
"react-scripts": "2.1.8", "react-scripts": "2.1.8",
"react-spinners": "^0.5.3",
"recompose": "^0.30.0" "recompose": "^0.30.0"
}, },
"scripts": { "scripts": {

View File

@@ -13,6 +13,10 @@
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/ user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
--> -->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" /> <link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<link
href="https://fonts.googleapis.com/css?family=Montserrat:400,700"
rel="stylesheet"
/>
<!-- <!--
Notice the use of %PUBLIC_URL% in the tags above. Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build. It will be replaced with the URL of the `public` folder during the build.

View File

@@ -1,16 +1,17 @@
import React from "react"; import React from "react"
import styled from "@emotion/styled"; import styled from "@emotion/styled"
import { import {
Book, Book,
Calendar, Calendar,
ChevronLeft, ChevronLeft,
ChevronRight, ChevronRight,
Circle, Circle,
Edit2,
Moon, Moon,
Sun, Sun,
User User,
} from "react-feather"; } from "react-feather"
import { withTheme } from "emotion-theming"; import { withTheme } from "emotion-theming"
const IconBase = styled.div` const IconBase = styled.div`
display: flex; display: flex;
@@ -25,7 +26,7 @@ const IconBase = styled.div`
background-color: ${props => !props.disabled && props.theme.colors.hover}; background-color: ${props => !props.disabled && props.theme.colors.hover};
cursor: pointer; cursor: pointer;
} }
`; `
const Icon = ({ name, ...rest }) => ( const Icon = ({ name, ...rest }) => (
<IconBase {...rest}> <IconBase {...rest}>
@@ -38,6 +39,6 @@ const Icon = ({ name, ...rest }) => (
{name === "Sun" && <Sun />} {name === "Sun" && <Sun />}
{name === "User" && <User />} {name === "User" && <User />}
</IconBase> </IconBase>
); )
export default withTheme(Icon); export default withTheme(Icon)

View File

@@ -6,6 +6,7 @@ import { withTheme } from "emotion-theming";
import { withFirebase } from "../../firebase"; import { withFirebase } from "../../firebase";
import { withAuthentication } from "../../session"; import { withAuthentication } from "../../session";
import { addDays, subDays, format, isAfter, startOfYesterday } from "date-fns"; import { addDays, subDays, format, isAfter, startOfYesterday } from "date-fns";
import { BeatLoader } from "react-spinners";
import { SIZES } from "../../../styles/constants"; import { SIZES } from "../../../styles/constants";
@@ -145,7 +146,8 @@ class Day extends Component {
const { const {
match: { match: {
params: { year, month, day } params: { year, month, day }
} },
theme
} = this.props; } = this.props;
const { text, loading } = this.state; const { text, loading } = this.state;
const currentDay = new Date(year, month - 1, day); const currentDay = new Date(year, month - 1, day);
@@ -161,7 +163,10 @@ class Day extends Component {
/> />
<JournalHeading>RECORD THOUGHTS ABOUT YOUR DAY</JournalHeading> <JournalHeading>RECORD THOUGHTS ABOUT YOUR DAY</JournalHeading>
{loading ? ( {loading ? (
<JournalEntryArea disabled placeholder="Loading..." /> // <JournalEntryArea disabled placeholder="Loading..." />
<div style={{ marginTop: 10 }}>
<BeatLoader color={theme.colors.tertiary} size={10} margin="4px" />
</div>
) : ( ) : (
<JournalEntryArea <JournalEntryArea
placeholder="Start writing..." placeholder="Start writing..."

View File

@@ -878,7 +878,7 @@
"@emotion/utils" "0.11.1" "@emotion/utils" "0.11.1"
"@emotion/weak-memoize" "0.2.2" "@emotion/weak-memoize" "0.2.2"
"@emotion/core@^10.0.10": "@emotion/core@^10.0.10", "@emotion/core@^10.0.4":
version "10.0.10" version "10.0.10"
resolved "https://registry.yarnpkg.com/@emotion/core/-/core-10.0.10.tgz#8d3114e5a2f8b178a7067c603a2937516f180b08" resolved "https://registry.yarnpkg.com/@emotion/core/-/core-10.0.10.tgz#8d3114e5a2f8b178a7067c603a2937516f180b08"
integrity sha512-U1aE2cOWUscjc8ZJ3Cx32udOzLeRoJwGxBH93xQD850oQFpwPKZARzdUtdc9SByUOwzSFYxhDhrpXnV34FJmWg== integrity sha512-U1aE2cOWUscjc8ZJ3Cx32udOzLeRoJwGxBH93xQD850oQFpwPKZARzdUtdc9SByUOwzSFYxhDhrpXnV34FJmWg==
@@ -8229,7 +8229,7 @@ prompts@^0.1.9:
kleur "^2.0.1" kleur "^2.0.1"
sisteransi "^0.1.1" sisteransi "^0.1.1"
prop-types@^15.6.2: prop-types@^15.5.10, prop-types@^15.6.2:
version "15.7.2" version "15.7.2"
resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.7.2.tgz#52c41e75b8c87e72b9d9360e0206b99dcbffa6c5" resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.7.2.tgz#52c41e75b8c87e72b9d9360e0206b99dcbffa6c5"
integrity sha512-8QQikdH7//R2vurIJSutZ1smHYTcLpRWEOlHnzcWHmBYrOGUysKwSsrC89BCiFj3CbrfJ/nXFdJepOVrY1GCHQ== integrity sha512-8QQikdH7//R2vurIJSutZ1smHYTcLpRWEOlHnzcWHmBYrOGUysKwSsrC89BCiFj3CbrfJ/nXFdJepOVrY1GCHQ==
@@ -8571,6 +8571,15 @@ react-scripts@2.1.8:
optionalDependencies: optionalDependencies:
fsevents "1.2.4" fsevents "1.2.4"
react-spinners@^0.5.3:
version "0.5.3"
resolved "https://registry.yarnpkg.com/react-spinners/-/react-spinners-0.5.3.tgz#b4fa956da9674f3300442cef10186de7d749099c"
integrity sha512-5erLzg/7uduB0rbO2CAvi8seg1FJ98dQhYxWoBgjU8XNnfb45RF1eARUemMwjtRQ3b5zZ9JVK4+AQtlHOK4ksQ==
dependencies:
"@emotion/core" "^10.0.4"
prop-types "^15.5.10"
recompose "0.27.1 - 0.30.0"
react@^16.8.4: react@^16.8.4:
version "16.8.4" version "16.8.4"
resolved "https://registry.yarnpkg.com/react/-/react-16.8.4.tgz#fdf7bd9ae53f03a9c4cd1a371432c206be1c4768" resolved "https://registry.yarnpkg.com/react/-/react-16.8.4.tgz#fdf7bd9ae53f03a9c4cd1a371432c206be1c4768"
@@ -8653,7 +8662,7 @@ realpath-native@^1.0.0:
dependencies: dependencies:
util.promisify "^1.0.0" util.promisify "^1.0.0"
recompose@^0.30.0: "recompose@0.27.1 - 0.30.0", recompose@^0.30.0:
version "0.30.0" version "0.30.0"
resolved "https://registry.yarnpkg.com/recompose/-/recompose-0.30.0.tgz#82773641b3927e8c7d24a0d87d65aeeba18aabd0" resolved "https://registry.yarnpkg.com/recompose/-/recompose-0.30.0.tgz#82773641b3927e8c7d24a0d87d65aeeba18aabd0"
integrity sha512-ZTrzzUDa9AqUIhRk4KmVFihH0rapdCSMFXjhHbNrjAWxBuUD/guYlyysMnuHjlZC/KRiOKRtB4jf96yYSkKE8w== integrity sha512-ZTrzzUDa9AqUIhRk4KmVFihH0rapdCSMFXjhHbNrjAWxBuUD/guYlyysMnuHjlZC/KRiOKRtB4jf96yYSkKE8w==