fix(upload): add the "relative" style to the root node of "upload"#3409
fix(upload): add the "relative" style to the root node of "upload"#3409
Conversation
WalkthroughA conditional CSS class Changes
Poem
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
packages/vue/src/upload/src/mobile-first.vueOops! Something went wrong! :( ESLint: 8.57.1 ESLint couldn't find the plugin "eslint-plugin-vue". (The package "eslint-plugin-vue" was not found when loaded as a Node module from the directory "".) It's likely that the plugin isn't installed correctly. Try reinstalling by running the following: The plugin "eslint-plugin-vue" was referenced from the config file in ".eslintrc.js » @antfu/eslint-config » @antfu/eslint-config-vue". If you still can't figure out the problem, please stop by https://eslint.org/chat/help to chat with the team. Tip ⚡️ Faster reviews with caching
Enjoy the performance boost—your workflow just got faster. 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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. 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 (
|
WalkthroughThis pull request addresses an issue in the upload component by adding the "relative" style to the root node. This change prevents the SVG for adding files from drifting to the top of the page. Changes
|
| class={[ | ||
| !displayOnly && listType === 'text' | ||
| ? `flex mt-4 mb-2 ${isBubbleMode ? 'sm:my-0' : !isShowTitle ? 'sm:mt-0' : 'sm:my-3'}` | ||
| ? `flex mt-4 relative mb-2 ${isBubbleMode ? 'sm:my-0' : !isShowTitle ? 'sm:mt-0' : 'sm:my-3'}` |
There was a problem hiding this comment.
The addition of relative to the class list is a crucial fix to prevent the SVG from drifting to the top of the page. Ensure this change does not affect other layout aspects of the component.
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
packages/vue/src/upload/src/mobile-first.vue (1)
113-118: Suggest using Vue’s class binding for clarity
Embedding a long ternary inside a string template can become hard to maintain. Consider refactoring to Vue’s object or array class syntax to separate the static, conditional, and responsive classes. For example:- class={[ - !displayOnly && listType === 'text' - ? `flex mt-4 relative mb-2 ${isBubbleMode ? 'sm:my-0' : !isShowTitle ? 'sm:mt-0' : 'sm:my-3'}` - : 'h-full', - showFileList ? 'sm:mb-3' : 'sm:mb-0' - ]} + class={{ + flex: !displayOnly && listType === 'text', + 'mt-4 relative mb-2': !displayOnly && listType === 'text', + 'h-full': displayOnly || listType !== 'text', + 'sm:my-0': !displayOnly && listType === 'text' && isBubbleMode, + 'sm:mt-0': !displayOnly && listType === 'text' && !isBubbleMode && !isShowTitle, + 'sm:my-3': !displayOnly && listType === 'text' && !isBubbleMode && isShowTitle, + 'sm:mb-3': showFileList, + 'sm:mb-0': !showFileList + }}This separates concerns and makes each condition explicit.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
packages/vue/src/upload/src/mobile-first.vue(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: PR E2E Test (pnpm test:e2e3)
🔇 Additional comments (1)
packages/vue/src/upload/src/mobile-first.vue (1)
115-115: Approve addition of positioning context
The inclusion of therelativeutility class when!displayOnly && listType === 'text'is appropriate to contain absolutely positioned children (e.g., the SVG plus‐icon) and prevent it from drifting.
PR
upload 的多端模板增加 relative, 防止 加号 添加文件的svg漂移到页面顶部。
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Issue Number: N/A
What is the new behavior?
Does this PR introduce a breaking change?
Other information
Summary by CodeRabbit