Skip to content
This repository was archived by the owner on Apr 11, 2019. It is now read-only.

Commit 148b765

Browse files
committed
Feat: update old failing packages
- Remove dependency to grommet-udacity - Refactor components to use flow and stateless functions - update failing tests and test suite - Fix eslint issue with component / container imports
1 parent c11bc04 commit 148b765

File tree

19 files changed

+500
-541
lines changed

19 files changed

+500
-541
lines changed

.flowconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ suppress_comment=.*\\$FlowFixMe
1616
suppress_comment=.*\\$FlowInvalidInputTest
1717
module.name_mapper='\(react-redux\)' -> '<PROJECT_ROOT>/config/flow-typed/GeneralStub.js'
1818
module.name_mapper='\(redux\)' -> '<PROJECT_ROOT>/config/flow-typed/GeneralStub.js'
19-
module.name_mapper='.*\(.scss\|.png\)' -> '<PROJECT_ROOT>/config/flow-typed/GeneralStub.js'
19+
module.name_mapper='.*\(.scss\|.png\|.md\)' -> '<PROJECT_ROOT>/config/flow-typed/GeneralStub.js'
2020
module.name_mapper='^containers\/\(.*\)$' -> '<PROJECT_ROOT>/app/src/containers/\1'
2121
module.name_mapper='^containers$' -> '<PROJECT_ROOT>/app/src/containers'
2222
module.name_mapper='^components\/\(.*\)$' -> '<PROJECT_ROOT>/app/src/components/\1'

app/src/components/About/index.js

Lines changed: 45 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// @flow
12
import React, { PropTypes } from 'react';
23
import Box from 'grommet/components/Box';
34
import Paragraph from 'grommet/components/Paragraph';
@@ -11,52 +12,49 @@ import Anchor from 'grommet/components/Anchor';
1112
import { Divider } from 'components';
1213
import readme from './_readme.md';
1314

