Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(typography): organize folders/files #1498

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/witty-spiders-flash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@alfalab/core-components-typography': patch
---

- Внутренний рефакторинг: приведена в порядок структура папок
2 changes: 1 addition & 1 deletion packages/typography/src/colors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ export const colors = [
'static-accent',
] as const;

export type Color = typeof colors[number];
export type Color = (typeof colors)[number];
22 changes: 22 additions & 0 deletions packages/typography/src/component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import type { FC, ForwardRefExoticComponent, RefAttributes } from 'react';
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

файл переименован tsx -> ts


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<TitleProps>;
Text: ForwardRefExoticComponent<TextProps & RefAttributes<TextElementType>>;
TitleResponsive: FC<TitleResponsiveProps>;
TitleMobile: FC<TitleMobileProps>;
} = {
Title,
Text,
TitleResponsive,
TitleMobile,
};

export { Text, Title as TitleDesktop, TitleResponsive, TitleMobile };
21 changes: 0 additions & 21 deletions packages/typography/src/component.tsx

This file was deleted.

5 changes: 1 addition & 4 deletions packages/typography/src/docs/Component.docs.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@ import Changelog from '../../CHANGELOG.md?raw';

<Meta of={Stories} />

<ComponentHeader
name='Текстовые стили'
children='Подключение и использование шрифтов.'
/>
<ComponentHeader name='Текстовые стили' children='Подключение и использование шрифтов.' />

<Tabs
description={<Description />}
Expand Down
2 changes: 1 addition & 1 deletion packages/typography/src/docs/development.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ CDN alfabank.servicecdn.ru — ненадёжный вариант, можно
чтобы получить возможные варианты реализации этого стиля в коде.

<div
data-role="wrapper"
data-role='wrapper'
style={{
display: 'flex',
justifyContent: 'center',
Expand Down
2 changes: 1 addition & 1 deletion packages/typography/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export * from './component';
export * from './presets';
export type { TitleProps } from './title';
export type { TitleProps } from './title/component';
export type { TextProps } from './text';
export type { Color } from './colors';
6 changes: 3 additions & 3 deletions packages/typography/src/text/component.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import React, { forwardRef, HTMLAttributes } from 'react';
import React, { type HTMLAttributes, forwardRef } from 'react';
import mergeRefs from 'react-merge-refs';
import cn from 'classnames';

import { Color } from '../colors';
import type { Color } from '../colors';
import { useSkeleton } from '../hooks';
import { TextElementType, TextSkeletonProps } from '../types';
import type { TextElementType, TextSkeletonProps } from '../types';

import colors from '../colors.module.css';
import styles from './index.module.css';
Expand Down
2 changes: 0 additions & 2 deletions packages/typography/src/title-mobile/index.tsx

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ import React, { forwardRef } from 'react';

import { useIsDesktop } from '@alfalab/core-components-mq';

import { Title, TitleProps } from '../title';
import { TitleMobile } from '../title-mobile';
import type { TitleProps } from './component';
import { Title } from './desktop';
import { TitleMobile } from './mobile';

export type TitleResponsiveProps = TitleProps & {
/**
Expand Down
6 changes: 3 additions & 3 deletions packages/typography/src/title/component.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import React, { forwardRef, HTMLAttributes } from 'react';
import React, { type HTMLAttributes, forwardRef } from 'react';
import mergeRefs from 'react-merge-refs';
import cn from 'classnames';

import { Color } from '../colors';
import type { Color } from '../colors';
import { useSkeleton } from '../hooks';
import { TextSkeletonProps } from '../types';
import type { TextSkeletonProps } from '../types';

import { getDefaultWeight } from './utils';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {
setupScreenshotTesting,
createSpriteStorybookUrl,
createPreview,
} from '../../../screenshot-utils';
} from '../../../../screenshot-utils';

const screenshotTesting = setupScreenshotTesting({
it,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import React from 'react';
import { render } from '@testing-library/react';

import { colors } from '../colors';
import { Title, TitleProps } from './index';
import { colors } from '../../colors';
import { Title } from '.';
import type { TitleProps } from '../component';

describe('Title', () => {
describe('Classes tests', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
import React, { forwardRef } from 'react';

import { TitleBase, TitleProps } from './component';
import { type TitleProps, TitleBase } from '../component';

import commonStyles from './common.module.css';
import styles from './index.module.css';

const Title = forwardRef<HTMLHeadingElement | HTMLDivElement, TitleProps>((props, ref) => (
export const Title = forwardRef<HTMLHeadingElement | HTMLDivElement, TitleProps>((props, ref) => (
<TitleBase
{...props}
styles={Object.assign(commonStyles, styles)}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Object.assign({}, commonStyles, styles)

ref={ref}
platform='desktop'
/>
));

export { Title };
export type { TitleProps };
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { setupScreenshotTesting, createSpriteStorybookUrl } from '../../../screenshot-utils';
import { setupScreenshotTesting, createSpriteStorybookUrl } from '../../../../screenshot-utils';

const screenshotTesting = setupScreenshotTesting({
it,
Expand Down
Original file line number Diff line number Diff line change
@@ -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<HTMLHeadingElement | HTMLDivElement, TitleProps>(
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
2 changes: 2 additions & 0 deletions packages/typography/src/title/mobile/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { TitleMobile } from './component';
export type { TitleProps as TitleMobileProps } from '../component';
Loading