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: pass-code: add d/m imports #1492

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
7 changes: 7 additions & 0 deletions .changeset/happy-moose-grab.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@alfalab/core-components-pass-code': minor
---

- Добавлены десктоп/мобайл импорты
- Мелкий рефакторинг css - вынесены общие стили в коммон
- Добавлено sideEffects: false
1 change: 1 addition & 0 deletions packages/pass-code/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"access": "public",
"directory": "dist"
},
"sideEffects": false,
"peerDependencies": {
"react": "^16.9.0 || ^17.0.1 || ^18.0.0",
"react-dom": "^16.9.0 || ^17.0.1 || ^18.0.0"
Expand Down
4 changes: 2 additions & 2 deletions packages/pass-code/src/Component.responsive.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import React, { forwardRef } from 'react';

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

import { PassCodeDesktop } from './desktop/PassCodeDesktop';
import { PassCodeMobile } from './mobile/PassCodeMobile';
import { PassCodeDesktop } from './desktop';
import { PassCodeMobile } from './mobile';
import { PassCodeProps } from './typings';

export const PassCode = forwardRef<HTMLDivElement, PassCodeProps>(
Expand Down
6 changes: 0 additions & 6 deletions packages/pass-code/src/desktop/desktop.module.css
Original file line number Diff line number Diff line change
@@ -1,8 +1,2 @@
@import '../../../vars/src/index.css';
@import '../vars.css';

.component {
box-sizing: border-box;
padding: var(--gap-8) var(--gap-16) var(--gap-16);
min-width: var(--pass-code-min-width);
}
1 change: 1 addition & 0 deletions packages/pass-code/src/desktop/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './PassCodeDesktop';
9 changes: 7 additions & 2 deletions packages/pass-code/src/docs/development.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ import vars from '!!raw-loader!../vars.css';
## Подключение

```jsx
// Десктоп/мобайл
import { PassCodeDesktop } from '@alfalab/core-components/pass-code/desktop';
import { PassCodeMobile } from '@alfalab/core-components/pass-code/mobile';

// Респонсив
import { PassCode } from '@alfalab/core-components/pass-code';

// Если добавляете аддон, то можно обернуть его в KeyPadButton. Так не понадобится подгонять стили под другие кнопки.
Expand All @@ -14,8 +19,8 @@ import { KeyPadButton } from '@alfalab/core-components/pass-code';

## Использование dataTestId

В компоненте используются модификаторы для `dataTestId`.
Для удобного поиска элементов можно воспользоваться функцией `getPassCodeTestIds`.
В компоненте используются модификаторы для `dataTestId`.
Для удобного поиска элементов можно воспользоваться функцией `getPassCodeTestIds`.
Импорт из `@alfalab/core-components/pass-code/shared`.

Функция возвращает объект:
Expand Down
3 changes: 3 additions & 0 deletions packages/pass-code/src/index.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@

.component {
min-height: var(--pass-code-min-height);
box-sizing: border-box;
padding: var(--gap-8) var(--gap-16) var(--gap-16);
min-width: var(--pass-code-min-width);
}

.inputProgressContainer {
Expand Down
1 change: 1 addition & 0 deletions packages/pass-code/src/mobile/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './PassCodeMobile';
3 changes: 0 additions & 3 deletions packages/pass-code/src/mobile/mobile.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,8 @@
@import '../vars.css';

.component {
box-sizing: border-box;
display: flex;
flex-direction: column;
justify-content: end;
height: var(--pass-code-height);
padding: var(--gap-8) var(--gap-16) var(--gap-16);
min-width: var(--pass-code-min-width);
}
Loading