0.6.0 • Published 6 years ago

fr8-searchbar v0.6.0

Weekly downloads
4
License
MIT
Repository
-
Last release
6 years ago

fr8-searchbar

Fr8 searchbar React component

Usage:

import React from 'react';
import ReactDOM from 'react-dom';
import { SearchBar } from 'fr8-searchbar';
import { darken } from 'polished';
import { wrapText } from 'fr8-searchbar/lib/utils';

const fetchedData = [
  {
    id: 'id1',
    name: 'FedEx',
    dotNumber: '123456789',
    mcNumber: '1234567',
  },
  {
    id: 'id2',
    name: 'Federal Department of',
    dotNumber: '123456789',
    mcNumber: '1234567',
  },
];

const testDataFeed = (value) =>
  fetchedData.filter((rowProps) => rowProps.name.toUpperCase().includes(value.toUpperCase()));

const Example = (props) => (
  <div key="keyRoot" style={{ width: '240px', height: '32px', padding: 0 }}>
    <SearchBar
      key="keySearchBar"
      bg="white"
      inputBg="white"
      inputColor="black"
      buttonColor="black"
      placeholder="Search here..."
      border="2px solid #005ede"
      borderRadius="2px"
      tableHeader={[
        { name: 'Business Name', width: '2fr', key: 'name' },
        { name: 'DOT Number', width: '1fr', key: 'dotNum' },
        { name: 'MC Number', width: '1fr', key: 'mcNum' },
      ]}
      headerColor="#4a90e2"
      hoverBg="rgba(148, 183, 230, 0.5)"
      hoverColor="#364147"
      activeBg={darken(0.5, 'rgba(148, 183, 230, 0.8)')}
      activeColor={darken(0.5, '#364147')}
      dataFeed={testDataFeed}
      rowIdKey="id"
      nameKey="name"
      onChange={() => {}}
      dataWrapper={(value) => wrapText(value)}
      animationTime={700}
    />
  </div>
);

ReactDOM.render(<Example />, document, getElementById('root'));

or see storybook inside library project

Development

Install dependencies

yarn

Config Storybook/CLI localy

npm i -g @storybook/cli
cd <path to repository>/fr8-searchbar
getstorybook

Start Storybook:

yarn storybook

Build Storybook:

yarn build-storybook

Build for staging/production:

yarn build

or build with watching for changes:

yarn build:watch

Lint:

yarn lint

or lint with watching for changes:

yarn lint:watch

Publish:

yarn publish
0.7.3

6 years ago

0.7.2

6 years ago

0.7.1

6 years ago

0.7.0

6 years ago

0.6.0

6 years ago

0.5.1

6 years ago

0.4.6

6 years ago

0.4.5

6 years ago

0.4.4

6 years ago

0.4.3

6 years ago

0.4.2

6 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.27

6 years ago

0.2.26

6 years ago

0.2.25

6 years ago

0.2.24

6 years ago

0.2.23

6 years ago

0.2.22

6 years ago

0.2.21

6 years ago

0.2.20

6 years ago

0.2.19

6 years ago

0.2.18

6 years ago

0.2.17

6 years ago

0.2.16

6 years ago

0.2.15

6 years ago

0.2.14

6 years ago

0.2.13

6 years ago

0.2.12

6 years ago

0.2.11

6 years ago

0.2.10

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

6 years ago

0.2.4

6 years ago

0.2.3

6 years ago

0.2.2

6 years ago

0.2.1

6 years ago

0.2.0

6 years ago

0.1.4

6 years ago

0.1.3

6 years ago

0.1.2

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago

0.0.6

6 years ago

0.0.5

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago