Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
@sberdevices/ui
Advanced tools
Readme
Реализация компонентов для создания смартаппов.
Компоненты реализованы на typescript с помощью react и styled-components;
Использование данного пакета предполагает использование react
& react-dom
;
Использование styled-components
на проект не обязательно, также как и использование typescript
.
Но для того чтобы комопненты работали styled-components
необходимо установить.
$ npm install --save react react-dom
$ npm install --save styled-components
$ npm install --save @sberdevices/ui@rc @sberdevices/plasma-tokens@rc @sberdevices/plasma-icons@rc
Подключите цветовую схему с помощью глобальных стилей и типографическую систему с помощью DeviceThemeProvider
:
// GlobalStyle.tsx
import { createGlobalStyle } from 'styled-components';
import { darkSber } from '@sberdevices/plasma-tokens/themes'; // Или один из списка: darkEva, darkJoy, lightEva, lightJoy, lightSber
import {
text, // Цвет текста
background, // Цвет подложки
gradient, // Градиент
} from '@sberdevices/plasma-tokens';
const DocumentStyle = createGlobalStyle`
html:root {
min-height: 100vh;
color: ${text};
background-color: ${background};
background-image: ${gradient};
}
`;
const ThemeStyle = createGlobalStyle(darkSber);
export const GlobalStyle = () => (
<>
<DocumentStyle />
<ThemeStyle />
</>
);
// index.tsx
import { DeviceThemeProvider } from '@sberdevices/ui/components/Device'; // Типографика, имеющая размеры, зависимые от типа устройства
import { GlobalStyle } from './GlobalStyle'; // Тема оформления (цветовая схема)
import { App } from './App';
ReactDOM.render(
<DeviceThemeProvider>
<GlobalStyle />
<App />
</DeviceThemeProvider>,
document.getElementById('root'),
);
Подробнее о стилях и типографике.
Все компоненты доступны из папки components
или напрямую из пакета:
// App.tsx
import { Container } from '@sberdevices/ui/components/Grid';
import { Button } from '@sberdevices/ui';
export const App = () => {
return (
<Container>
<Button>Hello, Plasma!</Button>
</Container>
);
};
Библиотека предоставляет вспомогательную функциональность - utils
, mixins
, hocs
, доступную в соответствующих директориях.
Пример импорта:
import { animatedScrollToX } from '@sberdevices/ui/utils';
import { addFocus } from '@sberdevices/ui/mixins';
import { withAutoFocus } from '@sberdevices/ui/hocs';
Подробнее можно ознакомиться на страницах документации по hocs, mixins и utils.
Витрина с компонентами Storybook.
FAQs
SberDevices Design System
The npm package @sberdevices/ui receives a total of 542 weekly downloads. As such, @sberdevices/ui popularity was classified as not popular.
We found that @sberdevices/ui demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.