Skip to content

Instantly share code, notes, and snippets.

@ernestofreyreg
Created August 4, 2017 09:21
Show Gist options
  • Save ernestofreyreg/1505985d24d37165eb015e4d4523b718 to your computer and use it in GitHub Desktop.
Save ernestofreyreg/1505985d24d37165eb015e4d4523b718 to your computer and use it in GitHub Desktop.
import React from 'react'
const isUrgent = title => {
if (title[0] === '!') {
return true
}
if (title[title.length - 1] === '!') {
return true
}
return false
}
const Button = ({title, onClick}) => (
<button className={`Button ${isUrgent(title) && 'urgent'}`} onClick={onClick}>
{title}
{/*language=CSS*/}
<style jsx>{`
.Button {
background-color: #007dff;
color: white;
padding: 4px 10px;
font-size: 14px;
border: none;
border-radius: 4px;
}
.Button.urgent {
background-color: red;
}
`}</style>
</button>
)
export {Button}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment