Skip to content

Commit

Permalink
CM-795: Add gatsby-plugin-anchor-links
Browse files Browse the repository at this point in the history
  • Loading branch information
ayumi-oxd committed Jul 19, 2023
1 parent 08f540b commit 2c2a29f
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 7 deletions.
6 changes: 6 additions & 0 deletions src/gatsby/gatsby-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,5 +169,11 @@ module.exports = {
},
},
},
{
resolve: "gatsby-plugin-anchor-links",
options: {
offset: -100,
}
}
],
}
30 changes: 30 additions & 0 deletions src/gatsby/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/gatsby/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"cheerio": "^1.0.0-rc.12",
"date-fns": "^2.28.0",
"gatsby": "^5.11.0",
"gatsby-plugin-anchor-links": "^1.2.1",
"gatsby-plugin-canonical-urls": "^5.11.0",
"gatsby-plugin-emotion": "^8.11.0",
"gatsby-plugin-image": "^3.11.0",
Expand Down
7 changes: 4 additions & 3 deletions src/gatsby/src/components/park/parkAccessStatus.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import React from "react"
import PropTypes from "prop-types"
import { graphql, useStaticQuery, Link } from "gatsby"
import { graphql, useStaticQuery } from "gatsby"
import { Card, CardHeader, Avatar } from "@mui/material"
import { styled } from '@mui/material/styles';
import { AnchorLink } from "gatsby-plugin-anchor-links";

import blueStatusIcon from "../../images/park/blue-status-64.png"
import redStatusIcon from "../../images/park/red-status-64.png"
Expand Down Expand Up @@ -119,7 +120,7 @@ export default function ParkAccessStatus({ advisories, slug }) {
title={parkStatusText}
/>
) : (
<Link to={`/${slug}/#park-advisory-details-container`}>
<AnchorLink to={`/${slug}/#park-advisory-details-container`}>
<CardHeader
className="access-icon"
avatar={
Expand All @@ -133,7 +134,7 @@ export default function ParkAccessStatus({ advisories, slug }) {
}
title={parkStatusText}
/>
</Link>
</AnchorLink>
)}
</StyledCard>
)
Expand Down
9 changes: 5 additions & 4 deletions src/gatsby/src/pages/find-a-park.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ import campfireBanIcon from "../../static/icons/campfire-ban.svg"

import "../styles/search.scss"
import { addSmallImagePrefix, handleImgError } from "../utils/helpers";
import { AnchorLink } from "gatsby-plugin-anchor-links";

export const query = graphql`
{
Expand Down Expand Up @@ -1001,9 +1002,9 @@ export default function FindAPark({ location, data }) {
<Icon src={petsIcon} label="Pets on leash" size={iconSize} />
}
{(r.parkActivities.length > 0 || r.parkFacilities.length > 0) &&
<Link href={`/${r.slug}/#park-camping-details-container`}>
<AnchorLink to={`/${r.slug}/#park-camping-details-container`}>
<p aria-label="See all facilities and activities">see all</p>
</Link>
</AnchorLink>
}
</div>
<div className="park-content-bottom--right text-blue">
Expand Down Expand Up @@ -1129,9 +1130,9 @@ export default function FindAPark({ location, data }) {
<Icon src={petsIcon} label="Pets on leash" size={iconSize} />
}
{(r.parkActivities.length > 0 || r.parkFacilities.length > 0) &&
<Link href={`/${r.slug}/#park-camping-details-container`}>
<AnchorLink to={`/${r.slug}/#park-camping-details-container`}>
<p aria-label="See all facilities and activities">see all</p>
</Link>
</AnchorLink>
}
</div>
<div className="text-blue">
Expand Down

0 comments on commit 2c2a29f

Please sign in to comment.