Skip to content

Commit 827ad4f

Browse files
Adjust ButtonLink to allow links open new tab
1 parent 0febe4a commit 827ad4f

File tree

4 files changed

+27
-30
lines changed

4 files changed

+27
-30
lines changed

components/buttons/ButtonLink.js

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,24 @@
1-
import Link from 'next/link';
21
import btnStyles from '@/styles/ButtonLink.module.scss';
32

3+
/* The component supports the use of target with the property "openNewTab" to open the
4+
link in a new tab.*/
5+
46
export default function ButtonLink({
57
customClassName,
68
link,
79
children,
810
styles,
11+
openNewTab,
912
}) {
1013
return (
11-
<Link href={link}>
12-
<a
13-
className={`${btnStyles.btn} ${btnStyles[customClassName]}`}
14-
style={styles}
15-
>
16-
{children}
17-
</a>
18-
</Link>
14+
<a
15+
href={link}
16+
className={`${btnStyles.btn} ${btnStyles[customClassName]}`}
17+
style={styles}
18+
target={openNewTab ? '_blank' : undefined}
19+
rel='noopener noreferrer'
20+
>
21+
{children}
22+
</a>
1923
);
2024
}

components/containers/TwoColumn.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ export default function TwoColumn({
1515
customInnerClass,
1616
customBtnClass,
1717
linkText = 'Learn more',
18-
secondTextColumn
18+
secondTextColumn,
19+
openNewTab,
1920
}) {
2021
// Add rowOrder="row-reverse" prop to the component to reverse its order on desktop
2122

@@ -44,7 +45,11 @@ export default function TwoColumn({
4445
)}
4546
<div className={styles.content}>{content}</div>
4647
{link && (
47-
<ButtonLink link={link} customClassName={customBtnClass}>
48+
<ButtonLink
49+
link={link}
50+
customClassName={customBtnClass}
51+
openNewTab={openNewTab}
52+
>
4853
{linkText}
4954
</ButtonLink>
5055
)}
@@ -57,7 +62,6 @@ export default function TwoColumn({
5762
alt={altTag}
5863
className={styles.img}
5964
layout='fill'
60-
priority
6165
/>
6266
</div>
6367
)}

pages/about.js

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -136,46 +136,36 @@ export default function AboutUs() {
136136
<TwoColumn
137137
title='Wanna learn more?'
138138
content={''}
139-
rowOrder='row'
140139
image='/images/svg/close-curly-bracket.svg'
141140
color={primary}
142141
bgColor={lightBgColor}
143142
customInnerClass='wanna-learn-more'
144143
/>
145144
<TwoColumn
146-
title={
147-
<div>
148-
Junior <br /> Developers
149-
</div>
150-
}
145+
title={<div>Junior Developers</div>}
151146
content={
152147
'If you are a junior web developer looking for some guidance and mentoring, ' +
153148
'we invite you to join us and start coding our platform. ' +
154149
"You will learn how to code in a team environment by following issue's " +
155150
'instructions and submitting your code to our repository through a ' +
156151
'PR while guided throughout the entire process.\n'
157152
}
158-
rowOrder='row'
159153
linkText='Our wiki'
154+
openNewTab
160155
link='https://github.com/Web-Dev-Path/web-dev-path/wiki'
161156
customBtnClass='inverted-grey'
162157
color={primary}
163158
bgColor={lightBgColor}
164159
customInnerClass='two-text-columns'
165160
secondTextColumn={
166161
<TwoColumn
167-
title={
168-
<div>
169-
Experienced <br /> Developers
170-
</div>
171-
}
162+
title={<div>Experienced Developers</div>}
172163
content={
173164
'If you are an experienced and patient-loving developer, ' +
174165
'a true rockstar who wants to mentor juniors, ' +
175166
"it will be wonderful to have your help to review those PR's, " +
176167
'write detailed issues and guide the developers when necessary.\n'
177168
}
178-
rowOrder='row'
179169
linkText='Contact us'
180170
link='/contact'
181171
customBtnClass='inverted-grey'

styles/TwoColumn.module.scss

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@
122122
margin: 0;
123123
}
124124

125-
.inner__content{
125+
.inner__content {
126126
flex-basis: 70%;
127127
}
128128

@@ -141,8 +141,7 @@
141141
}
142142

143143
&.two-text-columns {
144-
justify-content: center;
145-
gap: 170px;
144+
justify-content: space-evenly;
146145

147146
.inner {
148147
padding: 0px;
@@ -160,7 +159,7 @@
160159
line-height: 2.5rem;
161160
}
162161

163-
.inner{
162+
.inner {
164163
margin: 0px;
165164
padding: 0px;
166165
}
@@ -169,7 +168,7 @@
169168
flex-basis: unset;
170169

171170
@include desktop {
172-
width: 400px;
171+
width: 25rem;
173172
}
174173
}
175174

0 commit comments

Comments
 (0)