Skip to content

Commit

Permalink
fix(button): added blur (#961)
Browse files Browse the repository at this point in the history
  • Loading branch information
v-gevak authored Nov 9, 2023
1 parent 3df836c commit e4c5d82
Show file tree
Hide file tree
Showing 50 changed files with 182 additions and 119 deletions.
6 changes: 6 additions & 0 deletions .changeset/fair-buses-fetch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@alfalab/core-components-button': patch
'@alfalab/core-components-tag': patch
---

Добавлен блюр к полупрозрачным кнопкам
5 changes: 5 additions & 0 deletions .changeset/nice-papayas-allow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@alfalab/core-components-number-input': patch
---

Заменены токены для stepper
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 7 additions & 2 deletions packages/button/src/components/base-button/index.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,14 @@
box-shadow: none;
user-select: none;
cursor: pointer;
transition: background 0.2s ease, border 0.2s ease, color 0.2s ease, transform 0.12s ease;
transition: background 0.2s ease, border 0.2s ease, color 0.2s ease;
box-sizing: border-box;
will-change: transform;
}

.secondary,
.accent[disabled],
.primary[disabled] {
backdrop-filter: blur(80px);
}

.focused {
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -565,7 +565,7 @@ Object {
class="checkbox tagLabel"
>
<button
class="component component component s s outlined rounded outlined my-tag"
class="component component component s s outlined outlined rounded outlined my-tag"
type="button"
>
<span>
Expand All @@ -583,7 +583,7 @@ Object {
class="checkbox tagLabel"
>
<button
class="component component component s s outlined rounded outlined"
class="component component component s s outlined outlined rounded outlined"
type="button"
>
<span>
Expand All @@ -601,7 +601,7 @@ Object {
class="checkbox tagLabel"
>
<button
class="component component component s s outlined rounded outlined"
class="component component component s s outlined outlined rounded outlined"
type="button"
>
<span>
Expand Down Expand Up @@ -635,7 +635,7 @@ Object {
class="checkbox tagLabel"
>
<button
class="component component component s s outlined rounded outlined my-tag"
class="component component component s s outlined outlined rounded outlined my-tag"
type="button"
>
<span>
Expand All @@ -653,7 +653,7 @@ Object {
class="checkbox tagLabel"
>
<button
class="component component component s s outlined rounded outlined"
class="component component component s s outlined outlined rounded outlined"
type="button"
>
<span>
Expand All @@ -671,7 +671,7 @@ Object {
class="checkbox tagLabel"
>
<button
class="component component component s s outlined rounded outlined"
class="component component component s s outlined outlined rounded outlined"
type="button"
>
<span>
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 13 additions & 3 deletions packages/number-input/src/components/number-input/Component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,14 @@ import {
} from '../../utils';
import { Steppers } from '../steppers';

import defaultColors from './default.module.css';
import styles from './index.module.css';
import invertedColors from './inverted.module.css';

const colorStyles = {
default: defaultColors,
inverted: invertedColors,
};

export interface NumberInputProps
extends Omit<InputProps, 'value' | 'onChange' | 'type' | 'defaultValue'> {
Expand Down Expand Up @@ -106,6 +113,7 @@ export const NumberInput = forwardRef<HTMLInputElement, NumberInputProps>(
size = 's',
disableUserInput,
clear: clearProp,
colors = 'default',
...restProps
},
ref,
Expand Down Expand Up @@ -233,6 +241,7 @@ export const NumberInput = forwardRef<HTMLInputElement, NumberInputProps>(
value={value}
onInput={handleChange}
dataTestId={dataTestId}
colors={colors}
disabled={disabled}
onFocus={handleFocus}
onBlur={handleBlur}
Expand All @@ -244,14 +253,15 @@ export const NumberInput = forwardRef<HTMLInputElement, NumberInputProps>(
<React.Fragment>
{rightAddons}
<Steppers
colors={colors}
dataTestId={dataTestId}
disabled={disabled}
value={parseNumber(value)}
min={min}
max={max}
className={cn(styles.steppers, styles[size], {
[styles.steppersFocused]: focused,
[styles.steppersDisable]: disabled,
className={cn(colorStyles[colors].steppers, styles[size], {
[colorStyles[colors].steppersFocused]: focused,
[colorStyles[colors].steppersDisabled]: disabled,
})}
onIncrement={handleIncrement}
onDecrement={handleDecrement}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
@import '../../../../themes/src/default.css';

.steppers {
background-color: var(--color-light-neutral-1500-inverted);
}

.steppersFocused,
.steppersDisabled {
background-color: var(--color-light-neutral-translucent-200);
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,5 @@
@import '../../../../themes/src/default.css';

.steppers {
background-color: var(--color-light-neutral-0);
}

.steppersFocused,
.steppersDisable {
background-color: var(--color-light-neutral-translucent-200);
}

.s {
margin-right: var(--gap-xs-neg);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
@import '../../../../themes/src/default.css';

.steppers {
background-color: var(--color-light-neutral-1500);
}

.steppersFocused,
.steppersDisabled {
background-color: var(--color-light-neutral-translucent-300-inverted);
}
13 changes: 12 additions & 1 deletion packages/number-input/src/components/steppers/Component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ import { getDataTestId } from '@alfalab/core-components-shared';
import { MinusMIcon } from '@alfalab/icons-glyph/MinusMIcon';
import { PlusMediumMIcon } from '@alfalab/icons-glyph/PlusMediumMIcon';

import defaultColors from './default.module.css';
import styles from './index.module.css';
import invertedColors from './inverted.module.css';

export type SteppersProps = {
value: number;
Expand All @@ -17,6 +19,12 @@ export type SteppersProps = {
onIncrement: () => void;
onDecrement: () => void;
dataTestId?: string;
colors: 'default' | 'inverted';
};

const colorStyles = {
default: defaultColors,
inverted: invertedColors,
};

function preventDefault(e: React.MouseEvent<HTMLElement>) {
Expand All @@ -32,13 +40,15 @@ export const Steppers: React.FC<SteppersProps> = ({
max,
disabled,
dataTestId,
colors,
}) => {
const decButtonDisabled = disabled || value <= min;
const incButtonDisabled = disabled || value >= max;

return (
<div className={cn(styles.component, className)}>
<IconButton
colors={colors}
disabled={decButtonDisabled}
className={styles.button}
icon={<MinusMIcon />}
Expand All @@ -48,8 +58,9 @@ export const Steppers: React.FC<SteppersProps> = ({
dataTestId={getDataTestId(dataTestId, 'decrement-button')}
view='secondary'
/>
<div className={styles.separator} />
<div className={cn(styles.separator, colorStyles[colors].separator)} />
<IconButton
colors={colors}
disabled={incButtonDisabled}
className={styles.button}
icon={<PlusMediumMIcon />}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@import '../../../../themes/src/default.css';

.separator {
background-color: var(--color-light-neutral-translucent-300);
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
.separator {
height: 18px;
width: 1px;
background-color: var(--color-light-neutral-translucent-300);
}

.button {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@import '../../../../themes/src/default.css';

.separator {
background-color: var(--color-light-neutral-translucent-300-inverted);
}
Loading

0 comments on commit e4c5d82

Please sign in to comment.