Socket
Socket
Sign inDemoInstall

cnk-animating-button-bar

Package Overview
Dependencies
15
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    cnk-animating-button-bar

An animated button bar component for React


Version published
Maintainers
1
Install size
35.9 MB
Created

Changelog

Source

v1.0.1 (2019-02-05)

  • Readme was updated with preview

Readme

Source

cnk-animating-button-bar

An animated button bar component for React

NPM

Install

npm install --save cnk-animating-button-bar

Usage

import React, { Component } from "react";

import ButtonBar, {
  MaterialDesignIcons as Icons
} from "cnk-animating-button-bar";

const buttons = [
  {
    icon: <Icons.MdLayers />,
    text: "Home",
    color: "#9C27B0"
  },
  {
    icon: <Icons.MdFavoriteBorder />,
    text: "Likes",
    color: "#E91E63"
  },
  {
    icon: <Icons.MdSearch />,
    text: "Search",
    color: "#FFC107"
  },
  {
    icon: <Icons.MdPermIdentity />,
    text: "Profile",
    color: "#2196F3"
  }
];

export default class App extends Component {
  constructor(props) {
    super(props);

    this.state = {
      panelIndex: -1
    };
  }

  render() {
    const self = this;
    const { panelIndex } = self.state;
    return (
      <div style={{ display: "flex", flexDirection: "column", flex: 1 }}>
        <div
          style={{
            flex: 1,
            backgroundColor: "#F5F5F5",
            display: "flex",
            alignItems: "center",
            justifyContent: "center"
          }}
        >
          {panelIndex === -1 && "Welcome"}
          {panelIndex === 0 && "Home"}
          {panelIndex === 1 && "Likes"}
          {panelIndex === 2 && "Search"}
          {panelIndex === 3 && "Profile"}
        </div>
        <ButtonBar
          buttons={buttons}
          defaultIndex={panelIndex}
          onSelectionChange={index => {
            self.setState({ panelIndex: index });
          }}
          enableDeselect={true}
        />
      </div>
    );
  }
}

Preview

License

MIT © ceyhunkeklik

FAQs

Last updated on 05 Feb 2019

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc