1.0.11 • Published 2 years ago

@jswork/react-breadcrumb v1.0.11

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

react-breadcrumb

Breadcrumb for react.

version license size download

installation

npm install -S @jswork/react-breadcrumb

usage

  1. import css

    @import "~@jswork/react-breadcrumb/dist/style.css";
    
    // or use sass
    @import "~@jswork/react-breadcrumb/dist/style.scss";
    
    // customize your styles:
    $react-breadcrumb-options: ()
  2. import js

    import React from 'react';
    import ReactBreadcrumb from '../../src/main';
    import styled from 'styled-components';
    
    const Container = styled.div`
      width: 80%;
      margin: 30px auto 0;
    `;
    
    export default () => {
      const items = [
        { label: '课程', value: '/course', data: {} },
        { label: 'Gneius', value: '/course/gneius', data: {} },
        { label: 'Gneius English1', value: null, data: {} }
      ];
    
      const templateCustomize = ({ item, plain }, cb) => {
        const { value, label } = item;
        const handler = () => {
          if (!plain) {
            console.log(item);
          }
        };
    
        const child = plain ? label : <button className="button" children={label} />;
    
        return (
          <span key={value} onClick={handler} className="is-item">
            {child}
            {cb()}
          </span>
        );
      };
    
      return (
        <Container>
          <ReactBreadcrumb items={items} template={templateCustomize} />
        </Container>
      );
    };

preview

license

Code released under the MIT license.

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.11

2 years ago

1.0.10

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago