Skip to content

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#59
dom-kelly wants to merge 9 commits intoNHSDigital:mainfrom
dom-kelly:extend-formgroup-with-textlink

Conversation

@dom-kelly
Copy link

@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 type HTMLAnchorElement.

I've exposed a new type textLink to the FormElementProps interface. 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:

  • There is no text-link component 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.
  • The text-link component is handled via a regular anchor, but it would be preferable to use React Router or similiar.

@dom-kelly dom-kelly closed this Feb 2, 2021
@dom-kelly
Copy link
Author

Different approach concidered.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant