Skip to content

Commit

Permalink
Add a loader for the events page
Browse files Browse the repository at this point in the history
  • Loading branch information
donaldong committed Apr 18, 2019
1 parent a8ff555 commit b42b87a
Show file tree
Hide file tree
Showing 5 changed files with 133 additions and 5 deletions.
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;
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;
}

0 comments on commit b42b87a

Please sign in to comment.