Skip to content

Commit

Permalink
feature: add itemSelectedFontColor token in Segemented Component (ant…
Browse files Browse the repository at this point in the history
…-design#44570)

* feature: segemented新增component token

* feature: segemented新增component token

* Apply suggestions from code review

Signed-off-by: MadCcc <1075746765@qq.com>

---------

Signed-off-by: MadCcc <1075746765@qq.com>
Co-authored-by: xiaozisong <xiaozis@gantsoftware.com>
Co-authored-by: MadCcc <1075746765@qq.com>
  • Loading branch information
3 people authored Sep 4, 2023
1 parent c83c587 commit 85dc67f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions components/segmented/demo/componentToken.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export default () => (
itemHoverBg: 'rgba(0, 0, 0, 0.06)',
itemSelectedBg: '#aaa',
itemActiveBg: '#ccc',
itemSelectedColor: '#fff',
},
},
}}
Expand Down
8 changes: 7 additions & 1 deletion components/segmented/style/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ export interface ComponentToken {
* @descEN Background color of item when selected
*/
itemSelectedBg: string;
/**
* @desc 选项选中时文字颜色
* @descEN Text color of item when selected
*/
itemSelectedColor: string;
}

interface SegmentedToken extends FullToken<'Segmented'> {
Expand Down Expand Up @@ -109,7 +114,7 @@ const genSegmentedStyle: GenerateStyle<SegmentedToken> = (token: SegmentedToken)

'&-selected': {
...getItemSelectedStyle(token),
color: token.itemHoverColor,
color: token.itemSelectedColor,
},

'&::after': {
Expand Down Expand Up @@ -241,6 +246,7 @@ export default genComponentStyleHook(
itemHoverBg: colorFillSecondary,
itemSelectedBg: colorBgElevated,
itemActiveBg: colorFill,
itemSelectedColor: colorText,
};
},
);

0 comments on commit 85dc67f

Please sign in to comment.