feat: Добавлен переиспользуемый компонент кнопки с задаваемыми размерами, вариантами и цветовыми схемами. Добавлен декоратор стилей для сторибука, установлена библиотека для работы с классами

This commit is contained in:
Ilia Mashkov
2025-11-20 09:26:01 +03:00
parent e440005e60
commit 5c869eb215
12 changed files with 281 additions and 2 deletions

View File

@@ -0,0 +1,8 @@
import type { Decorator } from '@storybook/react'
import '@/app/styles/index.scss'
export const StyleDecorator: Decorator = (Story) => (
<>
<Story />
</>
)

View File

@@ -49,7 +49,13 @@ const config: StorybookConfig = {
if (typeof rule === 'object' && rule !== null && 'test' in rule) {
const test = rule.test
if (test instanceof RegExp) {
return !(test.test('.css') || test.test('.scss') || test.test('.sass'))
// Удаляем правила для CSS/SCSS и SVG
return !(
test.test('.css') ||
test.test('.scss') ||
test.test('.sass') ||
test.test('.svg')
)
}
}
return true
@@ -58,6 +64,12 @@ const config: StorybookConfig = {
// Использование конфигурации CSS loader из проекта
config.module.rules.push(buildCssLoader(true))
// Добавление поддержки SVGR для SVG иконок
config.module.rules.push({
test: /\.svg$/,
use: ['@svgr/webpack'],
})
return config
},

View File

@@ -1,6 +1,8 @@
import type { Preview } from '@storybook/react'
import { StyleDecorator } from './StyleDecorator.tsx'
const preview: Preview = {
decorators: [StyleDecorator],
parameters: {
controls: {
matchers: {
@@ -13,7 +15,7 @@ const preview: Preview = {
values: [
{
name: 'light',
value: '#ffffff',
value: '#F4F5F9',
},
{
name: 'dark',