14-
const About = ({
15-
links,
16-
}) => (
17-
<Box align="center">
18-
<Article align="center" className="panel" pad="large">
19-
<Section align="center" justify="center">
20-
<Heading>
21-
Scalable React Boilerplate
22-
</Heading>
23-
<Divider />
24-
</Section>
25-
<Section align="center" justify="center">
26-
<Paragraph>
27-
This project was created to give the Udacity Alumni development team an
28-
incredibly optimized and easy to use React starter project. Included
29-
below is the documentation for the project.
30-
</Paragraph>
31-
<Heading tag="h4" align="center">
32-
Since making this boilerplate, it has been used in dozens of projects.
33-
</Heading>
34-
<Box align="center" pad="medium">
35-
<List>
36-
{links.map((link, i) =>
37-
<ListItem key={i}>
38-
<Anchor href={link.url}>
39-
{link.name}
40-
</Anchor>
41-
</ListItem>,
42-
)}
43-
</List>
44-
</Box>
45-
</Section>
46-
{typeof readme === 'string' &&
47-
<Markdown content={readme} />
48-
}
49-
</Article>
50-
</Box>
51-
);
52-
53-
About.propTypes = {
54-
links: PropTypes.arrayOf(
55-
PropTypes.shape({
56-
name: PropTypes.string.isRequired,
57-
url: PropTypes.string.isRequired,
58-
}),
59-
),
15+
type AboutLink = {
16+
name: string,
17+
url: string
6018
};
6119

62-
export default About;
20+
export default function About(props: {
21+
links: AboutLink[],
22+
}) {
23+
const { links } = props;
24+
return (
25+
<Box align="center">
26+
<Article align="center" className="panel" pad="large">
27+
<Section align="center" justify="center">
28+
<Heading>
29+
Scalable React Boilerplate
30+
</Heading>
31+
<Divider />
32+
</Section>
33+
<Section align="center" justify="center">
34+
<Paragraph>
35+
This project was created to give the Udacity Alumni development team an
36+
incredibly optimized and easy to use React starter project. Included
37+
below is the documentation for the project.
38+
</Paragraph>
39+
<Heading tag="h4" align="center">
40+
Since making this boilerplate, it has been used in dozens of projects.
41+
</Heading>
42+
<Box align="center" pad="medium">
43+
<List>
44+
{links && links.map((link, i) =>
45+
<ListItem key={i}>
46+
<Anchor href={link.url}>
47+
{link.name}
48+
</Anchor>
49+
</ListItem>,
50+
)}
51+
</List>
52+
</Box>
53+
</Section>
54+
{typeof readme === 'string' &&
55+
<Markdown content={readme} />
56+
}
57+
</Article>
58+
</Box>
59+
);
60+
};

app/src/components/About/tests/__snapshots__/index.test.js.snap

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ exports[`<About /> should render with default props 1`] = `
2424
tag="h1">
2525
Scalable React Boilerplate
2626
</Heading>
27-
<undefined />
27+
<Divider />
2828
</Section>
2929
<Section
3030
align="center"
@@ -65,6 +65,7 @@ exports[`<About /> should render with default props 1`] = `
6565
separator="bottom">
6666
<Anchor
6767
href="https://github.com/udacityalumni/alumni-client"
68+
method="push"
6869
tag="a">
6970
Udacity Alumni Web App
7071
</Anchor>
@@ -82,6 +83,7 @@ exports[`<About /> should render with default props 1`] = `
8283
separator="bottom">
8384
<Anchor
8485
href="https://github.com/RyanCCollins/react-weekly"
86+
method="push"
8587
tag="a">
8688
React Weekly
8789
</Anchor>

app/src/components/AppFooter/tests/__snapshots__/index.test.js.snap

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
exports[`<AppFooter /> should render with default props 1`] = `
22
<Footer
3+
align="center"
34
colorIndex="light-2"
45
direction="row"
56
pad="large"
@@ -35,6 +36,7 @@ exports[`<AppFooter /> should render with default props 1`] = `
3536
<br />
3637
<Anchor
3738
href="https://github.com/RyanCCollins/ryancollinsio"
39+
method="push"
3840
tag="a">
3941
source code.
4042
</Anchor>

app/src/components/Avatar/index.js

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,21 @@
1+
// @flow
12
import React, { PropTypes } from 'react';
23
import cssModules from 'react-css-modules';
34
import styles from './index.module.scss';
4-
55
const defaultAvatarUrl = 'https://github.com/RyanCCollins/cdn/blob/master/alumni-webapp/no-user.png?raw=true';
66

7-
const Avatar = ({
8-
src,
9-
}) => (
10-
<img
11-
alt="Avatar"
12-
src={src || defaultAvatarUrl}
13-
className={styles.avatar}
14-
/>
15-
);
16-
17-
Avatar.propTypes = {
18-
src: PropTypes.string.isRequired,
19-
};
20-
21-
Avatar.defaultProps = {
22-
src: defaultAvatarUrl,
7+
function Avatar(props: {
8+
src?: ?string,
9+
}) {
10+
const { src } = props;
11+
const imageSrc = src || defaultAvatarUrl;
12+
return (
13+
<img
14+
alt="Avatar"
15+
src={imageSrc}
16+
className={styles.avatar}
17+
/>
18+
)
2319
};
2420

2521
export default cssModules(Avatar, styles);
Lines changed: 32 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* @flow */
12
import React, { PropTypes } from 'react';
23
import { Avatar } from 'components';
34
import cssModules from 'react-css-modules';
@@ -8,38 +9,38 @@ import Anchor from 'grommet/components/Anchor';
89
import SocialGithubIcon from 'grommet/components/icons/base/SocialGithub';
910
import styles from './index.module.scss';
1011

11-
const Contributor = ({
12-
person,
13-
}) => (
14-
<Box
15-
className={styles.contributor}
16-
align="center"
17-
justify="center"
18-
size="large"
19-
>
20-
<Avatar src={person.avatar} />
21-
<Heading tag="h3" align="center">
22-
{person.name}
23-
</Heading>
24-
<Paragraph>
25-
{`${person.bio.slice(0, 300)}`}
26-
</Paragraph>
27-
<Anchor
28-
icon={<SocialGithubIcon />}
29-
href={`https://github.com/${person.github}`}
30-
primary
12+
function Contributor(props: {
13+
person: {
14+
github: string,
15+
avatar: string,
16+
name: string,
17+
bio: string,
18+
},
19+
}) {
20+
const { person } = props;
21+
return (
22+
<Box
23+
className={styles.contributor}
24+
align="center"
25+
justify="center"
26+
size="large"
3127
>
32-
{person.github}
33-
</Anchor>
34-
</Box>
35-
);
36-
37-
Contributor.propTypes = {
38-
person: PropTypes.shape({
39-
name: PropTypes.string.isRequired,
40-
avatar: PropTypes.string.isRequired,
41-
bio: PropTypes.string.isRequired,
42-
}),
28+
<Avatar src={person.avatar} />
29+
<Heading tag="h3" align="center">
30+
{person.name}
31+
</Heading>
32+
<Paragraph>
33+
{`${person.bio.slice(0, 300)}`}
34+
</Paragraph>
35+
<Anchor
36+
icon={<SocialGithubIcon />}
37+
href={`https://github.com/${person.github}`}
38+
primary
39+
>
40+
{person.github}
41+
</Anchor>
42+
</Box>
43+
)
4344
};
4445

4546
export default cssModules(Contributor, styles);

app/src/components/Contributor/tests/__snapshots__/index.test.js.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ exports[`<Contributor /> should render with default props 1`] = `
99
responsive={true}
1010
size="large"
1111
tag="div">
12-
<undefined
12+
<Avatar
1313
src="https://avatars.githubusercontent.com/u/13810084?v=3" />
1414
<Heading
1515
align="center"
@@ -23,9 +23,9 @@ exports[`<Contributor /> should render with default props 1`] = `
2323
href="https://github.com/ryanccollins"
2424
icon={
2525
<SocialGithub
26-
a11yTitleId="social-github-title"
2726
responsive={true} />
2827
}
28+
method="push"
2929
primary={true}
3030
tag="a">
3131
ryanccollins

app/src/components/Divider/index.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,4 @@ const Divider = () => (
66
<span className={styles.divider} />
77
);
88

9-
109
export default cssModules(Divider, styles);

app/src/components/LoadingIndicator/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import styles from './index.module.scss';
88

99
function LoadingIndicator(props: {
1010
isLoading: boolean,
11-
message: string
11+
message: ?string
1212
}) {
1313
const { message, isLoading } = props;
1414
const title = message || 'Loading';

app/src/components/Navbar/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export default function Navbar(props: {
1313
const { pathname } = props;
1414
return (
1515
<div>
16-
<Header justify="between">
16+
<Header justify="between" colorIndex="neutral">
1717
<Title>
1818
{typeof window !== 'undefined' ?
1919
<StyledLogo src={LogoImage} alt="logo" />

0 commit comments

Comments
 (0)