question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Kaizen Component Library is completely unopinionated about link/anchor styles, but it probably should be

See original GitHub issue

Every time you need to render a humble link/anchor in a paragraph or otherwise (which is often), you need to look up the Kaizen docs and Kaizen Design Kit (figma) for the latest design rules and either:

  • write some custom scss
  • or set a global style on the a element within your app

The Kaizen site itself has a custom rule for a: https://github.com/cultureamp/kaizen-design-system/blob/master/site/src/styles/global.scss#L31

This seems like a basic fundamental thing that Kaizen the codebase should provide to consumers in a way that requires little effort. I think a reason we’ve shied away from this is that there are so many different ways we could do it:

  • The Paragraph or Heading components could automatically style children a elements (also suggested in https://github.com/cultureamp/kaizen-design-system/issues/908, a closely related issue)
  • provide a base style sheet with a global rule for the a tag that all Kaizen consumers should include in their build step
  • provide a “link” component (eg: <Link ...> or <Anchor ..>, <A ...>, <Hyperlink ...> or whatever we wanted to call it)
  • provide at least link tokens for colour and underline style in @kaizen/design-tokens (which would make it a “decision token”, something we’ve held off on doing, because the problem space for decision tokens is vast compared to the problem space of option tokens)
  • any other suggestions?

It’s worth pointing out a couple of things from the Kaizen docs and Kit:

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
ActuallyACatcommented, Jun 28, 2021

From where I stand, both the Link component and the default styling of anchor tags within Paragraph components seem like the best approach. Bonus is this makes the design rule of underline text within paragraphs quite clear. We’d need suitable guidance for both approaches though - I can see this as being a gotcha.

I’m very hesitant to add any (more) “decision token” type tokens to design tokens without rethinking tokens… The current setup is optimised for option tokens and it’s missing the ability for token inheritance. E.g. border color (decision token) being derived from ash-300 (option token).

1reaction
mbylstracommented, Jun 25, 2021

That’s a really good consideration about translations. I’ve noticed linguiJS is our least “contained” technology on our list after having issues with i18next and react-intl: https://cultureamp.atlassian.net/wiki/spaces/TV/pages/933429612/Front+End+Technology+List. The current most favored approach seems to be linguiJS (I’m not sure if it’s capable of passing custom components). I wonder if we could do both: provide a <Link> component (favored) but also have the Paragraph style children a tags, for consumers where translation is an issue (I believe react-intl is being used in our product, even though it’s “contained”).

So, you could do either <Paragraph><Link href="xxxx">a link</Link></Paragraph> or <Paragraph><a href="xxxx">a link</link>. I’m not sure if it would be confusing having two different ways to do the same thing.

I also think there’d also be a big benefit in providing the “opens in new tab” tooltip functionality in a link component which is always a pain to do (and comes up a lot). This could look like <Link href="xxxx" opensInNewTab>a link<Link>

Read more comments on GitHub >

github_iconTop Results From Across the Web

Heading and Paragraph components have unexpected link ...
Kaizen Component Library is completely unopinionated about link/anchor styles, but it probably should be #1723. Closed. @github-actions.
Read more >
@kaizen/component-library - npm
Kaizen components live in two places: The core Kaizen component library ( @kaizen/component-library ) Individual draft component packages.
Read more >
Kaizen Design System
Write consistent content in Culture Amp's voice and adhere to our style ... Kaizen's Component Library includes reusable code used to rapidly build...
Read more >
Notes on maintaining an internal React component library
If we must offer an escape hatch for custom style overrides, it's better to expose them as UNSAFE_className and UNSAFE_style . It's not...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found