-
-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Missing customRootClass issue #619 #620 #648
Conversation
WalkthroughThe pull request introduces a new optional Changes
Possibly related issues
Possibly related PRs
Poem
Tip CodeRabbit's docstrings feature is now available as part of our Early Access Program! Simply use the command Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (2)
src/components/ui/Code/Code.tsx (2)
9-11
: Add JSDoc documentation for the new prop.Consider adding documentation to explain the purpose and usage of the
customRootClass
prop.export type CodeProps= { children: React.ReactNode; + /** Custom class name to override the root element's default class. + * @example 'my-custom-code-class' + */ customRootClass?: string; }
13-13
: Fix spacing around the assignment operator.Address the ESLint error by adding spaces around the
=
operator.-const Code = ({ children, customRootClass='' }: CodeProps) => { +const Code = ({ children, customRootClass = '' }: CodeProps) => {🧰 Tools
🪛 eslint
[error] 13-13: Operator '=' must be spaced.
(space-infix-ops)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
src/components/ui/Code/Code.tsx
(1 hunks)styles/themes/components/code.scss
(1 hunks)
✅ Files skipped from review due to trivial changes (1)
- styles/themes/components/code.scss
🧰 Additional context used
🪛 eslint
src/components/ui/Code/Code.tsx
[error] 13-13: Operator '=' must be spaced.
(space-infix-ops)
🔇 Additional comments (2)
src/components/ui/Code/Code.tsx (2)
4-6
: LGTM! Clean import and constant declaration.
The new import and constant follow good practices with proper naming conventions.
14-18
: Verify customClassSwitcher implementation and usage.
The implementation looks correct, but let's verify the customClassSwitcher
utility's behavior and its usage across the codebase.
✅ Verification successful
Let me gather more information about the usage patterns with a different approach.
Let me check the actual implementation of the customClassSwitcher function to complete the verification.
customClassSwitcher implementation and usage is correct
The utility is properly implemented and consistently used across the component library. It:
- Returns custom class if provided
- Falls back to generating a standardized class name with 'rad-ui' prefix
- Has proper test coverage
- Is used consistently in all UI components following the same pattern
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Verify customClassSwitcher implementation and usage pattern
# Check customClassSwitcher implementation
echo "Checking customClassSwitcher implementation:"
rg -A 5 "export.*customClassSwitcher"
# Check consistent usage pattern across components
echo "Checking usage pattern across components:"
ast-grep --pattern 'const $rootClass = customClassSwitcher($customClass, $componentName)'
Length of output: 803
Script:
#!/bin/bash
# Search for all customClassSwitcher usages in the codebase
echo "Checking all customClassSwitcher usages:"
rg "customClassSwitcher\(" -A 2
# Check if there are any test files for customClassSwitcher
echo -e "\nChecking for customClassSwitcher tests:"
fd -e test.ts -e test.tsx -e spec.ts -e spec.tsx | xargs rg "customClassSwitcher"
Length of output: 10886
Script:
#!/bin/bash
# Get the implementation of customClassSwitcher
echo "Checking customClassSwitcher implementation:"
cat src/core/customClassSwitcher/index.ts
Length of output: 773
Add the new format customRootClass for code component and fix the inconsistent use of class prefix in code.scss file.
Summary by CodeRabbit
New Features
Style Updates