2.4.5 • Published 11 months ago

@belray-ventec/geslub-platform-react-ui v2.4.5

Weekly downloads
-
License
MIT
Repository
github
Last release
11 months ago

geslub-platform-react-ui

Instalar libreria

npm i @belray-ventec/geslub-platform-react-ui

Modo de uso

Table

import { Table } from 'geslub-platform-react-ui';

export default function Component(): {

	return (
			<Table
			data={[{id: 1, name: 'ProductName', price. 21},
			{id: 2, name: 	'ProductName2', price. 50}
			]}
			columns={[{label: 'name', getValue: (item) => item.name}, {label: 'price', getValue: (item) => item.price}]}
			getRowKey={(item) => item.id}
			onDelete={(items) = {console.log(items)}}
			/>
	)

}
PropiedadTipoDescripciónRequerida
dataT[]si
columns{ label: string; getValue: (item: T) => React.ReactNode, isCentered?: boolean; hiddenSort?: boolean }[]si
getRowKey(d: T) => string numbersi
onDelete(d: T[]) => voidno
itemsPerPagenumberno
actionslabel: string; callback: (d: T) => void }[]no
themeColorstringno
showPagesbooleanno
showHeaderButtonsbooleanno
showAdminOptionsbooleanno
showInfobooleanno
showSharebooleanno
showDownloadbooleanno
showDisabledbooleanMuestra el boton de deshabilitar/habilitar registrono
showSeebooleanno
captionstringno
add() => voidno
share() => voidno
onEdit(d: T) => voidno
onDeleteItem(d: T) => voidno
onSee(d: T) => voidno
onDownload(d: T) => voidno
onInfo(d: T) => voidno
onShare(d: T) => voidno
onDisabled(d: T) => voidCallback que regresa el item para ser deshabilitadono
onEnabled(d: T) => voidCallback que regresa el item para ser habilitadono
getRowIsEnabled(d: T) => booleanCallback para especificar que propiedad es la que definira el estado de habilitado/deshabilitado de la filano
isLoadingbooleanno

Search

import { Search } from 'geslub-platform-react-ui';

export default function Component(): {

	const onSearchFn = (search: string) => { console.log(search) }

	return (
            <Search
                handleSearch={(search: string) => onSearchFn(search)}
                timeDebounce={500}
            />
	)

}
PropiedadTipoRequerida
handleSearch(search: string) => voidsi
timeDebouncenumberno

Tag

import { Tag } from 'geslub-platform-react-ui';

export default function Component(): {

	const onClickFn = () => {}

	return (
            <Tag color='#fff' backgroundColor='#00a65a' onClick={() => onClickFn()}>Editar</Tag>
	)

}
PropiedadTipoRequerida
colorstringno
backgroundColornumberno
onClick(text: string) => voidno

TagList

import { TagList } from 'geslub-platform-react-ui';

export default function Component(): {

	const tags = [{id:1, name: 'Tag 1'}, {id:1, name: 'Tag 2'}]

	return (
            <TagList
			data={tags}
			getRowKey={(tag) => tag.id}
		    getValue={(tag) => tag.name}
			align='left'
			rounded
			 />
	)

}
PropiedadTipoRequerida
dataT[]si
getRowKey(d: T) => string numbersi
getValue(d: T) => string numbersi
backgroundColornumberno
colorstringno
onClick(item: string) => voidno
roundedbooleanno
align'left' 'center' 'right'no

Drawer

import React, { useState } from 'react';
import { Link } from "react-router-dom";
import { Drawer, DrawerItem, DrawerSubItem } from 'geslub-platform-react-ui';

