bem / yandex-ui-themer

A simple way to create your theme for @yandex/ui with Themekit

Home Page:https://bem.github.io/yandex-ui-themer

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

yandex-ui-themer

A simple way to create your theme for @yandex/ui with Themekit

How to add new component to Theme Constructor

  1. Update @yandex/ui to version where the component is introduced
npm i @yandex/ui@latest
  1. Rebuild theme tokens
npm ci
npm run tokens:build
  1. Add new component into componentList in themekit.config.js

NOTE: It is better to add components in alphabetical order.

const componentsList = [
  "attach",
  "badge",
  ...,
  "componentName"
  ...
]
  1. Add the showcase for the component in src/components/Showcase/Showcases/ComponentShowcase.tsx

NOTE: Showcase should cover all possible tokens of the component. Otherwise, designers could not tune all of the tokens in Theme Constructor.

import React from 'react';
import { Component } from '@yandex/ui/Component/desktop/bundle';

import { Headline } from '../../Headline';

export const ComponentShowcase = () => {
    return (
        <Headline>ComponentName</Headline>
        <div className="Showcase-Item">
            <Component />
        </div>
    )
}
  1. Add the component showcase to componentsMap in src/components/Showcase/Showcase.tsx
import { ComponentShowcase } from './Showcases/ComponentShowcase';

const componentsMap: Record<string, ComponentType> = {
    button: ButtonShowcase,
    buttonGroup: ButtonGroupShowcase,
    ...,
    component: ComponentShowcase,
    ...
}

License

MPL-2.0

About

A simple way to create your theme for @yandex/ui with Themekit

https://bem.github.io/yandex-ui-themer

License:Other


Languages

Language:TypeScript 84.0%Language:JavaScript 10.3%Language:CSS 4.2%Language:HTML 1.5%Language:Shell 0.0%