Created
August 4, 2017 09:21
-
-
Save ernestofreyreg/1505985d24d37165eb015e4d4523b718 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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