This repository has been archived by the owner on Dec 7, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add previously selected with "Change" link
If previously selected is specified then the value will be displayed with a "Change" link. This is ideal for a multi step process when a user may select a country before using entity search. If they decide the country is wrong then they can jump back to the step to change it.
- Loading branch information
Showing
6 changed files
with
456 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import React from 'react' | ||
import PropTypes from 'prop-types' | ||
import { Link } from 'govuk-react' | ||
import styled from 'styled-components' | ||
import { SPACING } from '@govuk-react/constants' | ||
|
||
const StyledLink = styled(Link)` | ||
margin-left: ${SPACING.SCALE_2}; | ||
` | ||
|
||
const PreviouslySelected = ({ text, onChangeClick }) => { | ||
const onClick = (e) => { | ||
e.preventDefault() | ||
onChangeClick() | ||
} | ||
|
||
return ( | ||
<p> | ||
{text} | ||
<StyledLink href="#previously-selected" onClick={onClick}>Change</StyledLink> | ||
</p> | ||
) | ||
} | ||
|
||
PreviouslySelected.propTypes = { | ||
text: PropTypes.string.isRequired, | ||
onChangeClick: PropTypes.func.isRequired, | ||
} | ||
|
||
export default PreviouslySelected |
Oops, something went wrong.