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

Commit 252861f

Browse files
alexspencerickr
authored andcommitted
Add react scroll to code schools - change imagecard back to space-around. Fixes #111
1 parent 1fe04c5 commit 252861f

6 files changed

Lines changed: 37 additions & 14 deletions

File tree

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"react-modal": "^1.7.7",
2020
"react-router": "^4.1.1",
2121
"react-router-dom": "^4.1.1",
22+
"react-scroll": "^1.5.2",
2223
"react-table": "^6.0.5",
2324
"sinon": "^2.3.2",
2425
"universal-cookie": "^2.0.7"

src/scenes/home/codeSchools/codeSchools.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,24 +50,28 @@ class CodeSchools extends Component {
5050

5151
<div className={styles.filterButtonDiv}>
5252
<LinkButton
53-
link="#approvedSchools"
53+
link="approvedSchools"
5454
text="Code Schools with VA Approval"
5555
theme="blue"
56+
scrollLink
5657
/>
5758
<LinkButton
58-
link="#partnerSchools"
59+
link="partnerSchools"
5960
text="Partner Schools with Scholarships"
6061
theme="blue"
62+
scrollLink
6163
/>
6264
<LinkButton
63-
link="#onlineSchools"
65+
link="onlineSchools"
6466
text="Online Schools"
6567
theme="blue"
68+
scrollLink
6669
/>
6770
<LinkButton
68-
link="#schoolsByState"
71+
link="schoolsByState"
6972
text="Search by State"
7073
theme="blue"
74+
scrollLink
7175
/>
7276
</div>
7377
</Section>

src/shared/components/imageCard/imageCard.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
min-height: 200px;
2929
display: flex;
3030
flex-direction: column;
31-
justify-content: center;
31+
justify-content: space-around;
3232
align-items: center;
3333
}
3434

src/shared/components/linkButton/linkButton.js

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,31 @@
11
import React from 'react';
22
import PropTypes from 'prop-types';
33
import { Link } from 'react-router-dom';
4+
import { Link as ScrollLink } from 'react-scroll';
45
import styles from './linkButton.css';
56

67
const LinkButton = (props) => {
78
const {
89
link,
910
text,
1011
theme,
12+
scrollLink,
1113
...otherProps
1214
} = props;
1315

16+
if (scrollLink) {
17+
return (
18+
<ScrollLink
19+
className={`${styles.linkButton} ${styles[theme]}`}
20+
to={link}
21+
smooth duration={400}
22+
{...otherProps}
23+
>
24+
{text}
25+
</ScrollLink>
26+
);
27+
}
28+
1429
return (
1530
<Link
1631
className={`${styles.linkButton} ${styles[theme]}`}
@@ -25,11 +40,13 @@ const LinkButton = (props) => {
2540
LinkButton.propTypes = {
2641
link: PropTypes.string.isRequired,
2742
text: PropTypes.string.isRequired,
28-
theme: PropTypes.string
43+
theme: PropTypes.string,
44+
scrollLink: PropTypes.bool
2945
};
3046

3147
LinkButton.defaultProps = {
32-
theme: 'blue'
48+
theme: 'blue',
49+
scrollLink: false
3350
};
3451

3552
export default LinkButton;

src/shared/components/section/section.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const Section = (props) => {
2323
});
2424

2525
return (
26-
<div className={classes} {...otherProps} >
26+
<div name={id} className={classes} {...otherProps} >
2727
{title && <Heading text={title} id={id} headingLines={headingLines} theme={headingTheme} />}
2828
{children}
2929
</div>

yarn.lock

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5186,12 +5186,6 @@ postcss-filter-plugins@^2.0.0:
51865186
postcss "^5.0.4"
51875187
uniqid "^4.0.0"
51885188

5189-
postcss-flexbugs-fixes@^3.0.0:
5190-
version "3.0.0"
5191-
resolved "https://registry.yarnpkg.com/postcss-flexbugs-fixes/-/postcss-flexbugs-fixes-3.0.0.tgz#7b31cb6c27d0417a35a67914c295f83c403c7ed4"
5192-
dependencies:
5193-
postcss "^6.0.1"
5194-
51955189
postcss-load-config@^1.0.0, postcss-load-config@^1.x:
51965190
version "1.2.0"
51975191
resolved "https://registry.yarnpkg.com/postcss-load-config/-/postcss-load-config-1.2.0.tgz#539e9afc9ddc8620121ebf9d8c3673e0ce50d28a"
@@ -5755,6 +5749,13 @@ react-router@^4.1.1:
57555749
prop-types "^15.5.4"
57565750
warning "^3.0.0"
57575751

5752+
react-scroll@^1.5.2:
5753+
version "1.5.2"
5754+
resolved "https://registry.yarnpkg.com/react-scroll/-/react-scroll-1.5.2.tgz#f10f14840d3138a121d2c0f04933bbfee4193975"
5755+
dependencies:
5756+
object-assign "^4.1.1"
5757+
prop-types "^15.5.8"
5758+
57585759
react-simple-di@^1.2.0:
57595760
version "1.2.0"
57605761
resolved "https://registry.yarnpkg.com/react-simple-di/-/react-simple-di-1.2.0.tgz#dde0e5bf689f391ef2ab02c9043b213fe239c6d0"

0 commit comments

Comments
 (0)