Skip to content

Commit 81e6c2d

Browse files
authored
fix(Radio): fix style of button
close #117
1 parent 7a29248 commit 81e6c2d

File tree

8 files changed

+699
-619
lines changed

8 files changed

+699
-619
lines changed

src/components/Button/Button.jsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@ export default class Button extends PureComponent {
2222
icon: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
2323
/** 设置原生的button上type属性 */
2424
type: PropTypes.string,
25+
/**
26+
* @ignore
27+
* 选中状态
28+
*/
29+
checked: PropTypes.bool,
2530
/** @ignore */
2631
className: PropTypes.string,
2732
/** @ignore */

src/components/Button/style/index.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,18 +63,25 @@ const disabledMixin = ({
6363
}
6464
`;
6565

66+
const checkedMixin = ({ theme: { colorList } }) => css`
67+
color: ${colorList.primary2};
68+
background: ${colorList.primary4};
69+
border-color: ${colorList.primary2};
70+
`;
71+
6672
export const ButtonWrap = styled.button.attrs({
67-
className: ({ size, styleType, shape, loading, disabled }) =>
73+
className: ({ size, styleType, shape, loading, disabled, checked }) =>
6874
classnames(
6975
prefixCls,
7076
`${prefixCls}-size-${size}`,
7177
`${prefixCls}-styletype-${styleType}`,
7278
shape && `${prefixCls}-${shape}`,
7379
loading && `${prefixCls}-loading`,
74-
disabled && `${prefixCls}-disabled`
80+
disabled && `${prefixCls}-disabled`,
81+
checked && `${prefixCls}-checked`
7582
)
7683
})(
77-
({ theme: { fontSize, Button: buttonTheme = {} }, loading, shape, disabled }) => css`
84+
({ theme: { fontSize, Button: buttonTheme = {} }, loading, shape, disabled, checked }) => css`
7885
box-sizing: border-box;
7986
border-radius: 2px;
8087
border-width: 1px;
@@ -90,6 +97,7 @@ export const ButtonWrap = styled.button.attrs({
9097
${styleTypeMixin};
9198
${shape === 'circle' && shapeCircleMixin};
9299
${loading && loadingMixin};
100+
${checked && checkedMixin};
93101
${disabled && disabledMixin};
94102
95103
${buttonTheme['&']};

0 commit comments

Comments
 (0)