Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make CSS classnames logic more readable
Browse files Browse the repository at this point in the history
lyzadanger committed May 19, 2023
1 parent fb6e164 commit cbb35e2
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions src/components/navigation/Link.tsx
Original file line number Diff line number Diff line change
@@ -45,21 +45,20 @@ const Link = function Link({
rel="noopener noreferrer"
{...htmlAttributes}
className={classnames(
{
'focus-visible-ring rounded-sm': styled,
styled && {
'focus-visible-ring rounded-sm': true,
// underline
// TODO: Underline should be controlled by `variant` and should default
// to `always`
'no-underline hover:no-underline': styled && underline === 'none', // default
'underline hover:underline': styled && underline === 'always',
'no-underline hover:underline': styled && underline === 'hover',
'no-underline hover:no-underline': underline === 'none', // default
'underline hover:underline': underline === 'always',
'no-underline hover:underline': underline === 'hover',
},
{
themed && {
// color
'text-brand hover:text-brand-dark': themed && theme === 'brand', // default
'text-color-text-light hover:text-brand':
themed && theme === 'text-light',
'text-color-text hover:text-brand-dark': themed && theme === 'text',
'text-brand hover:text-brand-dark': theme === 'brand', // default
'text-color-text-light hover:text-brand': theme === 'text-light',
'text-color-text hover:text-brand-dark': theme === 'text',
},
classes
)}

0 comments on commit cbb35e2

Please sign in to comment.