feat: Добавлен переиспользуемый компонент кнопки с задаваемыми размерами, вариантами и цветовыми схемами. Добавлен декоратор стилей для сторибука, установлена библиотека для работы с классами
This commit is contained in:
8
config/storybook/StyleDecorator.tsx
Normal file
8
config/storybook/StyleDecorator.tsx
Normal file
@@ -0,0 +1,8 @@
|
||||
import type { Decorator } from '@storybook/react'
|
||||
import '@/app/styles/index.scss'
|
||||
|
||||
export const StyleDecorator: Decorator = (Story) => (
|
||||
<>
|
||||
<Story />
|
||||
</>
|
||||
)
|
||||
@@ -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
|
||||
},
|
||||
|
||||
|
||||
@@ -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',
|
||||
|
||||
Reference in New Issue
Block a user