docs: add layout component usage documentation#371
Conversation
…ating panels, and scrollable main content
WalkthroughAdds a new ChangesLayout Documentation and Demos
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
📦 Package Previewpnpm add https://pkg.pr.new/@opentiny/tiny-robot@d4346b6 pnpm add https://pkg.pr.new/@opentiny/tiny-robot-kit@d4346b6 pnpm add https://pkg.pr.new/@opentiny/tiny-robot-svgs@d4346b6 commit: d4346b6 |
There was a problem hiding this comment.
Actionable comments posted: 5
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@docs/demos/layout/aside-modes.vue`:
- Around line 4-15: The left/right aside open-change handlers are using the
broader LayoutAsideOpenDetail type even though the emitted payload is
LayoutAsideOpenValue. Update the imports and the
updateLeftAside/updateRightAside parameter types to use LayoutAsideOpenValue,
keeping the handlers focused on the { open } payload so the template type-check
matches the emit signatures.
In `@docs/demos/layout/aside-resizable.vue`:
- Around line 4-5: The `left-aside-resize` event payload is typed incorrectly in
`aside-resizable.vue`; `updateLeftAsideWidth` should use
`LayoutAsideResizeValue` because the event emits `{ expandedWidth }`, not
`LayoutAsideResizeDetail`. Update the import from `@opentiny/tiny-robot` and
change the `updateLeftAsideWidth` handler signature to match the actual
`@left-aside-resize` payload so the demo type matches the event data.
In `@docs/demos/layout/aside-slot-props.vue`:
- Around line 12-19: The left aside in the demo is being collapsed to zero
width, which prevents the rail UI from having any visible space when the aside
is closed. Update the `leftAside` computed in `aside-slot-props.vue` to either
use a non-zero `collapsedWidth` or stop rendering the closed-state rail branch
and rely on the external control only; keep the behavior consistent anywhere the
same pattern is repeated.
- Around line 4-5: The aside event handlers in the demo are typed with the
generic payload interfaces, but the emitted payloads for the side-specific
events do not include a side field. Update the callback typings in
aside-slot-props.vue and the other aside event bindings in this demo to use the
side-specific payload shapes for left/right-aside-open-change and
left/right-aside-resize, and keep LayoutAsideProps only where the full aside
props are actually needed.
In `@docs/demos/layout/floating-panels.vue`:
- Line 4: The `left-aside-open-change` and `right-aside-open-change` handlers
are typed with `LayoutAsideOpenDetail`, but those events emit an `{ open }`
payload, so update the relevant type usage in `floating-panels.vue` to
`LayoutAsideOpenValue` instead. Locate the handler typings and any related
references to `LayoutAsideOpenDetail` in the floating panels demo, and replace
them so the event payload type matches the emitted shape.
🪄 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: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: dc237448-4a35-4b26-8d3f-a3da5f984dcd
📒 Files selected for processing (12)
docs/.vitepress/themeConfig.tsdocs/demos/layout/aside-collapse-effect.vuedocs/demos/layout/aside-modes.vuedocs/demos/layout/aside-resizable.vuedocs/demos/layout/aside-slot-props.vuedocs/demos/layout/basic.vuedocs/demos/layout/floating-panels.vuedocs/demos/layout/floating.vuedocs/demos/layout/main-scroll-bubble.vuedocs/demos/layout/main-scroll-div.vuedocs/demos/layout/main-scroll.vuedocs/src/components/layout.md

Layout 组件文档预览地址如下:
Layout 组件 →
Summary by CodeRabbit
Summary by CodeRabbit
New Features
Layoutdemos, including basic layout, floating mode, resizable and collapsible asides, aside modes, slot-driven customization, and main-area scrolling (via proxy scrollbar) examples.Documentation
Layoutcomponent guide with Props, Slots, Events, and relevant CSS variables.