Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ feat: migrate less to token for Slider #42428

Merged
merged 34 commits into from Jun 15, 2023

Conversation

heiyu4585
Copy link
Contributor

@heiyu4585 heiyu4585 commented May 17, 2023

[中文版模板 / Chinese template]

🤔 This is a ...

  • New feature
  • Bug fix
  • Site / documentation update
  • Demo update
  • Component style update
  • TypeScript definition update
  • Bundle size optimization
  • Performance optimization
  • Enhancement feature
  • Internationalization
  • Refactoring
  • Code style optimization
  • Test Case
  • Branch merge
  • Workflow
  • Other (about what?)

🔗 Related issue link

💡 Background and solution

📝 Changelog

Language Changelog
🇺🇸 English migrate less to token for Slider
🇨🇳 Chinese 修改 组件 less token

☑️ Self-Check before Merge

⚠️ Please check all items below before requesting a reviewing. ⚠️

  • Doc is updated/provided or not needed
  • Demo is updated/provided or not needed
  • TypeScript definition is updated/provided or not needed
  • Changelog is provided or not needed

🚀 Summary

🤖 Generated by Copilot at 85e13ab

This pull request adds component token support for the slider component, which enables users to customize its style through the ConfigProvider component. It also adds a component token demo and documentation for the slider component in both Chinese and English languages. It updates the migrate less variables documentation to include the slider component.

🔍 Walkthrough

🤖 Generated by Copilot at 85e13ab

  • Add a component token demo for the slider component that shows how to customize the style of the slider using the ConfigProvider component and the component token interface (link, link, link, link, link, link)
  • Update the slider component documentation in both languages to include the component token demo in the examples section, using the debug attribute to enable the component token debug mode (link, link)
  • Update the migrate less variables documentation in both languages to include the slider component in the result section, using a table to show the mapping between the Less variables and the component token properties, and the remarks for each property (link, link)

@github-actions
Copy link
Contributor

github-actions bot commented May 17, 2023

@heiyu4585 heiyu4585 force-pushed the Slider-token branch 2 times, most recently from 42b5f08 to ff3520a Compare May 24, 2023 01:46
@codecov
Copy link

codecov bot commented May 25, 2023

Codecov Report

Patch and project coverage have no change.

Comparison is base (5d62e63) 100.00% compared to head (0b74e79) 100.00%.

❗ Current head 0b74e79 differs from pull request most recent head 40c4878. Consider uploading reports for the commit 40c4878 to get more accurate results

Additional details and impacted files
@@            Coverage Diff            @@
##           feature    #42428   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          649       649           
  Lines        10936     10944    +8     
  Branches      2965      2967    +2     
=========================================
+ Hits         10936     10944    +8     

see 1 file with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

<!-- prettier-ignore -->
| Less 变量 | Component Token | 备注 |
| --- | --- | --- |
| `@slider-margin` | `iconFontSize` | - |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
| `@slider-margin` | `iconFontSize` | - |
| `@slider-margin` | - | 可由 `className``style` 直接修改 |

