Skip to content

Use static Tailwind classes for settings code blocks - #1657

Open
skyfallwastaken wants to merge 1 commit into
mainfrom
fix/settings-codeblock-static-classes
Open

skyfallwastaken wants to merge 1 commit into
mainfrom
fix/settings-codeblock-static-classes

Conversation

@skyfallwastaken

Copy link
Copy Markdown
Member

Summary of the problem

The settings code block built its text size as text-${size}. Tailwind cannot detect these dynamic class names, so the generated styles depended on unrelated source files containing each size.

Describe your changes

Map the typed xs and sm size options to static text-xs and text-sm classes so Tailwind discovers both without changing rendered output.

Screenshots / Media

Not applicable. There is no visual change.

Copilot AI lite review requested due to automatic review settings September 1, 2026 02:35
@greptile-apps

greptile-apps Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR replaces a dynamically constructed Tailwind text-size class with a statically discoverable, type-safe class mapping while preserving the existing xs and sm options.

  • Adds a constant mapping from size options to Tailwind utility classes.
  • Derives the size prop type from the mapping keys.
  • Uses the mapped static class when rendering the settings code block.

Confidence Score: 5/5

The PR appears safe to merge with no actionable regressions identified.

The only current caller uses the valid default size, and the static mapping preserves both supported size options while making their Tailwind classes discoverable during compilation.

Important Files Changed

Filename Overview
app/javascript/pages/Users/Settings/components/CodeBlock.svelte Replaces Tailwind-invisible dynamic class construction with equivalent static classes without changing the reachable rendered behavior.

Reviews (1): Last reviewed commit: "Use static classes for settings code blo..." | Re-trigger Greptile

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes Tailwind CSS class discovery for the Settings CodeBlock component by replacing a dynamically constructed text-${size} utility with a static mapping, ensuring the required font-size utilities are always present in the generated CSS.

Changes:

  • Introduced a sizeClasses map from the allowed xs/sm size options to static Tailwind classes (text-xs, text-sm).
  • Updated the prop type for size to be derived from sizeClasses keys to keep types in sync with the mapping.
  • Switched the <pre> class construction to use sizeClasses[size] rather than a dynamic Tailwind class string.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants