Skip to content

Commit

Permalink
feat: pure-sell - add atoms exports;
Browse files Browse the repository at this point in the history
  • Loading branch information
denisx committed Nov 26, 2024
1 parent 4dfb7fc commit b0eb28a
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 5 deletions.
6 changes: 6 additions & 0 deletions .changeset/many-peaches-play.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@alfalab/core-components-pure-cell': minor
---

- Добавлены атомарные экспорты
- В package.json добавлено sideEffects:false
1 change: 1 addition & 0 deletions packages/pure-cell/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
23 changes: 21 additions & 2 deletions packages/pure-cell/src/component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -219,12 +219,14 @@ const PureCellComponent = forwardRef<HTMLElement, PureCellProps>(
},
);

const ExtraSubtitle = FooterText as React.FC<FooterTextProps>;

/**
* Универсальный конструктор для сборки любой ячейки.
*
* [Макет](https://www.figma.com/file/KlFOLLkKO8rtvvQE3RXuhq/Click-Library?node-id=43525%3A240018)
*/
export const PureCell = Object.assign(PureCellComponent, {
const PureCell = Object.assign(PureCellComponent, {
Main,
Graphics,
Content,
Expand All @@ -233,10 +235,27 @@ export const PureCell = Object.assign(PureCellComponent, {
AmountTitle,
Addon,
Footer,
ExtraSubtitle: FooterText as React.FC<FooterTextProps>,
ExtraSubtitle,
FooterButton,
Comment,
Category,
});

PureCellComponent.displayName = 'PureCellComponent';

export {
PureCell,
PureCellComponent,
Main,
Graphics,
Content,
Text,
Amount,
AmountTitle,
Addon,
Footer,
ExtraSubtitle,
FooterButton,
Comment,
Category,
};
22 changes: 20 additions & 2 deletions packages/pure-cell/src/docs/development.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,31 @@ import { PureCell as PureCellTS } from '../component';
## Подключение

```jsx
// Атомарные
import {
PureCellComponent,
Main,
Graphics,
Content,
Text,
Amount,
AmountTitle,
Addon,
Footer,
ExtraSubtitle,
FooterButton,
Comment,
Category,
} from '@alfalab/core-components/pure-cell';

// Компаунд
import { PureCell } from '@alfalab/core-components/pure-cell';
```

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

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

Функция возвращает объект:
Expand Down
17 changes: 16 additions & 1 deletion packages/pure-cell/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,17 @@
export { PureCell } from './component';
export {
PureCell,
PureCellComponent,
Main,
Graphics,
Content,
Text,
Amount,
AmountTitle,
Addon,
Footer,
ExtraSubtitle,
FooterButton,
Comment,
Category,
} from './component';
export type { PureCellProps } from './component';

0 comments on commit b0eb28a

Please sign in to comment.