Skip to content
Draft
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
10 changes: 6 additions & 4 deletions docs/core-config.stories.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ import { Meta } from '@storybook/addon-docs';
Для того чтобы не переопределять компоненты по отдельности, можно воспользоваться контекстом — компоненты автоматически получат значение из него (доступно в core-components с 48 версии).

### Установка:

```bash
npm install @alfalab/core-config
npm install @alfalab/core-components-config
```

### Использование:
Expand All @@ -22,12 +23,13 @@ npm install @alfalab/core-config
- `breakpoint` — точка перехода между мобильной и десктопной версией компонентов
- `client` — используется для того, чтобы указать, какую версию компонентов нужно использовать при Server-Side Rendering. Это позволяет избежать рендеринга компонентов на стороне клиента

```jsx
```tsx
const coreConfig = React.useMemo<CoreConfigContext>(
() => ({ breakpoint: 1024, client: 'desktop' }), []
() => ({ breakpoint: 1024, client: 'desktop' }),
[],
);

<CoreConfigContext.Provider>
<App />
</CoreConfigContext.Provider>
</CoreConfigContext.Provider>;
```
18 changes: 18 additions & 0 deletions docs/installation.stories.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,24 @@ yarn add @alfalab/core-components
yarn add @alfalab/core-components-button
```

Важно установить необходимые `peer dependencies`

```bash
yarn add @alfalab/core-components-config @alfalab/core-components-stack-context
```

> При возникновении сомнений о необдимости их установки обратите внимание на предупреждения пакетного менеджера

<details>
<summary>Пример предупреждения `yarn@4.13.0`</summary>

```
➤ YN0002: │ my-app@workspace:. doesn't provide @alfalab/core-components-config (p25f59b), requested by @alfalab/core-components.
➤ YN0002: │ my-app@workspace:. doesn't provide @alfalab/core-components-stack-context (p1c3d71), requested by @alfalab/core-components.
```

</details>

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

```jsx
Expand Down
Loading