Comment on lines 265 to 281
| `@slider-rail-background-color` | `railBackgroundColor` | - |
| `@slider-rail-background-color-hover` | `railBackgroundColorHover` | - |
| `@slider-track-background-color` | `trackBackgroundColor` | - |
| `@slider-track-background-color-hover` | `trackBackgroundColorHover` | - |
| `@slider-handle-border-width` | `handleBorderWidth` | - |
| `@slider-handle-background-color` | `handleBackgroundColor` | - |
| `@slider-handle-color` | `handleColor` | - |
| `@slider-handle-color-hover` | `handleColorHover` | - |
| `@slider-handle-color-focus` | `handleColorFocus` | - |
| `@slider-handle-color-focus-shadow` | `handleColorFocusShadow` | - |
| `@slider-handle-color-tooltip-open` | `handleColorTooltipOpen` | - |
| `@slider-handle-size` | `handleSize` | - |
| `@slider-handle-margin-top` | `handleMarginTop` | - |
| `@slider-handle-margin-left` | `handleMarginLeft` | - |
| `@slider-handle-shadow` | `handleShadow` | - |
| `@slider-dot-border-color` | `dotBorderColor` | - |
| `@slider-dot-border-color-active` | `dotBorderColorActive` | - |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
| `@slider-rail-background-color` | `railBackgroundColor` | - |
| `@slider-rail-background-color-hover` | `railBackgroundColorHover` | - |
| `@slider-track-background-color` | `trackBackgroundColor` | - |
| `@slider-track-background-color-hover` | `trackBackgroundColorHover` | - |
| `@slider-handle-border-width` | `handleBorderWidth` | - |
| `@slider-handle-background-color` | `handleBackgroundColor` | - |
| `@slider-handle-color` | `handleColor` | - |
| `@slider-handle-color-hover` | `handleColorHover` | - |
| `@slider-handle-color-focus` | `handleColorFocus` | - |
| `@slider-handle-color-focus-shadow` | `handleColorFocusShadow` | - |
| `@slider-handle-color-tooltip-open` | `handleColorTooltipOpen` | - |
| `@slider-handle-size` | `handleSize` | - |
| `@slider-handle-margin-top` | `handleMarginTop` | - |
| `@slider-handle-margin-left` | `handleMarginLeft` | - |
| `@slider-handle-shadow` | `handleShadow` | - |
| `@slider-dot-border-color` | `dotBorderColor` | - |
| `@slider-dot-border-color-active` | `dotBorderColorActive` | - |
| `@slider-rail-background-color` | `railBg` | - |
| `@slider-rail-background-color-hover` | `railHoverBg` | - |
| `@slider-track-background-color` | `trackBg` | - |
| `@slider-track-background-color-hover` | `trackHoverBg` | - |
| `@slider-handle-border-width` | `handleLineWidth` | - |
| `@slider-handle-background-color` | `handleBg` | - |
| `@slider-handle-color` | `handleColor` | - |
| `@slider-handle-color-hover` | `handleHoverColor` | - |
| `@slider-handle-color-focus` | `handleActiveColor` | - |
| `@slider-handle-color-focus-shadow` | - | 样式变化已废弃 |
| `@slider-handle-color-tooltip-open` | `handleActiveColor` | - |
| `@slider-handle-size` | `handleSize` | - |
| `@slider-handle-margin-top` | `handleMarginTop` | - |
| `@slider-handle-margin-left` | `handleMarginLeft` | - |
| `@slider-handle-shadow` | - | 样式变化已废弃 |
| `@slider-dot-border-color` | `dotBorderColor` | - |
| `@slider-dot-border-color-active` | `dotActiveBorderColor` | - |

Copy link
Contributor Author

@heiyu4585 heiyu4585 May 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

handleBg,handleColorHover,handleActiveColor 没有使用了

| `@slider-handle-shadow` | `handleShadow` | - |
| `@slider-dot-border-color` | `dotBorderColor` | - |
| `@slider-dot-border-color-active` | `dotBorderColorActive` | - |
| `@slider-disabled-color` | `disabledColor` | - |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
| `@slider-disabled-color` | `disabledColor` | - |
| `@slider-disabled-color` | `trackBgDisabled` | - |

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@heiyu4585 heiyu4585 force-pushed the Slider-token branch 2 times, most recently from 8fcd56f to 880c734 Compare June 7, 2023 03:00
trackHoverBg: string;
handleColor: string;
handleHoverColor: string;
handleColorTooltipOpen: string;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个应该改成 handleActiveColor 了

Comment on lines 359 to 360
dotBorderColor: '#303030',
dotActiveBorderColor: 'tint(@primary-color, 50%)', // FIX ME
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这两个颜色看下,应该用 token 的。

handleColor: token.colorPrimaryBorder,
handleHoverColor: token.colorPrimaryHover,
handleActiveColor: token.colorPrimary,
dotBorderColor: '#303030',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个没用过

