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

fix: 修复 label 类型声明问题 #597

Merged
merged 4 commits into from
Dec 9, 2020
Merged

fix: 修复 label 类型声明问题 #597

merged 4 commits into from
Dec 9, 2020

Conversation

iahu
Copy link
Contributor

@iahu iahu commented Dec 9, 2020

  • label 属性类型声明改为 React.ReactNode
  • 新增 title: string 属性

@vercel
Copy link

vercel bot commented Dec 9, 2020

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/growingio/gio-design/joodfgcr0
✅ Preview: https://gio-design-git-fix-form-item-type.growingio.vercel.app

@codecov
Copy link

codecov bot commented Dec 9, 2020

Codecov Report

Merging #597 (55fc775) into master (f00e477) will increase coverage by 0.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #597      +/-   ##
==========================================
+ Coverage   83.10%   83.12%   +0.01%     
==========================================
  Files         127      127              
  Lines        4221     4225       +4     
  Branches     1116     1118       +2     
==========================================
+ Hits         3508     3512       +4     
  Misses        710      710              
  Partials        3        3              
Impacted Files Coverage Δ
packages/components/src/components/form/Item.tsx 100.00% <ø> (ø)
...kages/components/src/components/form/ItemLabel.tsx 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f00e477...6deb9cc. Read the comment docs.

@@ -35,6 +37,7 @@ const ItemLabel: React.FC<Props> = (props: Props) => {
const isOptional = !required && requiredMark === 'optional';
const innerMarker = isOptional ? '(选填)' : '*';
const mergedRequiredMarker = marker !== undefined ? marker : innerMarker;
const mergedTitle = title ?? typeof label === 'string' ? (label as string) : ''
Copy link
Contributor

@phyzess phyzess Dec 9, 2020

Choose a reason for hiding this comment

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

这里 label 如果我给了一个 ReactNode,不就变成空字符串了么?
能否考虑直接支持 ReactNode 类型的 label?因为有的时候会比较复杂

Copy link
Contributor Author

@iahu iahu Dec 9, 2020

Choose a reason for hiding this comment

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

title 只支持 string,label 支持 Reat.ReactNode

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.

3 participants