export default function Component(): {

  const [isOpen, setIsOpen] = useState(false);

  const SUB_MENU = [{
                      label: 'Home',
                      icon: <Icon icon="Home" size={25} color='#fff' /> ,
                      to: '/'
                    },
                    {
                      label: "Lubricantes Especiales",
                      icon: <Icon icon='Document' size={25} color='#fff'/>,
                      sub: [
                        { label: "Información técnica", to: '/informacion-tecnica' },
                        { label: "Certificados", to: '/certificados' },
                        { label: "Marketing", to: '/marketing' },
                        { label: "Testimoniales", to: '/testimoniales' },
                        { label: "OEM", to: '/oem' },
                        ],
                      }]

	return (
                <Drawer
                    title="Geslub Platform"
                    isOpen={isOpen}

                    onStateChange={() => setIsOpen(!isOpen)}
                />

                {SUB_MENU.map((listItem) =>
                  listItem.sub ? (
                    <DrawerSubItem
                      title={listItem.label}
                      isOpen={isOpen}
                      onStateChange={() => setIsOpen(!isOpen)}
                      key={listItem.label}
                      icon={listItem.icon}
                    >
                    {listItem.sub.map((subItem) => (
                      <Link to={subItem.to}>
                          <DrawerItem
                            isOpen={isOpen}
                            key={subItem.label}
                            icon={subItem.icon}
                          >
                            {subItem.label}
                          </DrawerItem>
                      </Link>
                    ))}
                    </DrawerSubItem>
                  ) : (
                    <Link to={listItem.to}>
                        <DrawerItem
                          isOpen={isOpen}
                          key={listItem.label}
                          icon={listItem.icon}
                          isActive={listItem.isActive}
                        >
                          {listItem.label}
                        </DrawerItem>
                    </Link>
                  )

                </Drawer>
				<App />
	)

}
PropiedadTipoDescripcionRequerida
isOpenbooleansi
onStateChange() => voidManeja el estado del Drawer (setState(!state))si
titleReactNodeno
logostringno
themeColorstringno
childrenReactNodeContenido del Drawer se suguiere utilizar el componente DrawerItem o DrawerSubItemsi
onLogoClick() => voidno

DrawerItem

PropiedadTipoDescripcionRequerida
isOpenbooleansi
iconReactNodeManeja el estado del Drawer (setState(!state))no
isActivebooleanEstablece de color el item activono
childrenstringTitulono

Modal

import React, { useState } from 'react';
import { Modal } from 'geslub-platform-react-ui';

export default function Component(): {

	const [isModalOpen, setIsModalOpen] = useState(false);

    const closeModal = () => {
    setIsModalOpen(false);
  };

	return (
                <div>
      <button
      onClick={() => setIsModalOpen(true)}
      />
      <Modal
        title={'Modal Title'}
        isOpen={isModalOpen}
        onRequestClose={closeModal}
        position={'top'}
        size={'medium'}
        show
        okText={'Guardar'}
        cancelText={'Cancelar'}
        onOk={() => console.log('ok')}
        onCancel={() => console.log('cancel')}
      >
        <h2>Modal Title H2</h2>
        <p>
          Lorem ipsum dolor sit amet consectetur adipisicing elit. Quasi, culpa,
          odio doloribus ratione sed soluta explicabo id nam ea quas cumque. Odio
          non accusamus dignissimos praesentium deleniti nulla, perferendis illum.
          Aut consequatur culpa sequi odio sunt voluptatem explicabo, labore
        </p>
      </Modal>
    </div>
PropiedadTipoRequerida
isOpenbooleansi
onRequestClose() => voidsi
titlestringsi
position'top'\|'center'\|'bottom'no
size'small'\|'medium'\|'large'\|'extra_large'\|'full'no
okTextstringno
cancelTextstringno
onOk() => voidno
showOkbooleanno
onCancel() => voidno
themeColorstringno
childrenReactNodeno
2.4.3

11 months ago

2.4.2

11 months ago

2.4.5

11 months ago

2.4.4

11 months ago

2.3.8

1 year ago

2.3.7

1 year ago

2.3.9

1 year ago

2.4.1

1 year ago

2.4.0

1 year ago

2.3.6

1 year ago

2.3.10

1 year ago

2.3.5

1 year ago

2.3.4

1 year ago

2.3.3

1 year ago

2.3.2

1 year ago

2.3.1

1 year ago

2.3.0

1 year ago

0.1.0

1 year ago