refactor(ui): use design-system cn for all conditional classNames#6642
Conversation
|
Claude finished @luizhf42's task in 4m 19s —— View job Code Review CompleteReviewed 91 files across code quality, security, testing, language patterns, and architecture. This is a well-executed, near-mechanical migration to the shared 1 inline issue posted (1 high). Finding
NoteVerified both new import specifiers resolve: If you've addressed the feedback and want a new review, tag |
Replace ad-hoc conditional class construction patterns with the
design-system's `cn()` utility (`clsx` + `tailwind-merge`), which
handles falsy values natively and resolves Tailwind class conflicts
deterministically.
Migrated patterns:
- template literal ternaries (`\`base ${cond ? "a" : "b"}\``)
- `[...].filter(Boolean).join(" ")`
- `[...].join(" ")`
- local naive `cn` in `utils/cn.ts` (deleted)
Complex multi-condition expressions are extracted into named
variables for readability; simple single-ternary cases stay inline.
9c8dce1 to
2fdb415
Compare
|
/review |
|
/review |
|
Claude finished @otavio's task in 8m 52s —— View job Code Review CompleteReviewed 90 files across code quality, security, testing, language patterns, and architecture — no new issues found. The code looks good as-is. This is a clean, near-mechanical migration to the shared
If you push additional changes and want a new review, tag |

What
Consolidated all conditional
classNameconstruction across console, website, and the design-system package to use the sharedcn()utility (clsx+tailwind-merge), replacing ad-hoc patterns that lacked Tailwind class conflict resolution.Why
The codebase had four competing patterns for conditional classes: template literal ternaries,
[...].filter(Boolean).join(" "), bare.join(" "), and a local naivecninutils/cn.tsthat only concatenated strings withouttailwind-merge. Conflicting Tailwind classes (e.g.text-smoverridden bytext-xs) were resolved by CSS source order rather than deterministically. The design-system already exported a propercn()backed byclsx+tailwind-merge— it just wasn't used outside the DS primitives.Changes
apps/console/src/utils/cn.ts: deleted. Its sole consumer (DataTable.tsx) now imports from@shellhub/design-system/cnpackages/design-system/components/Reveal.tsx,ShimmerCard.tsx: migrated from template literal class concatenation to their own package'scnclassName={\...`}with interpolation converted tocn(). Empty-string ternary branches (cond ? "x" : "") simplified tocond && "x"`. Complex multi-condition expressions extracted into named variables for readabilitySupportedPlatforms.tsxintentionally skipped — uses dynamic class construction (bg-${p.color}/10) which is a separate issueTesting
tsc --noEmitpasses for console, website, and design-systemnpm run build(console) passes cleannpm run lintpasses with 0 errors on both apps (pre-existing warnings only)filter(Boolean).join,@/utils/cnimports, or template literalclassNamepatterns (exceptSupportedPlatforms.tsx)