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

New API for Link component #489

Open
vNakamura opened this issue Aug 14, 2018 · 1 comment
Open

New API for Link component #489

vNakamura opened this issue Aug 14, 2018 · 1 comment

Comments

@vNakamura
Copy link
Member

vNakamura commented Aug 14, 2018

The current component uses a type prop to define both the color and the behavior (hover color, underline) of the link.

This is quite confusing and constrains customization. So we should think of a new api that would allow behavior and color to be set independently.

@vNakamura
Copy link
Member Author

My proposition:

Split into multiple props:

  • color
  • hoverColor
  • decoration
  • hoverDecoration

Then, instead of linkTypes constants we have presets, like:

linkPresets = {
  FEATURED: {
    color: colors.INDIGO_MILK_CAP,
    hoverColor: 'inherit',
    decoration: 'none',
    hoverDecoration: 'underline'
  },
  . . .
}

So, we use it like:

<Link href="#" {...linkPresets.FEATURED}>
  Hello
</Link>

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

No branches or pull requests

1 participant