Skip to content

Commit f8fd9a2

Browse files
authored
fix(button): add size prop to AntdButton (#598)
#597
1 parent d50bef8 commit f8fd9a2

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/button/__tests__/index.test.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ describe('Button', () => {
3333
expect(container.firstChild).toHaveClass('custom-class');
3434
});
3535

36+
it('applies size className', () => {
37+
const { container } = render(<Button size="small">Test</Button>);
38+
expect(container.firstChild).toHaveClass('ant-btn-sm');
39+
});
40+
3641
it('passes other props to AntdButton', () => {
3742
const { getByText } = render(<Button type="primary">Primary</Button>);
3843
expect(getByText('Primary').parentNode).toHaveClass('ant-btn-primary');

src/button/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export default function Button({
1414
...rest
1515
}: ButtonProps) {
1616
return (
17-
<AntdButton className={classNames('dtc-button', className)} {...rest}>
17+
<AntdButton className={classNames('dtc-button', className)} size={size} {...rest}>
1818
{icon && <span className={`dtc-button__icon dtc-button__icon--${size}`}>{icon}</span>}
1919
{children && (
2020
<span className={`dtc-button__text dtc-button__text--${size}`}>{children}</span>

0 commit comments

Comments
 (0)