JSPM

@salutejs/sdds-clfd-auto

0.318.0-canary.1655.16175078069.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 25
  • Score
    100M100P100Q116853F
  • License MIT

Salute Design System / React UI kit for SDDS CLFD AUTO web applications

Package Exports

  • @salutejs/sdds-clfd-auto
  • @salutejs/sdds-clfd-auto/es/index.js
  • @salutejs/sdds-clfd-auto/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@salutejs/sdds-clfd-auto) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Библиотека компонентов SDDS CLFD AUTO

Реализация компонентов для создания веб-приложений.

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

Компоненты реализованы на typescript с помощью react , styled-components

Использование данного пакета предполагает установку зависимостей: react & react-dom;

Использование styled-components на проект необязательно, так же как и использование typescript.

Но для того чтобы компоненты работали корректно необходимо установить styled-components.

Установка пакета

$ npm install --save react react-dom
$ npm install --save @salutejs/sdds-clfd-auto @salutejs/plasma-typo @salutejs/plasma-themes

Так же надо установить пакет styled-components

$ npm install --save styled-components@5.3.1

Настройка при работе с пакетом styled-components

Создайте компонент для подключения глобальных стилей:

import { createGlobalStyle } from 'styled-components';
import { standard } from '@salutejs/plasma-typo';
import { plasma_b2c__light } from '@salutejs/plasma-themes';

const ThemeStyle = createGlobalStyle(plasma_b2c__light);
const TypoStyle = createGlobalStyle(standard);

export const GlobalStyle = () => (
    <>
        <ThemeStyle />
        <TypoStyle />
    </>
);

Корень приложения

В корне приложения вызовите компонент глобальных стилей GlobalStyle:

  • Если вы используете Create React App, делайте вызов внутри src/index.tsx.
  • Если вы используете Next.js, создайте файл pages/_app.tsx и подключите стили в нем.

Для корректной работы server side rendering приложение нужно обернуть SSRProvider (доступен в sdds-clfd-auto);

Использование компонентов

Все компоненты styled-components доступны из директории components или напрямую из пакета:

// App.tsx
import { Button } from '@salutejs/sdds-clfd-auto';
import { textAccent } from '@salutejs/plasma-tokens/brands/sdds-clfd-auto';

export const App = () => {
    return (
        <>
            <Button>Hello, Plasma!</Button>

            <p style={{ color: textAccent }}>Token usage example</p>
        </>
    );
};