-
Notifications
You must be signed in to change notification settings - Fork 25
Waypoint Component
Richard Davis edited this page Aug 23, 2020
·
3 revisions
<ConnectedWaypoint />
updates store.router.location.hash
(the URL
#fragment
) with the id of the HTML element, when it is 90% of the height from
the bottom of the browser window.
The history
API methods provided by connected-react-router
are: push
,
replace
, go
, goBack
, goForward
. It is important to use replace
in this
instance, since we are updating the URL to reflect navigating to a section of
a page, and not navigating to another page.
import React, { Fragment } from 'react';
import { connect } from 'react-redux';
import { Waypoint } from 'react-waypoint';
import { replace as actualReplace } from 'connected-react-router';
const ConnectedWaypoint = ({ children, id, location, replace }) => (
<Fragment>
<Waypoint
bottomOffset="90%"
fireOnRapidScroll={false}
onEnter={() => replace({ ...location, hash: id })} />
{children}
</Fragment>
);
const mapStateToProps = ({ router }) => ({
location: router.location
});
const mapDispatchToProps = {
replace: actualReplace
};
export default connect(
mapStateToProps,
mapDispatchToProps
)(ConnectedWaypoint);
Scrolling to the <Waypoint id="prev-activities-table" />
component triggers
the onEnter
function, which updates store.rouer.location.hash
.
- Team Working Agreement
- Team composition
- Workflows and processes
- Testing and bug filing
- Accessing eAPD
- Active Documentation:
- Sandbox Environment
- Glossary of acronyms
- APDs 101
- Design iterations archive
- MMIS Budget calculations
- HITECH Budget calculations
- Beyond the APD: From Paper to Pixels
- UX principles
- User research process
- Visual styling
- Content guide
- User research findings
- eAPD pilot findings
- User needs
- Developer info
- Development environment
- Coding Standards
- Development deployment
- Infrastructure Architecture
- Code Architecture
- Tech 101
- Authentication
- APD Auto Saving Process
- Resetting an Environment
- Hardware Software List
- Deploying Staging Production Instances Using Scripts
- Terraform 101 for eAPD
- Provisioning Infrastructure with Terraform
- WebSocket basics
- Operations-and-Support-Index
- Single Branch Deployment Strategy
- Ops and Support Overview
- Service Level AOI
- Incident Response Plan
- On-Call Policy
- Infrastructure Contingency Plan
- Updating CloudFront Security Headers
- Requesting and Installing TLS Certificates