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

bpk-component-button

Package Overview
Dependencies
Maintainers
1
Versions
562
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bpk-component-button - npm Package Compare versions

Comparing version 0.0.7 to 0.0.8

2

package.json
{
"name": "bpk-component-button",
"version": "0.0.7",
"version": "0.0.8",
"description": "Backpack button component.",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -10,3 +10,3 @@ jest.unmock('./BpkButton')

const wrapper = shallow(<BpkButton>My button</BpkButton>)
expect(wrapper.children().length).toEqual(1)
expect(wrapper.text()).toEqual('My button')
expect(wrapper.name()).toEqual('button')

@@ -17,3 +17,3 @@ })

const wrapper = shallow(<BpkButton href='#'>My button</BpkButton>)
expect(wrapper.children().length).toEqual(1)
expect(wrapper.text()).toEqual('My button')
expect(wrapper.name()).toEqual('a')

@@ -20,0 +20,0 @@ expect(wrapper.prop('href')).toEqual('#')

import React, { PropTypes } from 'react'
import './bpk-button.scss'
const BpkButton = ({ href, submit, secondary, selected, large, link, ...rest }) => {
const BpkButton = ({ children, disabled, href, submit, secondary, selected, large, link, onClick }) => {
const classNames = [ 'bpk-button' ]

@@ -15,10 +15,26 @@

if (href) {
return <a href={href} className={className} {...rest} />
return <a
href={href}
className={className}
children={children}
onClick={onClick}
/>
}
return <button type={submit ? 'submit' : 'button'} className={className} {...rest} />
return <button
type={submit ? 'submit' : 'button'}
disabled={disabled}
className={className}
children={children}
onClick={onClick}
/>
}
BpkButton.propTypes = {
children: PropTypes.oneOfType([
PropTypes.arrayOf(PropTypes.node),
PropTypes.node
]).isRequired,
href: PropTypes.string,
disabled: PropTypes.bool,
submit: PropTypes.bool,

@@ -28,6 +44,9 @@ secondary: PropTypes.bool,

large: PropTypes.bool,
link: PropTypes.bool
link: PropTypes.bool,
onClick: PropTypes.func
}
BpkButton.defaultProps = {
href: null,
disabled: false,
submit: false,

@@ -37,5 +56,6 @@ secondary: false,

large: false,
link: false
link: false,
onClick: null
}
export default BpkButton
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