Skip to content
This repository was archived by the owner on Mar 9, 2021. It is now read-only.

Commit 6b8ce87

Browse files
author
Zubair Ahmed
authored
Merge branch 'develop' into feature/upcoming-event-on-index-page
2 parents e5d7db9 + 59e2e60 commit 6b8ce87

File tree

5 files changed

+84
-22
lines changed

5 files changed

+84
-22
lines changed

components/events/event-card.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -106,11 +106,7 @@ export default props => (
106106
mr={[0]}
107107
my={props.showImg ? [1, 1, 0] : [1, 1, 1]}>
108108
<TimeIcon className="icons" />
109-
<span>
110-
{props.tense === 'past'
111-
? format(props.time, "ddd MMM Do 'YY")
112-
: format(props.time, "ddd MMM Do 'YY, h:mm A")}
113-
</span>
109+
<span>{format(props.time, "ddd MMM Do 'YY, h:mm A")}</span>
114110
</Box>
115111
<Box
116112
fontSize={[12, 14, 16]}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import React from 'react';
2+
import ContentLoader from 'react-content-loader';
3+
import styled from 'react-emotion';
4+
import { space } from 'styled-system';
5+
import { Flex } from 'grid-emotion';
6+
7+
import { breakpoints, graySecondary } from '../../utils/base.styles';
8+
9+
const EventLoader = styled(Flex)`
10+
${space};
11+
border: 1px solid ${graySecondary};
12+
margin: 32px 0;
13+
min-height: 120px;
14+
${breakpoints.md} {
15+
padding-right: 15px;
16+
}
17+
${breakpoints.sm} {
18+
padding-right: 15px;
19+
}
20+
${breakpoints.xs} {
21+
padding-right: 15px;
22+
}
23+
`;
24+
25+
export default () => (
26+
<EventLoader my={[3]} wrap>
27+
<ContentLoader width="100%" speed={4} primaryColor={'#f3f3f3'} secondaryColor={'#ecebeb'}>
28+
<rect x="0" y="0" rx="5" ry="5" width="200" height="132" />
29+
<rect x="207" y="7" rx="4" ry="4" width="550" height="20" />
30+
<rect x="210" y="54" rx="4" ry="4" width="300" height="15" />
31+
<rect x="210" y="100" rx="4" ry="4" width="120" height="15" />
32+
<rect x="355" y="100" rx="4" ry="4" width="120" height="15" />
33+
<rect x="503" y="100" rx="4" ry="4" width="120" height="15" />
34+
<rect x="636" y="74" rx="4" ry="4" width="120" height="40" />
35+
</ContentLoader>
36+
</EventLoader>
37+
);

package.json

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
"main": "index.js",
66
"scripts": {
77
"test": "xo && jest",
8-
"lint":
9-
"prettier 'utils/**/*.js' 'components/**/*.js' 'pages/**/*.js' 'lib/**/*.js' 'hocs/**/*.js' '*.js' --write && xo && markdownlint .",
8+
"lint": "prettier 'utils/**/*.js' 'components/**/*.js' 'pages/**/*.js' 'lib/**/*.js' 'hocs/**/*.js' '*.js' --write && xo && markdownlint .",
109
"precommit": "lint-staged",
1110
"analyze": "cross-env ANALYZE=1 next build",
1211
"dev": "cross-env NODE_ENV=development node server.js",
@@ -18,19 +17,32 @@
1817
},
1918
"xo": {
2019
"parser": "babel-eslint",
21-
"extends": ["prettier", "prettier/react", "plugin:react/recommended"],
22-
"env": ["browser", "node"],
20+
"extends": [
21+
"prettier",
22+
"prettier/react",
23+
"plugin:react/recommended"
24+
],
25+
"env": [
26+
"browser",
27+
"node"
28+
],
2329
"rules": {
2430
"linebreak-style": 0,
2531
"react/display-name": 0,
2632
"react/prop-types": 0
2733
},
2834
"space:": 2,
29-
"ignores": ["next.config.js"],
35+
"ignores": [
36+
"next.config.js"
37+
],
3038
"overrides": [
3139
{
3240
"files": "**/__tests__/*.test.js",
33-
"globals": ["describe", "it", "expect"]
41+
"globals": [
42+
"describe",
43+
"it",
44+
"expect"
45+
]
3446
}
3547
]
3648
},
@@ -41,8 +53,16 @@
4153
"jest --findRelatedTests",
4254
"git add"
4355
],
44-
"**/*.md": ["prettier", "markdownlint", "git add"],
45-
".github/CONTRIBUTING.md": ["doctoc", "prettier", "git add"]
56+
"**/*.md": [
57+
"prettier",
58+
"markdownlint",
59+
"git add"
60+
],
61+
".github/CONTRIBUTING.md": [
62+
"doctoc",
63+
"prettier",
64+
"git add"
65+
]
4666
},
4767
"dependencies": {
4868
"babel-plugin-emotion": "^8.0.10",
@@ -62,6 +82,7 @@
6282
"preact-emotion": "^8.0.10",
6383
"prop-types": "^15.5.10",
6484
"react": "^16.0.0",
85+
"react-content-loader": "^1.7.1",
6586
"react-dom": "^16.0.0",
6687
"react-emotion": "^8.0.10",
6788
"react-event-timeline": "^1.4.0",

pages/events.js

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import BannerSection from '../components/common/banner';
99
import { Container, SubTitle, Button } from '../utils/base.styles';
1010
import { baseEventsURL, futureEventsURL, pastEventsURL, imagePlaceholderURL } from '../utils/urls';
1111
import EventCard from '../components/events/event-card';
12+
import EventLoader from '../components/events/event-content-loader';
1213

1314
const EventsSection = styled.section`
1415
${space};
@@ -70,11 +71,9 @@ export default class Events extends React.Component {
7071

7172
renderEvents(events, loadLimit) {
7273
if (this.state.loading) {
73-
return (
74-
<SubTitle inverted color="#222">
75-
Loading..
76-
</SubTitle>
77-
);
74+
return [1, 2].map(i => {
75+
return <EventLoader key={i} />;
76+
});
7877
} else if (events.length === 0) {
7978
return (
8079
<SubTitle inverted color="#222">
@@ -119,7 +118,7 @@ export default class Events extends React.Component {
119118
renderLoadMoreButton(eventsTotalLength, loadLimit, isPastEvent) {
120119
return loadLimit >= eventsTotalLength ? null : (
121120
<div className="loadmore_div" mb={[5, 5]}>
122-
<Button inverted medium onClick={event => this.loadMore(event, isPastEvent)}>
121+
<Button inverted medium onClick={() => this.loadMore(isPastEvent)}>
123122
Load more
124123
</Button>
125124
</div>
@@ -133,6 +132,7 @@ export default class Events extends React.Component {
133132
}
134133

135134
render() {
135+
const { loading } = this.state;
136136
return (
137137
<Layout>
138138
<BannerSection title="Online & Offline Events" subTitle="Because you cannot change the world alone" />
@@ -144,7 +144,8 @@ export default class Events extends React.Component {
144144
Upcoming Events
145145
</h3>
146146
{this.renderEvents(this.state.futureEvents, this.state.futureEventsLoadLimit)}
147-
{this.renderLoadMoreButton(this.state.futureEvents.length, this.state.futureEventsLoadLimit, false)}
147+
{!loading &&
148+
this.renderLoadMoreButton(this.state.futureEvents.length, this.state.futureEventsLoadLimit, false)}
148149
</Box>
149150
</Flex>
150151
<Flex direction="column" align="center" justify="center">
@@ -153,7 +154,8 @@ export default class Events extends React.Component {
153154
Recent Events
154155
</h3>
155156
{this.renderEvents(this.state.pastEvents, this.state.pastEventsLoadLimit)}
156-
{this.renderLoadMoreButton(this.state.pastEvents.length, this.state.pastEventsLoadLimit, true)}
157+
{!loading &&
158+
this.renderLoadMoreButton(this.state.pastEvents.length, this.state.pastEventsLoadLimit, true)}
157159
</Box>
158160
</Flex>
159161
</Container>

yarn.lock

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1046,7 +1046,7 @@ babel-register@^6.26.0:
10461046
mkdirp "^0.5.1"
10471047
source-map-support "^0.4.15"
10481048

1049-
babel-runtime@6.26.0, babel-runtime@^6.18.0, babel-runtime@^6.22.0, babel-runtime@^6.26.0:
1049+
babel-runtime@6.26.0, babel-runtime@^6.18.0, babel-runtime@^6.22.0, babel-runtime@^6.26.0, babel-runtime@^6.6.1:
10501050
version "6.26.0"
10511051
resolved "https://registry.yarnpkg.com/babel-runtime/-/babel-runtime-6.26.0.tgz#965c7058668e82b55d7bfe04ff2337bc8b5647fe"
10521052
dependencies:
@@ -5834,6 +5834,12 @@ rc@~1.1.6:
58345834
minimist "^1.2.0"
58355835
strip-json-comments "~2.0.1"
58365836

5837+
react-content-loader@^1.7.1:
5838+
version "1.7.1"
5839+
resolved "https://registry.yarnpkg.com/react-content-loader/-/react-content-loader-1.7.1.tgz#e6e18adbf632829fd56ba6fe558d16d2a5a00af9"
5840+
dependencies:
5841+
babel-runtime "^6.6.1"
5842+
58375843
react-deep-force-update@^2.1.1:
58385844
version "2.1.1"
58395845
resolved "https://registry.yarnpkg.com/react-deep-force-update/-/react-deep-force-update-2.1.1.tgz#8ea4263cd6455a050b37445b3f08fd839d86e909"

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy