diff --git a/.changeset/witty-spiders-flash.md b/.changeset/witty-spiders-flash.md new file mode 100644 index 0000000000..f5e20c68a5 --- /dev/null +++ b/.changeset/witty-spiders-flash.md @@ -0,0 +1,5 @@ +--- +'@alfalab/core-components-typography': patch +--- + +Внутренний рефакторинг: приведена в порядок структура папок diff --git a/packages/typography/src/colors.ts b/packages/typography/src/colors.ts index 11433eb86c..c90066a7c4 100644 --- a/packages/typography/src/colors.ts +++ b/packages/typography/src/colors.ts @@ -20,4 +20,4 @@ export const colors = [ 'static-accent', ] as const; -export type Color = typeof colors[number]; +export type Color = (typeof colors)[number]; diff --git a/packages/typography/src/component.ts b/packages/typography/src/component.ts new file mode 100644 index 0000000000..48456f5f2f --- /dev/null +++ b/packages/typography/src/component.ts @@ -0,0 +1,22 @@ +import type { FC, ForwardRefExoticComponent, RefAttributes } from 'react'; + +import type { TitleProps } from './title/component'; +import { type TitleResponsiveProps, TitleResponsive } from './title/component.responsive'; +import { Title } from './title/desktop'; +import { type TitleMobileProps, TitleMobile } from './title/mobile'; +import { type TextProps, Text } from './text'; +import type { TextElementType } from './types'; + +export const Typography: { + Title: FC; + Text: ForwardRefExoticComponent>; + TitleResponsive: FC; + TitleMobile: FC; +} = { + Title, + Text, + TitleResponsive, + TitleMobile, +}; + +export { Text, Title as TitleDesktop, TitleResponsive, TitleMobile }; diff --git a/packages/typography/src/component.tsx b/packages/typography/src/component.tsx deleted file mode 100644 index ffb52ea64e..0000000000 --- a/packages/typography/src/component.tsx +++ /dev/null @@ -1,21 +0,0 @@ -import { FC, ForwardRefExoticComponent, RefAttributes } from 'react'; - -import { Text, TextProps } from './text'; -import { Title, TitleProps } from './title'; -import { TitleMobile, TitleMobileProps } from './title-mobile'; -import { TitleResponsive, TitleResponsiveProps } from './title-responsive'; -import { TextElementType } from './types'; - -export const Typography: { - Title: FC; - Text: ForwardRefExoticComponent>; - TitleResponsive: FC; - TitleMobile: FC; -} = { - Title, - Text, - TitleResponsive, - TitleMobile, -}; - -export { Text, Title as TitleDesktop, TitleResponsive, TitleMobile }; diff --git a/packages/typography/src/docs/Component.docs.mdx b/packages/typography/src/docs/Component.docs.mdx index d17a03a057..3a2228683f 100644 --- a/packages/typography/src/docs/Component.docs.mdx +++ b/packages/typography/src/docs/Component.docs.mdx @@ -8,10 +8,7 @@ import Changelog from '../../CHANGELOG.md?raw'; - + } diff --git a/packages/typography/src/docs/development.mdx b/packages/typography/src/docs/development.mdx index ba985da2ff..94d51f13a7 100644 --- a/packages/typography/src/docs/development.mdx +++ b/packages/typography/src/docs/development.mdx @@ -71,7 +71,7 @@ CDN alfabank.servicecdn.ru — ненадёжный вариант, можно чтобы получить возможные варианты реализации этого стиля в коде.
{ describe('Classes tests', () => { diff --git a/packages/typography/src/title/desktop/component.tsx b/packages/typography/src/title/desktop/component.tsx new file mode 100644 index 0000000000..b988635a3c --- /dev/null +++ b/packages/typography/src/title/desktop/component.tsx @@ -0,0 +1,15 @@ +import React, { forwardRef } from 'react'; + +import { type TitleProps, TitleBase } from '../component'; + +import commonStyles from '../common.module.css'; +import styles from './index.module.css'; + +export const Title = forwardRef((props, ref) => ( + +)); diff --git a/packages/typography/src/title/index.module.css b/packages/typography/src/title/desktop/index.module.css similarity index 86% rename from packages/typography/src/title/index.module.css rename to packages/typography/src/title/desktop/index.module.css index 26ec00b40b..ce96f68696 100644 --- a/packages/typography/src/title/index.module.css +++ b/packages/typography/src/title/desktop/index.module.css @@ -1,6 +1,6 @@ -@import '../../../vars/src/index.css'; -@import '../margins.module.css'; -@import '../common.module.css'; +@import '../../../../vars/src/index.css'; +@import '../../margins.module.css'; +@import '../../common.module.css'; .styrene-xlarge { @mixin headline_xlarge; diff --git a/packages/typography/src/title-responsive/index.tsx b/packages/typography/src/title/desktop/index.ts similarity index 100% rename from packages/typography/src/title-responsive/index.tsx rename to packages/typography/src/title/desktop/index.ts diff --git a/packages/typography/src/title/index.tsx b/packages/typography/src/title/index.tsx deleted file mode 100644 index 420fb3243c..0000000000 --- a/packages/typography/src/title/index.tsx +++ /dev/null @@ -1,18 +0,0 @@ -import React, { forwardRef } from 'react'; - -import { TitleBase, TitleProps } from './component'; - -import commonStyles from './common.module.css'; -import styles from './index.module.css'; - -const Title = forwardRef((props, ref) => ( - -)); - -export { Title }; -export type { TitleProps }; diff --git a/packages/typography/src/title-mobile/__image_snapshots__/typography-title-mobile-all-variants-sprite-2-snap.png b/packages/typography/src/title/mobile/__image_snapshots__/typography-title-mobile-all-variants-sprite-2-snap.png similarity index 100% rename from packages/typography/src/title-mobile/__image_snapshots__/typography-title-mobile-all-variants-sprite-2-snap.png rename to packages/typography/src/title/mobile/__image_snapshots__/typography-title-mobile-all-variants-sprite-2-snap.png diff --git a/packages/typography/src/title-mobile/__image_snapshots__/typography-title-mobile-all-variants-sprite-snap.png b/packages/typography/src/title/mobile/__image_snapshots__/typography-title-mobile-all-variants-sprite-snap.png similarity index 100% rename from packages/typography/src/title-mobile/__image_snapshots__/typography-title-mobile-all-variants-sprite-snap.png rename to packages/typography/src/title/mobile/__image_snapshots__/typography-title-mobile-all-variants-sprite-snap.png diff --git a/packages/typography/src/title-mobile/__image_snapshots__/typography-title-mobile-colors-sprite-inverted-snap.png b/packages/typography/src/title/mobile/__image_snapshots__/typography-title-mobile-colors-sprite-inverted-snap.png similarity index 100% rename from packages/typography/src/title-mobile/__image_snapshots__/typography-title-mobile-colors-sprite-inverted-snap.png rename to packages/typography/src/title/mobile/__image_snapshots__/typography-title-mobile-colors-sprite-inverted-snap.png diff --git a/packages/typography/src/title-mobile/__image_snapshots__/typography-title-mobile-colors-sprite-snap.png b/packages/typography/src/title/mobile/__image_snapshots__/typography-title-mobile-colors-sprite-snap.png similarity index 100% rename from packages/typography/src/title-mobile/__image_snapshots__/typography-title-mobile-colors-sprite-snap.png rename to packages/typography/src/title/mobile/__image_snapshots__/typography-title-mobile-colors-sprite-snap.png diff --git a/packages/typography/src/title-mobile/component.screenshots.test.tsx b/packages/typography/src/title/mobile/component.screenshots.test.tsx similarity index 99% rename from packages/typography/src/title-mobile/component.screenshots.test.tsx rename to packages/typography/src/title/mobile/component.screenshots.test.tsx index 25d2362525..d993b4417f 100644 --- a/packages/typography/src/title-mobile/component.screenshots.test.tsx +++ b/packages/typography/src/title/mobile/component.screenshots.test.tsx @@ -1,4 +1,4 @@ -import { setupScreenshotTesting, createSpriteStorybookUrl } from '../../../screenshot-utils'; +import { setupScreenshotTesting, createSpriteStorybookUrl } from '../../../../screenshot-utils'; const screenshotTesting = setupScreenshotTesting({ it, diff --git a/packages/typography/src/title-mobile/component.tsx b/packages/typography/src/title/mobile/component.tsx similarity index 76% rename from packages/typography/src/title-mobile/component.tsx rename to packages/typography/src/title/mobile/component.tsx index 5a2a3a6f45..ea9cdd41fa 100644 --- a/packages/typography/src/title-mobile/component.tsx +++ b/packages/typography/src/title/mobile/component.tsx @@ -1,8 +1,8 @@ import React, { forwardRef } from 'react'; -import { TitleBase, TitleProps } from '../title/component'; +import { type TitleProps, TitleBase } from '../component'; -import commonStyles from '../title/common.module.css'; +import commonStyles from '../common.module.css'; import styles from './index.module.css'; export const TitleMobile = forwardRef( diff --git a/packages/typography/src/title-mobile/index.module.css b/packages/typography/src/title/mobile/index.module.css similarity index 91% rename from packages/typography/src/title-mobile/index.module.css rename to packages/typography/src/title/mobile/index.module.css index eeb6a99d20..a1f161820b 100644 --- a/packages/typography/src/title-mobile/index.module.css +++ b/packages/typography/src/title/mobile/index.module.css @@ -1,5 +1,5 @@ -@import '../../../vars/src/index.css'; -@import '../margins.module.css'; +@import '../../../../vars/src/index.css'; +@import '../../margins.module.css'; .styrene-xlarge { @mixin headline-mobile_xlarge; diff --git a/packages/typography/src/title/mobile/index.ts b/packages/typography/src/title/mobile/index.ts new file mode 100644 index 0000000000..55e6457a04 --- /dev/null +++ b/packages/typography/src/title/mobile/index.ts @@ -0,0 +1,2 @@ +export { TitleMobile } from './component'; +export type { TitleProps as TitleMobileProps } from '../component';