Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 0 additions & 22 deletions src/components/Control/Control.scss
Original file line number Diff line number Diff line change
Expand Up @@ -24,28 +24,6 @@ $block: '.#{$ns}control';
@include islands-focus();
@include focusable();

&_size {
&_xs {
width: 24px;
height: 24px;
}

&_s {
width: 28px;
height: 28px;
}

&_m {
width: 32px;
height: 32px;
}

&_l {
width: 36px;
height: 36px;
}
}

&_theme {
&_primary {
color: var(--g-color-text-complementary);
Expand Down
20 changes: 12 additions & 8 deletions src/components/Control/Control.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';

import {Icon} from '@gravity-ui/uikit';
import {Button, ButtonSize, Icon} from '@gravity-ui/uikit';
import {SVGIconData} from '@gravity-ui/uikit/build/esm/components/Icon/types';

import {block} from '../../utils';
Expand All @@ -16,7 +16,7 @@ export const defaultIconId = 'icon-test-id';
export interface ControlProps {
icon: SVGIconData;
theme?: 'primary' | 'secondary' | 'link' | 'accent';
size?: 'xs' | 's' | 'm' | 'l';
size?: ButtonSize;
iconSize?: number;
disabled?: boolean;
className?: string;
Expand All @@ -37,16 +37,20 @@ const Control = (props: ControlProps) => {
} = props;

return (
<button
type="button"
<Button
type={'button'}
aria-label={i18n('aria-label')}
className={b({size, theme, disabled}, className)}
className={b({theme, disabled}, className)}
onClick={disabled ? undefined : onClick}
disabled={disabled}
data-qa={qa}
qa={qa}
size={size}
view={'flat'}
>
<Icon data={icon} size={iconSize} qa={defaultIconId} />
</button>
<Button.Icon>
<Icon data={icon} size={iconSize} qa={defaultIconId} />
</Button.Icon>
</Button>
);
};

Expand Down
2 changes: 1 addition & 1 deletion src/components/Control/__tests__/Control.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ describe('Control', () => {
render(<Control icon={icon} qa={qaId} size={size} />);
const control = screen.getByTestId(qaId);

expect(control).toHaveClass(`pc-control_size_${size}`);
expect(control).toHaveClass(`g-button_size_${size}`);
});

test('add iconSize', () => {
Expand Down
Loading