Fixed textarea width regression in spam filters settings#26532
Fixed textarea width regression in spam filters settings#26532minimaluminium merged 2 commits intomainfrom
Conversation
fixes https://linear.app/ghost/issue/DES-1298 The TextArea component was missing w-full classes on both the wrapper div and the textarea element itself, causing it not to stretch to full width in flex containers. This is now consistent with the TextField component. Slack thread: https://ghost.slack.com/archives/C019B1K4FAM/p1771816644361159?thread_ts=1771688471.127429&cid=C019B1K4FAM https://claude.ai/code/session_01ByHJQL76bLHXq8mY3VHK46
|
No actionable comments were generated in the recent review. 🎉 WalkthroughThe textarea component's class string was updated to include 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
apps/admin-x-design-system/src/global/form/text-area.tsx (1)
57-63: Usetailwind-mergeto prevent silent Tailwind class conflicts when custom widths or other utilities are passed viaclassName.
className(line 62) is passed directly toclsxafterw-full. Sinceclsxperforms no deduplication of conflicting Tailwind utilities, a caller passing e.g.className="w-1/2"produces bothw-full w-1/2in the DOM — which one wins is determined by stylesheet order, not the class attribute, causing unpredictable results.♻️ Replace `clsx` with `tailwind-merge` to resolve Tailwind class conflicts
-import clsx from 'clsx'; +import {twMerge} from 'tailwind-merge'; +import clsx from 'clsx'; + +// or, if the project establishes a `cn` helper: +// import cn from '../../utils/cn';Then replace:
- let styles = clsx( + let styles = twMerge(clsx( 'order-2 w-full rounded-lg border bg-grey-150 px-3 py-2 transition-all dark:bg-grey-900 dark:text-white', error ? 'border-red bg-white' : 'border-transparent ...', title && 'mt-1.5', fontStyle === 'mono' && 'font-mono text-sm', className - ); + ));This ensures consumer-provided widths (or other utilities) cleanly override the defaults.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@apps/admin-x-design-system/src/global/form/text-area.tsx` around lines 57 - 63, Replace the plain clsx usage with tailwind-merge to prevent silent Tailwind utility conflicts: import twMerge from 'tailwind-merge' and wrap the computed class string so consumer-provided utilities in className (e.g., widths like "w-1/2") will correctly override the defaults; update the styles assignment around the existing clsx(...) expression (reference: the styles variable where clsx is called and the className parameter passed into it) to pass the combined classes through twMerge before using them.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@apps/admin-x-design-system/src/global/form/text-area.tsx`:
- Around line 57-63: Replace the plain clsx usage with tailwind-merge to prevent
silent Tailwind utility conflicts: import twMerge from 'tailwind-merge' and wrap
the computed class string so consumer-provided utilities in className (e.g.,
widths like "w-1/2") will correctly override the defaults; update the styles
assignment around the existing clsx(...) expression (reference: the styles
variable where clsx is called and the className parameter passed into it) to
pass the combined classes through twMerge before using them.
The global textarea rule in ghost.css sets max-width: 500px which was preventing the TextArea from stretching to full width. Also removed unnecessary w-full from the wrapper div.
ref https://linear.app/ghost/issue/DES-1298
The global textarea rule in ghost.css sets
max-width: 500px, which prevented the TextArea component from stretching to full width. Addedmax-w-noneto override this constraint.