Skip to content

Commit ca9cfec

Browse files
authored
Merge pull request #82 from Web-Dev-Path/feature/add-nonprofit-homepage
Updated TwoColumn.js (Nonprofit homepage)
2 parents db10136 + f9da396 commit ca9cfec

File tree

5 files changed

+70
-18
lines changed

5 files changed

+70
-18
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
1616

1717
### Added
1818

19-
- add TwoColumn.js component
2019
- add new footer and newsletter components styling
2120

2221
### Fixed
2322

2423
- updated Next.js from 10.0.0 to 12.0.10
2524
- fixed scroll-x added by the layout container, adjust README
25+
- updated TwoColumn.js component with style props

components/ButtonLink.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
import Link from 'next/link';
22

33
export default function ButtonLink(props) {
4-
const { className, link, children } = props;
4+
const { className, link, children, styles } = props;
55
return (
66
<Link href={link}>
7-
<a className={className}>{children}</a>
7+
<a className={className} style={styles}>
8+
{children}
9+
</a>
810
</Link>
911
);
1012
}

components/TwoColumn.js

Lines changed: 46 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,26 +5,58 @@ import buttonStyles from '../styles/ButtonLink.module.scss';
55

66
export default function TwoColumn(props) {
77
// Add rowOrder="row-reverse" prop to the component to reverse its order on desktop
8-
const { image, title, content, rowOrder } = props;
8+
const {
9+
image,
10+
altTag,
11+
title,
12+
content,
13+
rowOrder,
14+
color,
15+
bgColor,
16+
btnColor,
17+
btnBg,
18+
link,
19+
linkText = 'Learn more',
20+
} = props;
21+
22+
const styleProps = {
23+
btn: {
24+
color: btnColor,
25+
backgroundColor: btnBg,
26+
},
27+
container: {
28+
color: color,
29+
backgroundColor: bgColor,
30+
},
31+
};
32+
933
return (
10-
<section className={styles.container}>
34+
<section className={styles.container} style={styleProps.container}>
1135
<div className={styles.inner} style={{ flexDirection: rowOrder }}>
1236
<div className={styles.inner__content}>
13-
<h2 className={styles.title}>{title}</h2>
37+
<h2 className={styles.title} style={{ color: color }}>
38+
{title}
39+
</h2>
1440
<p className={styles.content}>{content}</p>
15-
<ButtonLink link="/about-us" className={buttonStyles.btn}>
16-
Learn more
41+
<ButtonLink
42+
link={link}
43+
className={buttonStyles.btn}
44+
styles={styleProps.btn}
45+
>
46+
{linkText}
1747
</ButtonLink>
1848
</div>
19-
<div className={styles.inner__image}>
20-
<Image
21-
src={image}
22-
alt=""
23-
className={styles.img}
24-
layout="fill"
25-
objectFit="cover"
26-
/>
27-
</div>
49+
{image && (
50+
<div className={styles.inner__image}>
51+
<Image
52+
src={image}
53+
alt={altTag}
54+
className={styles.img}
55+
layout="fill"
56+
objectFit="cover"
57+
/>
58+
</div>
59+
)}
2860
</div>
2961
</section>
3062
);

pages/index.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import Link from 'next/link';
22
import TwoColumn from '../components/TwoColumn';
33
import styles from '../styles/Home.module.scss';
4+
import { white, primary } from '../styles/TwoColumn.module.scss';
45

56
export default function Home() {
67
return (
@@ -18,6 +19,17 @@ export default function Home() {
1819
title="Let's grow together."
1920
image="/images/home-two-column-image.jpg"
2021
content="The Web Dev Path is a team of professional developers project that aims to provide a comprehensive path for people who seek to begin their web development journey. "
22+
link="/about-us"
23+
/>
24+
25+
<TwoColumn
26+
title="Nonprofit?"
27+
content="Web Dev Path can help your nonprofit with web projects of various sizes. Connect with us to find out how."
28+
color={white}
29+
bgColor={primary}
30+
btnColor={primary}
31+
btnBg={white}
32+
link="/about-us"
2133
/>
2234

2335
<hr className={styles.divider} />

styles/TwoColumn.module.scss

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
@use './mixins' as *;
33

44
.container {
5-
background-color: #8cd5e8;
5+
background-color: $light-bg-color;
66

77
.inner {
88
padding: 5rem 0;
@@ -63,3 +63,9 @@
6363
}
6464
}
6565
}
66+
67+
//Exports
68+
:export {
69+
white: $white;
70+
primary: $primary-content-color;
71+
}

0 commit comments

Comments
 (0)