feat(Separator): add position prop#6415
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (4)
📒 Files selected for processing (2)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughAdds a Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. 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.
Actionable comments posted: 3
🧹 Nitpick comments (1)
test/components/Separator.spec.ts (1)
16-17: ⚡ Quick winAdd explicit structure assertions for
positionbehavior.These new cases are useful smoke tests, but they don’t verify placement semantics. Add assertions for DOM order/count (e.g.,
startcontainer before border,endafter border,centerwith two borders), including vertical orientation variants.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@test/components/Separator.spec.ts` around lines 16 - 17, Update the Separator.spec.ts tests that add cases 'with position start' and 'with position end' to include explicit DOM structure assertions: render the Separator component for positions 'start', 'end', and 'center' (and repeat for vertical orientation) and assert the placement and counts—verify for 'start' the content container appears before the border element, for 'end' the content container appears after the border element, and for 'center' there are two border elements surrounding the content; use the test helpers/selectors already in the file to locate the content container and border elements (the test titles 'with position start', 'with position end' and the component name Separator should help you find where to add these assertions).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@docs/content/docs/2.components/separator.md`:
- Line 50: The new "### Position" heading is missing the unreleased-feature
badge; update the heading by adding :badge{label="Soon" class="align-text-top"}
immediately after the "Position" heading text so the docs show the Soon badge
(i.e., change the "### Position" heading to include the badge markup right after
the heading title).
In `@src/runtime/components/Separator.vue`:
- Around line 67-70: The component reads props.position directly for runtime
branching; replace that by resolving variants with
useResolvedVariants('separator', props, theme, ['position']) and use the
resolved value for all v-if/computed branching (e.g., where props.position is
used around the current orientation/defaults and at the other noted spots).
Specifically, call useResolvedVariants with the 'separator' key and the existing
props/theme, extract the resolved position value, and update any v-if or
computed checks that reference props.position (including the locations around
the current orientation handling and the blocks previously at lines ~84 and
~100-110) to use the resolved position so runtime logic follows theme/app-config
variant resolution.
In `@src/theme/separator.ts`:
- Around line 37-41: The position variants in src/theme/separator.ts define
start/center/end but leave start/end empty so separators always use symmetric
spacing (mx-3 / my-2); update the separator theme to produce true edge alignment
by giving position.start and position.end concrete spacing tokens (and combine
them with the orientation variants). Specifically, for horizontal orientation
(the separator's orientation variant) make position.start set left margin to 0
and right margin to the existing spacing (e.g., ml-0 + mr-3) and position.end
set right margin 0 and left margin the spacing (mr-0 + ml-3); for vertical
orientation invert to mt/mb equivalents (mt-0 + mb-2 for start, mb-0 + mt-2 for
end). Modify the position object (and/or create orientation+position compound
variants) around the existing position definition so start/center/end produce
the intended edge-aligned margins instead of empty strings.
---
Nitpick comments:
In `@test/components/Separator.spec.ts`:
- Around line 16-17: Update the Separator.spec.ts tests that add cases 'with
position start' and 'with position end' to include explicit DOM structure
assertions: render the Separator component for positions 'start', 'end', and
'center' (and repeat for vertical orientation) and assert the placement and
counts—verify for 'start' the content container appears before the border
element, for 'end' the content container appears after the border element, and
for 'center' there are two border elements surrounding the content; use the test
helpers/selectors already in the file to locate the content container and border
elements (the test titles 'with position start', 'with position end' and the
component name Separator should help you find where to add these assertions).
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 3e05b795-9887-4577-9162-7a78583ba389
⛔ Files ignored due to path filters (4)
test/components/__snapshots__/AuthForm-vue.spec.ts.snapis excluded by!**/*.snaptest/components/__snapshots__/AuthForm.spec.ts.snapis excluded by!**/*.snaptest/components/__snapshots__/Separator-vue.spec.ts.snapis excluded by!**/*.snaptest/components/__snapshots__/Separator.spec.ts.snapis excluded by!**/*.snap
📒 Files selected for processing (5)
docs/content/docs/2.components/separator.mdplaygrounds/nuxt/app/pages/components/separator.vuesrc/runtime/components/Separator.vuesrc/theme/separator.tstest/components/Separator.spec.ts
commit: |
position propposition prop
🔗 Linked issue
Resolves #6367
❓ Type of change
📚 Description
As mentioned in the issue, I’ve added a
positionprop so that theSeparatorcontainer (be it a label, an icon or an avatar) can be placed at the start or the end.I called it "position" to match other props like the Chip and Toaster ones.
Would you like to remove the start/end margins based on the position? Let me know if you prefer that.
📝 Checklist