Skip to content

Commit

Permalink
feat(icon-button): add negative view (#635)
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitrsavk committed May 7, 2021
1 parent d2f7edc commit 7006116
Show file tree
Hide file tree
Showing 9 changed files with 54 additions and 5 deletions.
17 changes: 16 additions & 1 deletion packages/icon-button/src/Component.stories.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { name, version } from '../package.json';
<Story name='IconButton'>
<IconButton
size={select('size', ['xxs', 'xs', 's'], 's')}
view={select('view', ['primary', 'secondary', 'transparent'], 'primary')}
view={select('view', ['primary', 'secondary', 'transparent', 'negative'], 'primary')}
icon={StarMIcon}
/>
</Story>
Expand Down Expand Up @@ -108,6 +108,21 @@ import { IconButton } from '@alfalab/core-components-icon-button';
</Container>
</Preview>

- <b>Negative</b>

<Preview>
<Container>
<Row>
<Col>
<IconButton view='negative' icon={StarMIcon} />
</Col>
<Col>
<IconButton view='negative' icon={BankAlfaXxlBlackIcon} />
</Col>
</Row>
</Container>
</Preview>

<Props of={IconButton} />

## Темы
Expand Down
2 changes: 1 addition & 1 deletion packages/icon-button/src/Component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export type IconButtonProps = {
/**
* Тип кнопки
*/
view?: 'primary' | 'secondary' | 'transparent';
view?: 'primary' | 'secondary' | 'transparent' | 'negative';

/**
* Размер компонента
Expand Down
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions packages/icon-button/src/component.screenshots.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ describe(
cases: generateTestCases({
componentName: 'IconButton',
knobs: {
view: ['primary', 'secondary', 'transparent'],
view: ['primary', 'secondary', 'transparent', 'negative'],
size: ['xxs', 'xs', 's'],
},
testStory: false,
Expand All @@ -33,7 +33,7 @@ describe(
cases: generateTestCases({
componentName: 'IconButton',
knobs: {
view: ['primary', 'secondary', 'transparent'],
view: ['primary', 'secondary', 'transparent', 'negative'],
size: ['s'],
},
testStory: false,
Expand All @@ -51,7 +51,7 @@ describe(
cases: generateTestCases({
componentName: 'IconButton',
knobs: {
view: ['primary', 'secondary', 'transparent'],
view: ['primary', 'secondary', 'transparent', 'negative'],
size: ['s'],
},
testStory: false,
Expand Down
19 changes: 19 additions & 0 deletions packages/icon-button/src/index.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,13 @@
--icon-button-transparent-disabled-color: color-mod(
var(--icon-button-transparent-base-color) alpha(40%)
);

/* negative */
--icon-button-negative-base-color: var(--color-light-graphic-negative);
--icon-button-negative-hover-color: color-mod(var(--icon-button-negative-base-color) tint(30%));
--icon-button-negative-active-color: color-mod(
var(--icon-button-negative-base-color) tint(50%)
);
}

.primary {
Expand Down Expand Up @@ -74,6 +81,18 @@
}
}

.negative {
color: var(--icon-button-negative-base-color);

&:hover {
color: var(--icon-button-negative-hover-color);
}

&:active {
color: var(--icon-button-negative-active-color);
}
}

.xxs {
width: var(--icon-button-xss-size);
height: var(--icon-button-xss-size);
Expand Down

0 comments on commit 7006116

Please sign in to comment.