Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Loading animations and update error handling #14

Merged
merged 6 commits into from
Nov 29, 2020
Merged

Conversation

JulianBlohm
Copy link
Owner

@JulianBlohm JulianBlohm commented Nov 27, 2020

New loading animations are displayed during fetching and with the dynamic URL there was a reason to separate the error handling of main and result page. Therefore I added a error page shown if fetching was not successful from result page.

-Prettier fixed

@vercel
Copy link

vercel bot commented Nov 27, 2020

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/julianblohm/hotspotornot/6em5eoswo
✅ Preview: https://hotspotornot-git-loading-screen.julianblohm.vercel.app

Copy link

@alex-jonas alex-jonas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice work 👍

</section>
<section className="information-wrapper">
<a href="https://www.bundesregierung.de/breg-de/themen/coronavirus/corona-bundeslaender-1745198">
<Button text="Regeln der Bundesländer" />

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this work? Actually, a button within anchor-tags is not valid HTML

Copy link
Owner Author

@JulianBlohm JulianBlohm Nov 27, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh really? Actually it works, but you're right. Gonna change it to just a link.

src/ResultPage.js Outdated Show resolved Hide resolved
@@ -1,33 +1,40 @@
import styled from 'styled-components/macro'
import PropTypes from 'prop-types'

function Button({text, onClick}) {

function Button({ text, onClick, className }) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The component name sounds like a button element, but it represents a div.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah true, did some stupid stuff there, gonna remove the div and solve the styling with props.

<ErrorPageStyled>
<section className="county-class-red result-wrapper">
<h3>Sorry, Daten konnten nicht geladen werden.</h3>
<span>Probiere eine neue Suche!</span>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You may want to set the styling in "result-wrapper" class to get rid of the span?

Copy link
Owner Author

@JulianBlohm JulianBlohm Nov 27, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, but have to stick with the span, cause don't want the whole text in the result wrapper being font-weight: 300.

animation: loading-spinner 1s cubic-bezier(0, 0.2, 0.8, 1) infinite;
}

.loading-spinner div:nth-child(2) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

interesting selector :)

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

copy-pasta 🍝

Copy link

@ninapeters ninapeters left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really well structured and clean code. I left only three comments. Keep it up!

src/MainPage.js Outdated
</MainPageStyled>
isDataLoading={isDataLoading}
setSearchOrigin={setSearchOrigin}
></Form>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't embed anything in your form tag. So you can close it directly without a closing tag.

)}
<h3>
Die 7-Tage-Inzidenz <br /> liegt bei{' '}
{countyData.incidence}.{' '}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same problem with the empty brackets.

Copy link
Owner Author

@JulianBlohm JulianBlohm Nov 27, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I really don't know where they come from 🧐
Update--> found out that prettier formatted the text and placed these brackets as string with space, so that the incidence has space to the text.

src/MainPage.js Outdated
padding: 10px;
display: grid;
grid-gap: 20px;
background: #f5f5f7;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sometimes you work with color variables. So it's not quite stringent.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks! Got the variables after I styled that one, I guess

Copy link

@dajanaheinze dajanaheinze left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice Work! Maybe you could think about your color variable naming. It's only a little think :)

@@ -31,7 +31,7 @@ const MainPageStyled = styled.div`
padding: 10px;
display: grid;
grid-gap: 20px;
background: #f5f5f7;
background: var(--silver);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice to work with variablen. You might think about it work with main oder primary in the naming. So it's a little bit clearer what kind it is.

}
export default styled.button`
border: none;
background: ${(props) => (props.disabled ? 'var(--gray)' : 'var(--blue)')};

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here ;-) "more speacking names" maybe

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is also easier to change the main colors in the whole app that way. :)

Copy link

@JanaHaeusler JanaHaeusler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work and a very important app! Excited to see what is comming next. :) If questions arise regarding my comments, feel free to ask. I hope it is helpful.

src/MainPage.js Outdated
@@ -22,7 +22,7 @@ function MainPage({
errorMessage={errorMessage}
isDataLoading={isDataLoading}
setSearchOrigin={setSearchOrigin}
></Form>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could be there a more descriptive name for the form and what it is doing? Hard to think of something, but maybe you have a practical idea. CheckHotspotFormor something like this?

}
export default styled.button`
border: none;
background: ${(props) => (props.disabled ? 'var(--gray)' : 'var(--blue)')};

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is also easier to change the main colors in the whole app that way. :)

font-size: 1rem;
border-radius: 5px;
margin: 20px 0;
cursor: pointer;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could think of grouping properties according theire functions to have a better overview. E. g. everything with display, fonts and so on.

border-radius: 5px;
margin: 20px 0;
cursor: pointer;
`

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same point reagrding grouping here as well :)

@JulianBlohm JulianBlohm merged commit 9b2311c into main Nov 29, 2020
@JulianBlohm JulianBlohm deleted the loading-screen branch December 1, 2020 14:50
@JulianBlohm JulianBlohm linked an issue Dec 8, 2020 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Loading animation and error handling
5 participants