Skip to content

Commit f204eb6

Browse files
authored
Merge pull request #3713 from Vizzuality/feature/sgf-about-anchors
Added anchor links to sections in SGF About tab
2 parents 0c88ad9 + 458bd8c commit f204eb6

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

app/javascript/pages/sgf/section-about/section-about-component.jsx

+13-3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import React, { PureComponent } from 'react';
22
import PropTypes from 'prop-types';
33

44
import Icon from 'components/ui/icon';
5+
import ScrollTo from 'components/scroll-to';
56

67
import sgfLogo from './img/GFW_SGF_logo.png';
78
import techLogo from './img/GFW_TECH_logo.png';
@@ -12,12 +13,18 @@ class SectionAbout extends PureComponent {
1213
// eslint-disable-line react/prefer-stateless-function
1314
render() {
1415
const { results, sgfBenefits, fellowshipBenefits } = this.props;
16+
const anchorId = window.location.hash;
17+
const anchor =
18+
anchorId && document.getElementById(anchorId.replace('#', ''));
19+
1520
return (
1621
<div className="l-section-about">
1722
<section className="intro">
1823
<div className="row intro">
1924
<div className="column small-12 medium-9">
20-
<h2 className="section-title">Small Grants Fund</h2>
25+
<h2 className="section-title" id="small-grants-fund">
26+
Small Grants Fund
27+
</h2>
2128
<p className="text -paragraph -color-2 -light -spaced">
2229
Civil Society Organizations operating in and around forested
2330
areas are some of the most effective champions of forest
@@ -84,7 +91,9 @@ class SectionAbout extends PureComponent {
8491
<section className="intro">
8592
<div className="row intro">
8693
<div className="column small-12 medium-9">
87-
<h2 className="section-title">Tech Fellowship</h2>
94+
<h2 className="section-title" id="tech-fellowship">
95+
Tech Fellowship
96+
</h2>
8897
<p className="text -paragraph -color-2 -light -spaced">
8998
The Global Forest Watch Technology Fellowship aims to recruit
9099
and train the best and brightest forest managers, protectors and
@@ -127,7 +136,7 @@ class SectionAbout extends PureComponent {
127136
<section className="support">
128137
<div className="row">
129138
<div className="column small-12 medium-9">
130-
<h2 className="section-title">
139+
<h2 className="section-title" id="support">
131140
Support the Small Grants Fund and Fellowship
132141
</h2>
133142
<p className="text -paragraph -color-2 -light -spaced">
@@ -144,6 +153,7 @@ class SectionAbout extends PureComponent {
144153
</div>
145154
</div>
146155
</section>
156+
{anchor && <ScrollTo target={anchor} />}
147157
</div>
148158
);
149159
}

0 commit comments

Comments
 (0)