Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Link component with cloneElement #285

Closed
wants to merge 8 commits into from
Closed

Conversation

haworku
Copy link
Contributor

@haworku haworku commented Jun 26, 2020

Summary

  • Adds new Link component
  • Uses PossibleLinkProps union type.
  • variant prop adjusts styles. Style as button by using variant: 'unstyled' and passing in custom classes

Random learnings about types

  • Typescript doesn't seem to have a straightforward XOR type. Union types are not exclusive
  • Overloads seem to mostly address the issue (errors when expected, though messages can be strange).

Note on broken "visited" storybook example

The "visited" link story example isn't working. I think think is related to #191. Styles aren't being inherited from custom stylesheets.

Related Issues or PRs

How To Test

  • See new Link component stories

@haworku haworku changed the title [feat] Link component feat: Link component Jun 26, 2020
@haworku
Copy link
Contributor Author

haworku commented Jul 7, 2020

I've pushed a new commit of how this could work using cloneElement instead of createElement. This could be a more straightforward way to simply add the styles (props) we want for link. It also keeps prop types contained. Welcome any feedback on this - I'm new to both of these patterns.

@haworku haworku changed the title feat: Link component [WIP] Link component with cloneElement Jul 7, 2020
@haworku haworku mentioned this pull request Jul 7, 2020
@haworku
Copy link
Contributor Author

haworku commented Jul 9, 2020

Closing in favor of #309

@haworku haworku closed this Jul 9, 2020
@haworku haworku deleted the hw-link-component-145 branch July 9, 2020 15:02
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.

[feat] Link Component
1 participant