[Component] Update: Sync button radius to 4px#2991
[Component] Update: Sync button radius to 4px#2991qingqing-ux wants to merge 5 commits intogoplus:uifrom
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request focuses on enhancing UI consistency and developer efficiency. It updates the styling of square buttons to match the latest design system specifications and introduces a comprehensive guide that maps design components to their corresponding frontend code, aiming to streamline future design synchronization efforts. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces a new design-to-code-mapping.md document, providing a comprehensive guide for mapping design components to spx-gui frontend code, including UI elements, editor structures, and design tokens, with an emphasis on a 'Token-First' principle. A review comment highlights an inconsistency in UIButton.vue where a button's border-radius is hardcoded to 4px, suggesting it should instead use a CSS variable to align with the new documentation's principles. Another comment recommends expanding the Token Mapping section in the new guide to include other design tokens such as sizing, spacing, and border-radius for improved completeness.
| // shape | ||
| .shape-square { | ||
| --ui-button-radius: var(--ui-border-radius-2); | ||
| --ui-button-radius: 4px; |
| | Success 绿色系 | `success` / `green` | | ||
| | 灰阶 | `grey` | | ||
|
|
||
| 如果设计稿改的是整套颜色,不要直接在业务组件里写死颜色,优先改 token。 |
| // shape | ||
| .shape-square { | ||
| --ui-button-radius: var(--ui-border-radius-2); | ||
| --ui-button-radius: 4px; |
There was a problem hiding this comment.
Hardcoded value breaks the design token system
This replaces var(--ui-border-radius-2) with a literal 4px, decoupling the square button radius from the design token. The token --ui-border-radius-2 is still 12px in tokens/index.ts, which is used by 40+ other components (modals, selects, block items). Future global updates to borderRadius[2] won't affect buttons, creating a silent divergence.
Consider either:
- Introducing a dedicated token (e.g.,
borderRadius: { 0: '4px', 1: '8px', 2: '12px', ... }) and usingvar(--ui-border-radius-0), or - Adding a separate
--ui-button-square-radius: 4pxtoken if the button radius is intentionally independent.
The new doc (design-to-code-mapping.md) itself advises against hardcoding design values — this change contradicts that guidance.
| "id": "svrJY", | ||
| "name": "Frame 162689", | ||
| "fill": "$grey300", | ||
| "cornerRadius": 10, |
There was a problem hiding this comment.
Outlier entry: was 10, not 12 like all other square button variants
All other cornerRadius changes in this file go 12 → 4. This entry (Button-only icon/Large/Boring/Shadow/Square/Disabled, frame id svrJY) was already 10 before this PR — a pre-existing inconsistency in the Disabled variant. The change produces the intended 4, but this masked inconsistency should be either acknowledged (if intentional) or noted as a separate bug fix.
| | 设计维度 | 代码 props | | ||
| |----------|------------| | ||
| | `Primary / Secondary / Boring / White / Danger / Success / Blue / Purple / Yellow` | `color` | | ||
| | `Large / Medium / Small` | `size` | |
There was a problem hiding this comment.
Inaccurate variant mapping: Flat-Stroke is not a valid prop value
The table maps design name Flat-Stroke to variant, implying variant="flat-stroke" is valid. The actual ButtonVariant type in UIButton.vue only accepts shadow, flat, and stroke. The design label Flat-Stroke corresponds to the code value stroke, not flat-stroke. A developer following this table would pass an invalid prop.
|
Clean, well-scoped design sync. The |
issues #2989
Background
Sync the latest button radius adjustment from
ui/components/spx/builder-component.lib.pento frontend implementation.Changes
UIButtonradius to4pxScope
ui/components/spx/builder-component.lib.penspx-gui/src/components/ui/UIButton.vueDesign System Impact