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 a loader for the events page #55

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions frontend/src/components/loader.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import React from 'react';

import './loader.scss';

const Loader = () => (
<div className="loader-wrapper">
<div className="loader" />
</div>
);

export default Loader;
91 changes: 91 additions & 0 deletions frontend/src/components/loader.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
@import '../colors';

.loader-wrapper {
align-items: center;
display: flex;
min-height: 80vh;
}

.loader {
animation: load4 1.3s infinite linear;
border-radius: 50%;
color: $logo-color;
font-size: 20px;
height: 1em;
margin: 100px auto;
position: relative;
text-indent: -9999em;
Copy link
Contributor

Choose a reason for hiding this comment

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

This is interesting can you explain why this is needed?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks for looking at this carefully. It's interesting indeed.
I copied this loader from https://projects.lukehaas.me/css-loaders/.

transform: translateZ(0);
width: 1em;
}

// sass-lint:disable zero-unit leading-zero
@keyframes load4 {
0%,
100% {
box-shadow: 0 -3em 0 0.2em, 2em -2em 0 0em, 3em 0 0 -1em, 2em 2em 0 -1em, 0 3em 0 -1em, -2em 2em 0 -1em, -3em 0 0 -1em, -2em -2em 0 0;
}

12.5% {
box-shadow: 0 -3em 0 0, 2em -2em 0 0.2em, 3em 0 0 0, 2em 2em 0 -1em, 0 3em 0 -1em, -2em 2em 0 -1em, -3em 0 0 -1em, -2em -2em 0 -1em;
}

25% {
box-shadow: 0 -3em 0 -0.5em, 2em -2em 0 0, 3em 0 0 0.2em, 2em 2em 0 0, 0 3em 0 -1em, -2em 2em 0 -1em, -3em 0 0 -1em, -2em -2em 0 -1em;
}

37.5% {
box-shadow: 0 -3em 0 -1em, 2em -2em 0 -1em, 3em 0em 0 0, 2em 2em 0 0.2em, 0 3em 0 0em, -2em 2em 0 -1em, -3em 0em 0 -1em, -2em -2em 0 -1em;
}

50% {
box-shadow: 0 -3em 0 -1em, 2em -2em 0 -1em, 3em 0 0 -1em, 2em 2em 0 0em, 0 3em 0 0.2em, -2em 2em 0 0, -3em 0em 0 -1em, -2em -2em 0 -1em;
}

62.5% {
box-shadow: 0 -3em 0 -1em, 2em -2em 0 -1em, 3em 0 0 -1em, 2em 2em 0 -1em, 0 3em 0 0, -2em 2em 0 0.2em, -3em 0 0 0, -2em -2em 0 -1em;
}

75% {
box-shadow: 0em -3em 0 -1em, 2em -2em 0 -1em, 3em 0em 0 -1em, 2em 2em 0 -1em, 0 3em 0 -1em, -2em 2em 0 0, -3em 0em 0 0.2em, -2em -2em 0 0;
}

87.5% {
box-shadow: 0em -3em 0 0, 2em -2em 0 -1em, 3em 0 0 -1em, 2em 2em 0 -1em, 0 3em 0 -1em, -2em 2em 0 0, -3em 0em 0 0, -2em -2em 0 0.2em;
}
}

@keyframes load4 {
0%,
100% {
box-shadow: 0 -3em 0 0.2em, 2em -2em 0 0em, 3em 0 0 -1em, 2em 2em 0 -1em, 0 3em 0 -1em, -2em 2em 0 -1em, -3em 0 0 -1em, -2em -2em 0 0;
}

12.5% {
box-shadow: 0 -3em 0 0, 2em -2em 0 0.2em, 3em 0 0 0, 2em 2em 0 -1em, 0 3em 0 -1em, -2em 2em 0 -1em, -3em 0 0 -1em, -2em -2em 0 -1em;
}

25% {
box-shadow: 0 -3em 0 -0.5em, 2em -2em 0 0, 3em 0 0 0.2em, 2em 2em 0 0, 0 3em 0 -1em, -2em 2em 0 -1em, -3em 0 0 -1em, -2em -2em 0 -1em;
}

37.5% {
box-shadow: 0 -3em 0 -1em, 2em -2em 0 -1em, 3em 0em 0 0, 2em 2em 0 0.2em, 0 3em 0 0em, -2em 2em 0 -1em, -3em 0em 0 -1em, -2em -2em 0 -1em;
}

50% {
box-shadow: 0 -3em 0 -1em, 2em -2em 0 -1em, 3em 0 0 -1em, 2em 2em 0 0em, 0 3em 0 0.2em, -2em 2em 0 0, -3em 0em 0 -1em, -2em -2em 0 -1em;
}

62.5% {
box-shadow: 0 -3em 0 -1em, 2em -2em 0 -1em, 3em 0 0 -1em, 2em 2em 0 -1em, 0 3em 0 0, -2em 2em 0 0.2em, -3em 0 0 0, -2em -2em 0 -1em;
}

75% {
box-shadow: 0em -3em 0 -1em, 2em -2em 0 -1em, 3em 0em 0 -1em, 2em 2em 0 -1em, 0 3em 0 -1em, -2em 2em 0 0, -3em 0em 0 0.2em, -2em -2em 0 0;
}

87.5% {
box-shadow: 0em -3em 0 0, 2em -2em 0 -1em, 3em 0 0 -1em, 2em 2em 0 -1em, 0 3em 0 -1em, -2em 2em 0 0, -3em 0em 0 0, -2em -2em 0 0.2em;
}
}
16 changes: 11 additions & 5 deletions frontend/src/events/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import PropTypes from 'prop-types';
import axios from 'axios';

import GuestNav from '../components/guest_nav';
import Loader from '../components/loader';
import Teams from './teams';

import './events.scss';
Expand Down Expand Up @@ -109,14 +110,19 @@ class EventsPage extends React.Component {

render() {
const { events } = this.state;
const content = events.length > 0 ? (
<div className="events">
{events.map(e => (
<Event key={e.name} {...e} />
))}
</div>
) : (
<Loader />
);
return (
<div className="events-page">
<GuestNav />
<div className="events">
{events.map(e => (
<Event key={e.name} {...e} />
))}
</div>
{content}
</div>
);
}
Expand Down
3 changes: 3 additions & 0 deletions frontend/src/events/events.scss
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
@import '../breakpoints';
@import '../colors';
@import '../fade_in';

.events-page {
display: flex;
flex-direction: column;

.event {
@extend %fade-in;

@include breakpoint-tablet-down {
flex-direction: column;
}
Expand Down
17 changes: 17 additions & 0 deletions frontend/src/fade_in.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
@keyframes fade-in-frames {
0% {
opacity: 0;
}

100% {
opacity: 1;
}
}

%fade-in {
animation-duration: .5s;
animation-iteration-count: 1;
animation-name: fade-in-frames;
animation-timing-function: ease-in;
opacity: 1;
}