fix: Правки внешнего вида кода линтером

This commit is contained in:
Ilia Mashkov
2025-11-20 09:58:13 +03:00
parent 5c869eb215
commit d3731ad513
4 changed files with 139 additions and 111 deletions

View File

@@ -1,18 +1,26 @@
.button { .button {
display: inline-flex; display: inline-flex;
align-items: center;
justify-content: center; justify-content: center;
border: none; align-items: center;
background: transparent;
cursor: pointer;
transition: all 0.3s ease;
padding: 0; padding: 0;
outline: none;
font-family: var(--font-family-main); font-family: var(--font-family-main);
border: none;
background: transparent;
outline: none;
cursor: pointer;
transition: all 0.3s ease;
&:disabled { &:disabled {
opacity: 0.5;
cursor: not-allowed; cursor: not-allowed;
opacity: 0.5;
} }
// Variants // Variants
@@ -22,33 +30,39 @@
} }
&.regular { &.regular {
border-radius: 1em;
padding: 0.5em 1em; padding: 0.5em 1em;
border-radius: 1em;
} }
// Sizes // Sizes
&.small { &.small {
height: 40px; height: 40px;
font-size: 14px; font-size: 14px;
} }
&.medium { &.medium {
height: 50px; height: 50px;
font-size: 18px; font-size: 18px;
} }
&.large { &.large {
height: 60px; height: 60px;
font-size: 24px; font-size: 24px;
} }
// Color Schemes // Color Schemes
&.primary { &.primary {
$color-primary: var(--color-primary); $color-primary: var(--color-primary);
background-color: transparent;
color: $color-primary; color: $color-primary;
border: 1px solid $color-primary; border: 1px solid $color-primary;
background-color: transparent;
&:hover:not(:disabled) { &:hover:not(:disabled) {
background-color: var(--color-white); background-color: var(--color-white);
} }
@@ -56,22 +70,26 @@
&.secondary { &.secondary {
$color-blue: var(--color-blue); $color-blue: var(--color-blue);
background-color: var(--color-white);
color: $color-blue; color: $color-blue;
box-shadow: 0px 0px 15px rgb($color-blue / 10%);
background-color: var(--color-white);
box-shadow: 0 0 15px rgb($color-blue / 10%);
} }
// Icon handling // Icon handling
.icon { .icon {
display: flex; display: flex;
align-items: center;
justify-content: center; justify-content: center;
align-items: center;
width: 100%; width: 100%;
height: 100%; height: 100%;
svg { svg {
width: 40%; width: 40%;
height: 40%; height: 40%;
object-fit: contain; object-fit: contain;
} }
} }

View File

@@ -1,7 +1,9 @@
import type { Meta, StoryObj } from '@storybook/react'
import { Button } from './Button'
import ChevronLeftIcon from '@/shared/assets/chevron--left.svg' import ChevronLeftIcon from '@/shared/assets/chevron--left.svg'
import { Button } from './Button'
import type { Meta, StoryObj } from '@storybook/react'
const meta = { const meta = {
title: 'Shared/Button', title: 'Shared/Button',
component: Button, component: Button,

View File

@@ -1,12 +1,15 @@
import { ButtonHTMLAttributes, memo, PropsWithChildren } from 'react'
import classNames from 'classnames' import classNames from 'classnames'
import { ButtonHTMLAttributes, memo, PropsWithChildren } from 'react'
import styles from './Button.module.scss' import styles from './Button.module.scss'
export type ButtonVariant = 'round' | 'regular' export type ButtonVariant = 'round' | 'regular'
export type ButtonSize = 'small' | 'medium' | 'large' export type ButtonSize = 'small' | 'medium' | 'large'
export type ButtonColorScheme = 'primary' | 'secondary' export type ButtonColorScheme = 'primary' | 'secondary'
export interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement>, PropsWithChildren { export interface ButtonProps
extends ButtonHTMLAttributes<HTMLButtonElement>,
PropsWithChildren {
/** /**
* Вариант внешнего вида кнопки * Вариант внешнего вида кнопки
* @default 'round' * @default 'round'
@@ -47,7 +50,7 @@ export const Button = memo((props: ButtonProps) => {
return ( return (
<button <button
type="button" type='button'
className={classNames(styles.button, mods, className)} className={classNames(styles.button, mods, className)}
disabled={disabled} disabled={disabled}
{...otherProps} {...otherProps}

View File

@@ -1,2 +1,7 @@
export { Button } from './Button' export { Button } from './Button'
export type { ButtonProps, ButtonVariant, ButtonSize, ButtonColorScheme } from './Button' export type {
ButtonProps,
ButtonVariant,
ButtonSize,
ButtonColorScheme,
} from './Button'