Extend formgroup with textlink#59
Closed
dom-kelly wants to merge 9 commits intoNHSDigital:mainfrom
dom-kelly:extend-formgroup-with-textlink
Closed
Extend formgroup with textlink#59dom-kelly wants to merge 9 commits intoNHSDigital:mainfrom dom-kelly:extend-formgroup-with-textlink
dom-kelly wants to merge 9 commits intoNHSDigital:mainfrom
dom-kelly:extend-formgroup-with-textlink
Conversation
Author
|
Different approach concidered. |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
@Tomdango @kevinkuszyk
Here's a proposed solution to this PR:
I've extended the base FormGroup Util to handle an additional and optional prop
TextLink, which in itself is a new component of typeHTMLAnchorElement.I've exposed a new type
textLinkto theFormElementPropsinterface. In theory, all components that inherit a FormGroup will have the new functionality, although I've not tested this at present.<Input id="input-example-with-link" name="test-name-1111" label="Link with text" textLink={{ href: 'http://www.google.com', title: 'Don\'t know the Question Name?' }} />All Storybooks and tests are present.
A couple of caveats with this proposition:
text-linkcomponent in the nhsuk-frontend repo, which means there are no styles for it. Arguably a text link is too basic to be included. In which case, the text-link component could be localised.text-linkcomponent is handled via a regular anchor, but it would be preferable to use React Router or similiar.