@@ -177,7 +187,7 @@ const genBaseStyle: GenerateStyle<SliderToken> = (token) => {
position: 'absolute',
width: dotSize,
height: dotSize,
backgroundColor: token.colorBgElevated,
backgroundColor: token.dotBorderColor,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

用错地方了,是 borderColor 才对

boxShadow: 'none',
cursor: 'not-allowed',
},

[`${componentCls}-handle::after`]: {
backgroundColor: token.colorBgElevated,
backgroundColor: token.handleActiveColor,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个也是,应该是蓝色圈的颜色

| `@slider-handle-background-color` | - | Deprecated |
| `@slider-handle-color` | `handleColor` | - |
| `@slider-handle-color-hover` | `handleActiveColor` | - |
| `@slider-handle-color-focus` | - | Deprecated |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个也可以用 handleActiveColor

@MadCcc MadCcc merged commit 4ae0d6b into ant-design:feature Jun 15, 2023
12 checks passed
kiner-tang pushed a commit that referenced this pull request Jun 15, 2023
* ✨ feat: migrate less to token for Slider

* ✨ feat: update snap

* ✨ feat: update style

* ✨ feat: update style

* ✨ feat: test ci

* ✨ feat: test ci

* ✨ feat: test ci

* ✨ feat: test ci

* ✨ feat: update

* ✨ feat: update snap

* ✨ feat: update

* ✨ feat: update

* ✨ feat: 删除未使用token

* ✨ feat: update doc

* ✨ feat: update dome

* ✨ feat: update

* ✨ feat: test ci

* 📝 doc: update doc

* ✨ feat: update

* ✨ feat: update

* ✨ feat: update

* ✨ feat: update

* ✨ feat: add demo

* ✨ feat: add demo

* ✨ feat: update for reviewer

* ✨ feat: update for reviewer

* ✨ feat: update for reviewer

* ✨ feat: update for reviewer

* ✨ feat: update for reviewer

* ✨ feat: update for reviewer

* ✨ feat: update for reviewer

* ✨ feat: update for reviewer

* Apply suggestions from code review

---------

Co-authored-by: MadCcc <1075746765@qq.com>
kiner-tang added a commit that referenced this pull request Jun 16, 2023
* refactor: refactor closeIcon

* docs: update docs

* refactor(Drawer): refactor drawer closeIcon (#42993)

* feat: optimize closeIcon

* refactor: refactor closeIcon

* docs: update docs

* feat: optimize code

* feat: update test case

* feat: optimize code

* feat: optimize code

* feat: optimize code

* feat: optimize code

* feat: optimize code

* feat: optimize code

* docs: update docs

* ✨ feat: migrate less to token for Slider (#42428)

* ✨ feat: migrate less to token for Slider

* ✨ feat: update snap

* ✨ feat: update style

* ✨ feat: update style

* ✨ feat: test ci

* ✨ feat: test ci

* ✨ feat: test ci

* ✨ feat: test ci

* ✨ feat: update

* ✨ feat: update snap

* ✨ feat: update

* ✨ feat: update

* ✨ feat: 删除未使用token

* ✨ feat: update doc

* ✨ feat: update dome

* ✨ feat: update

* ✨ feat: test ci

* 📝 doc: update doc

* ✨ feat: update

* ✨ feat: update

* ✨ feat: update

* ✨ feat: update

* ✨ feat: add demo

* ✨ feat: add demo

* ✨ feat: update for reviewer

* ✨ feat: update for reviewer

* ✨ feat: update for reviewer

* ✨ feat: update for reviewer

* ✨ feat: update for reviewer

* ✨ feat: update for reviewer

* ✨ feat: update for reviewer

* ✨ feat: update for reviewer

* Apply suggestions from code review

---------

Co-authored-by: MadCcc <1075746765@qq.com>

* feat: optimize code

* feat: optimize code

* feat: optimize code

* feat: optimize code

* feat: optimize code

* feat: optimize code

* feat: optimize code

* docs: update docs

---------

Co-authored-by: 黑雨 <wangning4567@163.com>
Co-authored-by: MadCcc <1075746765@qq.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants