);
});
```
--------------------------------
### Import Button Component
Source: https://github.com/alfa-laboratory/core-components/blob/master/README.md
Example of how to import the Button component into your React application.
```jsx
import { Button } from '@alfalab/core-components/button';
```
--------------------------------
### Basic Link Example
Source: https://github.com/alfa-laboratory/core-components/blob/master/packages/link/src/docs/description.mdx
Demonstrates a basic link to an external resource, typically used for navigation. Ensure the 'href' attribute is correctly set for the target URL.
```tsx
Заказать карту
```
--------------------------------
### Basic Bottom Sheet Example
Source: https://github.com/alfa-laboratory/core-components/blob/master/packages/bottom-sheet/src/docs/description.mdx
Demonstrates a standard Bottom Sheet with a title, action button, and content. Use this for typical modal-like interactions.
```tsx
render(() => {
const [open, setOpen] = React.useState(false);
return (
<>
setOpen(false)}>
Понятно
}
onClose={() => setOpen(false)}
>
Сейчас много говорят об отказах банков в проведении операций, блокировках интернет-банка. Это связано с тем, что Центральный банк РФ обязывает банки выявлять операции своих клиентов, потенциально нарушающие требования Федерального закона «О противодействии легализации (отмыванию) доходов, полученных преступным путем, и финансированию терроризма» — 115-ФЗ
Сейчас много говорят об отказах банков в проведении операций, блокировках интернет-банка. Это связано с тем, что Центральный банк РФ обязывает банки выявлять операции своих клиентов, потенциально нарушающие требования Федерального закона «О противодействии легализации (отмыванию) доходов, полученных преступным путем, и финансированию терроризма» — 115-ФЗ
Сейчас много говорят об отказах банков в проведении операций, блокировках интернет-банка. Это связано с тем, что Центральный банк РФ обязывает банки выявлять операции своих клиентов, потенциально нарушающие требования Федерального закона «О противодействии легализации (отмыванию) доходов, полученных преступным путем, и финансированию терроризма» — 115-ФЗ
Сейчас много говорят об отказах банков в проведении операций, блокировках интернет-банка. Это связано с тем, что Центральный банк РФ обязывает банки выявлять операции своих клиентов, потенциально нарушающие требования Федерального закона «О противодействии легализации (отмыванию) доходов, полученных преступным путем, и финансированию терроризма» — 115-ФЗ
>
);
});
```
--------------------------------
### Pseudo-Link Examples
Source: https://github.com/alfa-laboratory/core-components/blob/master/packages/link/src/docs/description.mdx
Illustrates how to use the 'pseudo' prop to make a link trigger an informational layer (collapse, dropdown, popup) instead of navigating. This is useful for interactive elements within the current view.
```tsx
Primary
Secondary
Default
```
--------------------------------
### Toast Component Example
Source: https://github.com/alfa-laboratory/core-components/blob/master/packages/toast/src/docs/component.stories.mdx
Demonstrates the usage of the Toast component with various configurable options. It includes two instances: one for a copy action and another for a delete action with a restore button. Use this snippet to understand how to control toast visibility, position, content, and actions.
```tsx
import { Meta, Story, Props } from '@storybook/addon-docs';
import { text, select, boolean, number } from '@storybook/addon-knobs';
import { Button } from '@alfalab/core-components-button';
import { CssVars, ComponentHeader, Tabs } from 'storybook/blocks';
import { Toast } from '../';
import { name, version } from '../../package.json';
import Description from './description.mdx';
import Changelog from '../../CHANGELOG.md';
import styles from '!!raw-loader!../index.module.css';
export function ToastExample() {
const POSITION_OPTIONS = [
'top',
'top-start',
'top-end',
'bottom',
'bottom-start',
'bottom-end',
'right',
'right-start',
'right-end',
'left',
'left-start',
'left-end',
];
const [anchorToastOpen, setAnchorToastOpen] = React.useState(false);
const [fixedToastOpen, setFixedToastOpen] = React.useState(false);
const [buttonElement, setButtonElement] = React.useState(null);
const handleButtonRef = node => {
setButtonElement(node);
};
const containerRef = React.useRef();
return (
);
});
```
--------------------------------
### Area Chart Example
Source: https://github.com/alfa-laboratory/core-components/blob/master/packages/chart/src/docs/description.mdx
Configuration for an area chart. This includes basic chart properties, offset for gradient, and detailed gradient point settings with color and opacity.
```javascript
{
/*
* Скрыть график
*/
hide?: false,
/*
* Скрыть график в легенде
*/
hideLegend?: false,
/*
* Скрыть график в тултипe
*/
hideTooltip?: false,
/*
* Z-index графика
*/
zIndex,
/*
* Тип графика
*/
chart: 'ara',
/*
* Тип иконки для графика
*/
icon,
/*
* Оффсет для градиента (только для типа area)
*/
offset,
/**
* Параметры градиента
*/
gradient: {
/**
* Индефикатор градиента
*/
gid,
/**
* Параметра точек для градиента
*/
points: [
/**
* Отступ
*/
offset: number,
/**
* Цвет
*/
stopColor: string,
/**
* Прозрачность
*/
stopOpacity: number,
]
}
}
```
--------------------------------
### Scrollable TabsDesktop Example
Source: https://github.com/alfa-laboratory/core-components/blob/master/packages/tabs/src/docs/description.mdx
Demonstrates the `scrollable` prop for the TabsDesktop component, enabling horizontal scrolling for tabs with long titles. Use this when you have many tabs or very long tab titles.
```tsx
render(() => {
const [selectedId, setSelectedId] = React.useState('tab-1');
const handleChange = (event, { selectedId }) => setSelectedId(selectedId);
return (
Таб 1
Таб 2
Таб 3
Таб 4
Таб 5
Таб 6
Таб 7
Таб 8
Таб 9
Таб 10
);
});
```
--------------------------------
### Bottom Sheet Without Header Example
Source: https://github.com/alfa-laboratory/core-components/blob/master/packages/bottom-sheet/src/docs/description.mdx
Shows a Bottom Sheet with its header hidden using the `hideHeader` prop. Useful when only content is needed without a title or close button in the header.
```tsx
render(() => {
const [open, setOpen] = React.useState(false);
return (
<>
setOpen(false)}
hideHeader
>
Сейчас много говорят об отказах банков в проведении операций, блокировках интернет-банка. Это связано с тем, что Центральный банк РФ обязывает банки выявлять операции своих клиентов, потенциально нарушающие требования Федерального закона «О противодействии легализации (отмыванию) доходов, полученных преступным путем, и финансированию терроризма» — 115-ФЗ
Сейчас много говорят об отказах банков в проведении операций, блокировках интернет-банка. Это связано с тем, что Центральный банк РФ обязывает банки выявлять операции своих клиентов, потенциально нарушающие требования Федерального закона «О противодействии легализации (отмыванию) доходов, полученных преступным путем, и финансированию терроризма» — 115-ФЗ
Сейчас много говорят об отказах банков в проведении операций, блокировках интернет-банка. Это связано с тем, что Центральный банк РФ обязывает банки выявлять операции своих клиентов, потенциально нарушающие требования Федерального закона «О противодействии легализации (отмыванию) доходов, полученных преступным путем, и финансированию терроризма» — 115-ФЗ
Сейчас много говорят об отказах банков в проведении операций, блокировках интернет-банка. Это связано с тем, что Центральный банк РФ обязывает банки выявлять операции своих клиентов, потенциально нарушающие требования Федерального закона «О противодействии легализации (отмыванию) доходов, полученных преступным путем, и финансированию терроризма» — 115-ФЗ
>
);
});
```
--------------------------------
### Build Components for Beta Release
Source: https://github.com/alfa-laboratory/core-components/blob/master/README.md
Steps to build the components and prepare for a beta release. This involves building the project and versioning the package.
```bash
$ yarn build
$ cd dist
$ npm version 2.0.0-beta.0 // подставить нужную версию
npm publish --tag beta
```
--------------------------------
### Pre-configured List for Webview
Source: https://github.com/alfa-laboratory/core-components/blob/master/packages/list/src/docs/description.mdx
Shows how to create a pre-configured List component for Webview integration by extending the base List component. This approach helps in avoiding duplication and simplifying usage.
```tsx
// import { Space } from '@alfalab/core-components/space';
// import { Typography, typographyPresets } from '@alfalab/core-components/typography';
// import { listPres } from '@alfalab/core-components/list';
Накопительные счета
Индивидуальное обслуживание в любом отделении в России
Депозиты
Повышенные % ставки по депозитам
```
--------------------------------
### Basic Drawer Usage
Source: https://github.com/alfa-laboratory/core-components/blob/master/packages/drawer/src/docs/description.mdx
Demonstrates the fundamental implementation of the Drawer component. Use this for standard side panel functionality.
```tsx
function Content() {
const { contentRef } = React.useContext(DrawerContext);
const [showMore, setShowMore] = React.useState(false);
const Text = () => (
Сейчас много говорят об отказах банков в проведении операций, блокировках
интернет-банка. Это связано с тем, что Центральный банк РФ обязывает банки выявлять
операции своих клиентов, потенциально нарушающие требования Федерального закона «О
противодействии легализации (отмыванию) доходов, полученных преступным путем, и
финансированию терроризма» — 115-ФЗ
);
return (
{showMore && (
<>
>
)}
);
}
render(() => {
const [open, setOpen] = React.useState(false);
const handleModalOpen = () => setOpen(!open);
return (
);
});
```
--------------------------------
### Line Chart Configuration and Rendering
Source: https://github.com/alfa-laboratory/core-components/blob/master/packages/chart/src/docs/Component.stories.mdx
This snippet shows the configuration for a line chart, including data points, chart options, and how to render it using the Chart component. It also displays the stringified options in a preformatted block.
```javascript
const labelsLineChart = {
labelFormatter: (value) => {
return new Date(value).toLocaleDateString('en-US', {
month: 'short',
day: 'numeric',
});
},
valueFormatter: (value) => {
return value;
},
};
const lineChartOptions = {
id: 'line-chart',
composeChart,
responsiveContainer,
cartesianGrid,
xAxis,
yAxis,
tooltip,
legend,
brush,
labels: labelsLineChart,
series: [areaChart]
};
return (
)
```
--------------------------------
### Basic Modal Usage
Source: https://github.com/alfa-laboratory/core-components/blob/master/packages/modal/src/docs/description.mdx
Demonstrates how to open and close a modal with content. Requires React state management for the open/close state and the ModalDesktop component with its sub-components.
```tsx
import { Typography } from '@alfalab/core-components/typography';
render(() => {
const [open, setOpen] = React.useState(false);
const handleModalOpen = () => setOpen(!open);
return (
Почему банк проверяет мои операции?
Сейчас много говорят об отказах банков в проведении операций, блокировках
интернет-банка. Это связано с тем, что Центральный банк РФ обязывает банки
выявлять операции своих клиентов, потенциально нарушающие требования
Федерального закона 115-ФЗ «О противодействии легализации (отмыванию) доходов,
полученных преступным путем, и финансированию терроризма».
Ознакомиться с требованиями ЦБ РФ можно на официальном сайте. Банки обязаны
предотвращать проведение таких операций и поэтому могут запросить
дополнительную информацию и документы, ограничить доступ к платежам через
интернет-банк или даже отказать в исполнении платежа.
);
});
```
--------------------------------
### Release Major Version
Source: https://github.com/alfa-laboratory/core-components/blob/master/README.md
Command to build and release a major version of the components.
```bash
yarn pub:major # соберет и выпустит major-версию
```
--------------------------------
### Link Customization with Slots
Source: https://github.com/alfa-laboratory/core-components/blob/master/packages/link/src/docs/description.mdx
Demonstrates how to use 'leftAddons' and 'rightAddons' slots to include custom content, such as icons, within the link. This enhances link visibility and provides additional context.
```tsx
}>
Ссылка с иконкой слева
}>
Ссылка с иконкой справа
```
--------------------------------
### Release Minor Version
Source: https://github.com/alfa-laboratory/core-components/blob/master/README.md
Command to build and release a minor version of the components.
```bash
yarn pub:minor # соберет и выпустит minor-версию
```
--------------------------------
### Basic List Usage
Source: https://github.com/alfa-laboratory/core-components/blob/master/packages/list/src/docs/description.mdx
Demonstrates the basic usage of the List component with different tags (ul, ol) and markers. This is useful for creating unordered and ordered lists with custom content.
```tsx
Накопительные счетаДепозитыКредиты
Индивидуальное обслуживание в любом отделении в России
Повышенные % ставки по депозитамЛьготная конвертация валют.Ипотечный кредитПотребительский кредитБесплатные сервисы для накоплений
```
--------------------------------
### Amount Comparison: Default vs. With Zero Minor Part
Source: https://github.com/alfa-laboratory/core-components/blob/master/packages/amount/src/docs/description.mdx
Compares the default view of the Amount component with the 'withZeroMinorPart' view, showing how zero minor parts are handled differently.
```tsx
import { Container, Row, Col } from '@alfalab/core-components/container';
import { Amount } from '@alfalab/core-components/amount';
Значение12345001234567
view="default"
view="withZeroMinorPart"
```
--------------------------------
### Import Toast Component
Source: https://github.com/alfa-laboratory/core-components/blob/master/packages/toast/src/docs/component.stories.mdx
Shows the necessary import statement for using the Toast component in your project.
```tsx
import { Toast } from '@alfalab/core-components/toast';
```
--------------------------------
### Import ES5 Button Component with CSS Modules
Source: https://github.com/alfa-laboratory/core-components/blob/master/README.md
Importing the Button component using the ES5 distribution with CSS Modules enabled.
```tsx
import { Button } from '@alfalab/core-components/button/cssm';
// или
import { Button } from '@alfalab/core-components-button/dist/cssm';
```