Recently I've worked on #987 and I had to join classNames conditionally. I've seen a common use of either or if/else or ternary operator which is definitely ok. However, I would like to suggest the use of classnames utility to make it more readable and easy to write.
there are many repetitions of this pattern during the project, for instance:
https://github.com/nodejs/nodejs.dev/blob/0918208dcfbd8804100841782e448bd14c6dcaf9/src/components/NavigationItem/index.tsx#L20-L25
could be:
javascript classnames('t-body2 side-nav__item', {'side-nav__item--done': isRead, 'side-nav__item--active': isActive})
there are few packages out there, such as: https://www.npmjs.com/package/classnames, https://www.npmjs.com/package/clsx
what do you think?
If it makes the code more readable I'm all for it 馃憤
I would like to open PR with an update to all the necessary places.
Moreover, we may want to pay attention in the next PR to avoid this pattern :)
Go for it +1
Closed via #1038