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: static getDesignToken #42723

Merged
merged 2 commits into from
Jun 5, 2023
Merged

feat: static getDesignToken #42723

merged 2 commits into from
Jun 5, 2023

Conversation

MadCcc
Copy link
Member

@MadCcc MadCcc commented May 30, 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 Add static function getDesignToken to access full Design Token.
🇨🇳 Chinese 新增静态方法 getDesignToken 用于获取完整的主题 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 de2e4c8

This pull request adds a new function getDesignToken to the theme module, which allows users to access the design token object based on the theme configuration. It also adds type and test support for the function, and updates the documentation in both English and Chinese to reflect the new usage.

🔍 Walkthrough

🤖 Generated by Copilot at de2e4c8

  • Implement and export getDesignToken function to return design token object based on theme configuration (link, link)
  • Import ThemeConfig type from config-provider context module to use in getDesignToken function and test suite (link)
  • Add test suite for getDesignToken function using custom render function and useToken hook (link)
  • Reorder imports in theme module to follow convention (link)
  • Update documentation for theme module in English and Chinese versions, replacing defaultAlgorithm and defaultSeed with getDesignToken function and adding example of usage with ConfigProvider component (link, link)

@github-actions
Copy link
Contributor

github-actions bot commented May 30, 2023

@github-actions
Copy link
Contributor

Pull reviewers stats

Stats of the last 30 days for ant-design:

User Total reviews Time to review Total comments
li-jia-nan 91 1h 1m 49
afc163 88 1h 17m 67
MadCcc 51 1d 15h 31m 105
kiner-tang 43 12m 12
yoyo837 28 43m 30
zombieJ 25 1h 15
RedJue 8 4h 6m 11
PeachScript 3 19m 0
RexSkz 2 48m 5
vagusX 1 1h 36m 0
heiyu4585 1 5m 0
arvinxx 1 46m 12
Wxh16144 1 21m 3
sawadyecma 1 1h 51m 2
bombillazo 1 23h 49m 1
lke-twh 1 2h 49m 0

import seedToken from './themes/seed';
import formatToken from './util/alias';

const getDesignToken = (config?: ThemeConfig): AliasToken => {
Copy link
Member

Choose a reason for hiding this comment

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

先出 RFC?

@github-actions
Copy link
Contributor

github-actions bot commented May 30, 2023

size-limit report 📦

Path Size
./dist/antd.min.js 375.49 KB (+185 B 🔺)
./dist/antd-with-locales.min.js 434.82 KB (+171 B 🔺)

@codecov
Copy link

codecov bot commented May 30, 2023

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (6e52b6f) 100.00% compared to head (6a0c3f4) 100.00%.

Additional details and impacted files
@@            Coverage Diff            @@
##           feature    #42723   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          640       645    +5     
  Lines        10892     10926   +34     
  Branches      2957      2967   +10     
=========================================
+ Hits         10892     10926   +34     
Impacted Files Coverage Δ
components/theme/index.ts 100.00% <ø> (ø)
components/theme/getDesignToken.ts 100.00% <100.00%> (ø)

... and 24 files 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.

@li-jia-nan
Copy link
Member

大了200b

@@ -28,4 +29,5 @@ export default {
defaultAlgorithm,
darkAlgorithm,
compactAlgorithm,
getDesignToken,
Copy link
Member

Choose a reason for hiding this comment

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

要不要在 components/index.ts 里面也导出一下?

@MadCcc MadCcc merged commit 596104c into feature Jun 5, 2023
@MadCcc MadCcc deleted the feat/getDesignToken branch June 5, 2023 09:45
@MadCcc MadCcc mentioned this pull request Jun 6, 2023
20 tasks
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.

4 participants