tiny-vue icon indicating copy to clipboard operation
tiny-vue copied to clipboard

fix(space): [space]default spacing for overlay button components

Open James-9696 opened this issue 1 month ago • 1 comments

PR

image

PR Checklist

Please check if your PR fulfills the following requirements:

  • [x] The commit message follows our Commit Message Guidelines
  • [ ] Tests for the changes have been added (for bug fixes / features)
  • [ ] Docs have been added / updated (for bug fixes / features)

PR Type

What kind of change does this PR introduce?

  • [x] Bugfix
  • [ ] Feature
  • [ ] Code style update (formatting, local variables)
  • [ ] Refactoring (no functional changes, no api changes)
  • [ ] Build related changes
  • [ ] CI related changes
  • [ ] Documentation content changes
  • [x] Other... Please describe: --覆盖默认的button组件样式

What is the current behavior?

Issue Number: N/A

What is the new behavior?

Does this PR introduce a breaking change?

  • [ ] Yes
  • [x] No

Other information

Summary by CodeRabbit

  • Refactor
    • Centralized Space spacing into theme-based styles and ensured the Space component loads those styles.
  • Style
    • Removed per-button inline margin; adjacent buttons now receive left spacing from a theme variable (default 0px), standardizing spacing across instances.

James-9696 avatar Nov 13 '25 08:11 James-9696

Walkthrough

Removed inline per-button margin attributes from demo Space examples and added a theme-level Space stylesheet and variables; the Vue Space entry now imports the new theme stylesheet, and theme index aggregates the Space styles.

Changes

Cohort / File(s) Summary
Demo components
examples/sites/demos/mobile-first/app/space/space-size.vue, examples/sites/demos/pc/app/space/space-size.vue
Removed inline style="margin: 0" from repeated TinyButton elements; iteration and keys unchanged.
Space theme styles
packages/theme/src/space/index.less
New stylesheet: imports custom/vars, invokes .inject-Space-vars(), defines .@{space-prefix-cls} and rule && .tiny-button + .tiny-button { margin-left: var(--tv-Space-margin); }.
Space vars
packages/theme/src/space/vars.less
New file: adds .inject-Space-vars() mixin that sets --tv-Space-margin: 0px.
Theme vars export
packages/theme/src/vars.less
Added import of ./space/vars.less to include Space variables.
Vue Space entry
packages/vue/src/space/index.ts
Added import of @opentiny/vue-theme/space/index.less so the Space theme stylesheet is loaded.
Theme index
packages/theme/src/index.less
Added import of space/index.less into theme aggregation.

Sequence Diagram(s)

(omitted — changes are styling and imports; no runtime control-flow change to diagram)

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

  • Verify --tv-Space-margin default and scope in packages/theme/src/space/vars.less.
  • Confirm selector specificity and intended targeting of && .tiny-button + .tiny-button in packages/theme/src/space/index.less.
  • Ensure @opentiny/vue-theme/space/index.less import in packages/vue/src/space/index.ts loads in the correct build order and does not create circular import issues.

Poem

🐰 Buttons lined up neat and trim,
Margins moved from each tiny limb.
Variables whisper, "space is right,"
Theme now sets the margin's flight. ✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: fixing default spacing for button components in the Space component by removing inline margins and introducing CSS-based spacing rules.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing touches
  • [ ] 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • [ ] Create PR with unit tests
  • [ ] Post copyable unit tests in a comment

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

coderabbitai[bot] avatar Nov 13 '25 08:11 coderabbitai[bot]