1.1.8 • Published 5 years ago

rbs-react-ui-components v1.1.8

Weekly downloads
220
License
-
Repository
-
Last release
5 years ago

Набор React-компонентов для внутренней разработки РБС

Установка

npm install --save-dev rbs-react-ui-components

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

Для использования иконок нужно подключить шрифты с иконками из библиотеки.

import icomoonTtf from 'rbs-react-ui-components/Icon/icomoon/icomoon.ttf';
import icomoonWoff from 'rbs-react-ui-components/Icon/icomoon/icomoon.woff';
import icomoonSvg from 'rbs-react-ui-components/Icon/icomoon/icomoon.svg';

Для компонентов предусмотрена частичная темизация (изменение базовых цветов, обводок, размеров), основанная на ThemeProvider из библиотеки styled-components https://www.styled-components.com/docs/advanced#theming. Основные параметры описаны в src/components/core/themes/base.js. Свойствами темы является обычный объект, его можно расширять и изменять, перезаписывая текущие значения. Например, изменение базовой палитры и частичное изменение размеров тултипа:

const theme = {
  global: {
    accentColors: {
      default: 'blue',
      action: 'orange',
      negative: 'red',
      positive: 'green',
    },
  },
  tooltip: {
    sizes: {
      s: {
        fontSize: '10px',
        padding: '6px 10px',
      },
      m: {
        fontSize: '16px',
        padding: '12px 14px',
      },
    },
  },
}
import React, { Fragment } from 'react'
import { createGlobalStyle } from 'styled-components'

import { Theme } from 'rbs-react-ui-components'
import Button from 'rbs-react-ui-components/Button'

import robotoRegular from '*/fonts/font_roboto_regular.ttf'
import robotoThin from '*/fonts/font_roboto_thin.ttf'
import robotoLight from '*/fonts/font_roboto_light.ttf'
import robotoMedium from '*/fonts/font_roboto_medium.ttf'

import icomoonTtf from 'rbs-react-ui-components/Icon/icomoon/icomoon.ttf';
import icomoonWoff from 'rbs-react-ui-components/Icon/icomoon/icomoon.woff';
import icomoonSvg from 'rbs-react-ui-components/Icon/icomoon/icomoon.svg';

const GlobalStyle = createGlobalStyle`
  @font-face {
    font-family: 'rbsOldIcons';
    src:
      url('${icomoonTtf}?yct89m') format('truetype'),
      url('${icomoonWoff}?yct89m') format('woff'),
      url('${icomoonSvg}?yct89m#icomoon') format('svg');
    font-weight: normal;
    font-style: normal;
  }

  @font-face {
    font-family: 'Roboto';
    font-style: normal;
    font-weight: 100;
    src: url(${robotoThin});
  }

  @font-face {
    font-family: 'Roboto';
    font-style: normal;
    font-weight: 300;
    src: url(${robotoLight});
  }

  @font-face {
    font-family: 'Roboto';
    font-style: normal;
    font-weight: 400;
    src: url(${robotoRegular});
  }

  @font-face {
    font-family: 'Roboto';
    font-style: normal;
    font-weight: 500;
    src: url(${robotoMedium});
  }
`

const theme = {
  global: {
    accentColors: {
      default: 'blue',
      action: 'orange',
      negative: 'red',
      positive: 'green',
    },
  },
  tooltip: {
    sizes: {
      s: {
        fontSize: '10px',
        padding: '6px 10px',
      },
      m: {
        fontSize: '16px',
        padding: '12px 14px',
      },
    },
  },
};

export const App = () => (
  <Theme theme={theme}>
    <Fragment>
      <GlobalStyle />
      <div>
        <h2>Welcome to React</h2>
        <Button />
      </div>
    </Fragment>
  </Theme>
)
1.1.8

5 years ago

1.1.7

5 years ago

1.1.6

5 years ago

0.4.5

5 years ago

1.1.5

5 years ago

0.4.4

5 years ago

0.4.2

5 years ago

1.1.4

5 years ago

1.1.3

5 years ago

1.1.2

5 years ago

1.1.0

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago

0.5.1

5 years ago

0.4.1

6 years ago

0.4.0

6 years ago

0.3.2

6 years ago

0.3.1

6 years ago

0.3.0

6 years ago

0.2.9

6 years ago

0.2.8

6 years ago

0.2.7

6 years ago

0.2.6

6 years ago

0.2.5

7 years ago

0.2.4

7 years ago

0.2.3

7 years ago

0.2.2

7 years ago

0.2.1

7 years ago

0.2.0

7 years ago

0.1.13

7 years ago

0.1.12

7 years ago

0.1.11

7 years ago

0.1.10

7 years ago

0.1.9

7 years ago

0.1.8

7 years ago

0.1.7

7 years ago

0.1.6

7 years ago

0.1.5

7 years ago

0.1.4

7 years ago

0.1.3

7 years ago

0.1.2

7 years ago

0.1.1

7 years ago

0.0.16

7 years ago

0.0.15

7 years ago

0.0.14

7 years ago

0.0.12

7 years ago

0.0.11

7 years ago

0.0.9

7 years ago

0.0.8

7 years ago

0.0.7

7 years ago

0.0.6

7 years ago

0.0.5

7 years ago

0.0.4

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago