1.0.32 • Published 2 years ago

pk-rtu-mirea-ui-library v1.0.32

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

pk-rtu-mirea-ui-library

Library of UI components used for the site of the admissions office of RTU MIREA

NPM JavaScript Style Guide

This UI library was developed for using at sites of admission committee RTU MIREA. Here you can find different UI Components such as:

  • Loading screen
  • Button
  • Text field
  • Select dropdown
  • Tag element
  • Mobile Pop Up (beta)

Install

npm install --save pk-rtu-mirea-ui-library

Usage

After installation you can start create your amazing products. Here is the example:

import React from 'react'

import { Loading } from 'pk-rtu-mirea-ui-library'

const App = () => {
  return (
    <Loading fullscreen />
  )
}

Let's look at each component separately

Loading screen

This is a simple screen that can be displayed while loading data

Props

OptionDescriptionValueDefault value
fullscreenThis option allows you to position the loading screen in the center of the browser window.Boolfalse
textThis option allows you to display the text on the loading screenString"Пожалуйста, подождите! Идет загрузка..."

Example

import React from 'react'

import { Loading } from 'pk-rtu-mirea-ui-library'

const App = () => {
  return (
    <Loading text={"Please wait..."} fullscreen />
  )
}

Tag

This is a simple tag

Props

OptionDescriptionValueDefault value
fullWidthSets width of tag to 100% of parentBoolfalse
wordWrapSets white-space to 'break-spaces'Boolfalse
sizeSets the size of the tag'small', 'medium' or 'large''medium'
bgColorSets background color of tagString (hex color)#f9b233
textColorSets text color of tagString (hex color)#fff
childrenContent of tagChildren-
hintShows hint on hoverJSx element-
hintPositionSet position of hint based on parent'top', 'left', 'right', 'bottom''left;
crossButtonEnables cross in tagBoolfalse
handleCrossFunction on cross clickingFunc-
crossColorSets color of crossString#ffffff

Example

import React from 'react'

import { Tag } from 'pk-rtu-mirea-ui-library'

const App = () => {
  return (
    <Tag 
      size={'small'}
      bgColor={"#000"}
      textColor={"#fff"}
      wordWrap
      fullWidth
    >
      <p>My Tag</p>
    </Tag>
  )
}

Button

This is button component

Props

OptionDescriptionValueDefault value
fullWidthSets width of button to 100% of parentBoolfalse
fullHeightSets height of button to 100% of parentBoolfalse
sizeSets the size of the button'small', 'medium' or 'large''medium'
bgColorSets background color of tagString (hex color)#f9b233
textColorSets text color color of tagString (hex color)#fff
disabledMakes the button inactiveBoolfalse
onClickFunction at the push of a buttonfunc()=>{}
childrenContent of buttonChildren-

Example

import React from 'react'

import { Button } from 'pk-rtu-mirea-ui-library'

const App = () => {
  return (
    <Button 
      size='small'
      bgColor='#000'
      textColor='#fff'
      onClick={() => { handleClear(); this.handleClearLocal(); }}
      disabled
      fullWidth
      fullHeight
    >
      <p>My Button </p>
    </Button>
  )
}

TextField

Props

OptionDescriptionValueDefault value
fullHeightSets height of button to 100% of parentBoolfalse
sizeSets the size of the button'small' or 'medium''medium'
onChangeFunction at the changing valueFunc()=>{}
placeholderText when value == ""String-
valueValue of text fieldString-

Example

import React from 'react'

import { TextField } from 'pk-rtu-mirea-ui-library'

const App = () => {
  return (
    <TextField
      placeholder={"Поиск..."}
      size={"medium"}
      value={searchText}
      onChange={this.searchHandle}
      fullHeight
    />
  )
}

Select

Props

Bold is for required options

OptionDescriptionValueDefault value
listList of displayed itemsArray of objects-
valueKeyKey of value in list of itemsString-
onChangeList item selection functionFunc-
placeholderText of Select header when value is undefinedString-
displayValueText of Select header when value is not undefinedString-
selectValueUser-selected valueObject-
isMultiSets the ability to select multiple itemsBoolfalse
sizeSets the size of the Select'small' or 'medium''medium'
textColorSet color of textstring#000
selectColorBackground of item on hoverString#f9b233
searchableSets the ability to search in a dropdown listBoolfalse
noWrapSelectHeaderSets white-space of Select header to 'break-spaces'Boolfalse
fullHeightSets height of button to 100% of parentBoolfalse
disabledMakes the button inactiveBoolfalse
disabledAlertText of alert if disabled == trueBool-
listIconSets the ability to display svg iconBoolfalse
iconArrayArray of svg icons (listItem.id == List.id)Array-
iconColorSet color of svg iconstring#f9b233

Example

import React, { useState } from 'react'

import { Select } from 'pk-rtu-mirea-ui-library'
import radio from "./img/radio.svg"
import it from './img/it.svg'
import chem from './img/chem.svg'
import law from './img/law.svg'

const List = [
  { id: 1, val: 'text 1' },
  { id: 2, val: 'text 2' },
  { id: 3, val: 'text 3' },
  { id: 4, val: 'text 4' }
]

const iconArray=[
  { id: 1, path: radio },
  { id: 2, path: it },
  { id: 3, path: chem },
  { id: 4, path: law }
]

const App = () => {
  const [object, setObject] = useState({})

  return (
    <Select
      placeholder={'Not selected...'}
      selectValue={object}
      displayValue={object.val}
      list={List}
      valueKey={"val"}
      onChange={setObject}
      fullHeight
      disabled
      disabledAlert={"ha-ha select is disabled"}
    />
  )
}

Mobile Pop Up (beta)

Props

OptionDescriptionValueDefault value
buttonTextText of button for open Pop UpString-
headerHeader of Pop UpString-
childrenContent of Pop UpChildren-

Example

import React from 'react'

import { MobilePopUp } from 'pk-rtu-mirea-ui-library'

const App = () => {
  return (
    <MobilePopUp buttonText={'Open'} header={'Header'}>
      <p>Hi 1</p>
    </MobilePopUp>
  )
}

License

MIT © slavaklevleev

1.0.26

2 years ago

1.0.29

2 years ago

1.0.28

2 years ago

1.0.27

2 years ago

1.0.32

2 years ago

1.0.31

2 years ago

1.0.30

2 years ago

1.0.19

2 years ago

1.0.18

2 years ago

1.0.17

2 years ago

1.0.22

2 years ago

1.0.21

2 years ago

1.0.20

2 years ago

1.0.25

2 years ago

1.0.24

2 years ago

1.0.23

2 years ago

1.0.16

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.11

2 years ago

1.0.10

2 years ago

1.0.15

2 years ago

1.0.14

2 years ago

1.0.13

2 years ago

1.0.12

2 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago