Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cnk-animating-button-bar

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cnk-animating-button-bar

An animated button bar component for React

  • 1.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
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

Package last updated on 05 Feb 2019

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc