-
Notifications
You must be signed in to change notification settings - Fork 8.4k
fix: loading and spinner style fixed and improved #5588
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
Conversation
|
WalkthroughThis pull request updates three Vue components. The first file adjusts a CSS class in a spinner component to render text in the primary theme color. The other two files in the common UI package introduce new TypeScript interfaces— Changes
Sequence Diagram(s)sequenceDiagram
participant Caller
participant LoadingComp as Loading Component
participant CN as cn Utility
participant VbenLoading as VbenLoading
Caller->>LoadingComp: Pass props (spinning, text, minLoadingTime, class)
LoadingComp->>CN: Compute dynamic class string
CN-->>LoadingComp: Return computed class
LoadingComp->>VbenLoading: Render with updated props
sequenceDiagram
participant Caller
participant SpinnerComp as Spinner Component
participant CN as cn Utility
participant VbenSpinner as VbenSpinner
Caller->>SpinnerComp: Pass props (spinning, minLoadingTime, class)
SpinnerComp->>CN: Compute dynamic class string
CN-->>SpinnerComp: Return computed class
SpinnerComp->>VbenSpinner: Render with updated props
Suggested reviewers
Poem
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 (1)
packages/effects/common-ui/src/components/loading/loading.vue (1)
5-21: Well-structured interface with comprehensive documentation.The
LoadingPropsinterface is well-defined with:
- Optional properties marked with
?- Clear JSDoc comments
- Logical property grouping
However, consider adding English translations for all JSDoc comments to maintain consistency with the
minLoadingTimeproperty:/** * @zh_CN loading状态开启 + * @en_US Enable loading state */ spinning?: boolean; /** * @zh_CN 文字 + * @en_US Loading text */ text?: string;
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
packages/@core/ui-kit/shadcn-ui/src/components/spinner/loading.vue(1 hunks)packages/effects/common-ui/src/components/loading/loading.vue(1 hunks)packages/effects/common-ui/src/components/loading/spinner.vue(1 hunks)
✅ Files skipped from review due to trivial changes (1)
- packages/@core/ui-kit/shadcn-ui/src/components/spinner/loading.vue
⏰ Context from checks skipped due to timeout of 90000ms (8)
- GitHub Check: Test (windows-latest)
- GitHub Check: Lint (windows-latest)
- GitHub Check: post-update (windows-latest)
- GitHub Check: Check (windows-latest)
- GitHub Check: Analyze (javascript-typescript)
- GitHub Check: post-update (ubuntu-latest)
- GitHub Check: Lint (ubuntu-latest)
- GitHub Check: Check (ubuntu-latest)
🔇 Additional comments (7)
packages/effects/common-ui/src/components/loading/spinner.vue (4)
3-3: LGTM! Good use of the shared utility.The
cnutility import from shared utils is a good practice for consistent class name handling across components.
5-16: Well-documented interface with clear type definitions.The
SpinnerPropsinterface is well-structured with:
- Optional properties marked with
?- Clear JSDoc comments in both Chinese and English where applicable
- Logical grouping of related properties
18-18: LGTM! Type-safe props definition.Good use of TypeScript's type inference with
defineProps<SpinnerProps>()for better type safety.
21-26: Verify the minimum height constraint.The template changes look good, but the hardcoded
min-h-20class might be too restrictive for some use cases.Consider making the minimum height configurable through props:
- <div :class="cn('relative min-h-20', props.class)"> + <div :class="cn('relative', props.minHeight ?? 'min-h-20', props.class)">And update the interface:
interface SpinnerProps { class?: string; + minHeight?: string; /**packages/effects/common-ui/src/components/loading/loading.vue (3)
3-3: LGTM! Consistent use of shared utility.The
cnutility import matches the pattern used in spinner.vue, maintaining consistency.
23-24: LGTM! Clean component setup.Good use of
defineOptionsfor component naming and type-safe props definition.
27-38: Consider making the minimum height configurable.Similar to the spinner component, the hardcoded
min-h-20class might be too restrictive.Consider making it configurable through props:
- <div :class="cn('relative min-h-20', props.class)"> + <div :class="cn('relative', props.minHeight ?? 'min-h-20', props.class)">And update the interface:
interface LoadingProps { class?: string; + minHeight?: string; /**
Description
修复loading的文字颜色(跟随主色调),完善loading和spinner的属性定义
Type of change
Please delete options that are not relevant.
pnpm-lock.yamlunless you introduce a new test example.Checklist
pnpm run docs:devcommand.pnpm test.feat:,fix:,perf:,docs:, orchore:.Summary by CodeRabbit