-
Notifications
You must be signed in to change notification settings - Fork 20
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: support htmlTitle for label #19
Conversation
🎊 PR Preview 4d62801 has been successfully built and deployed to https://react-component-segmented-preview-pr-19.surge.sh 🕐 Build time: 154.176s 🤖 By surge-preview |
Codecov Report
@@ Coverage Diff @@
## master #19 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 1 1
Lines 65 72 +7
Branches 12 13 +1
=========================================
+ Hits 65 72 +7
📣 Codecov can now indicate which changes are the most critical in Pull Requests. Learn more |
选择系列的组件直接就叫 |
src/index.tsx
Outdated
@@ -33,13 +37,31 @@ export interface SegmentedProps extends React.HTMLProps<HTMLDivElement> { | |||
motionName?: string; | |||
} | |||
|
|||
function getValidHtmlTitle(option: SegmentedLabeledOption) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
感觉还可以再抽一个 getValid 判断 string 和 number 然后直接 return getValid(option.title) ?? getValid(option.label)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
目前看起来这个判断是够用的,后面我考虑下,因为 title 其实要求是 string,而 label 其实在 options 下也应该要求是 string 才好,但是现在 label 是 ReactNode 所以这个判断处理起来有点怪,你可以看看新的写法
规则
增加 title(html title) 属性