Skip to content

Instantly share code, notes, and snippets.

@gisderdube
Created January 21, 2019 11:52
Show Gist options
  • Save gisderdube/27176eec5000bcd6968e03a4032aa47d to your computer and use it in GitHub Desktop.
Save gisderdube/27176eec5000bcd6968e03a4032aa47d to your computer and use it in GitHub Desktop.
import React from 'react'
import Button from './Button.jsx'
const Application = () => {
return (
<div>
<Button>Click me</Button>
<Button secondary>Click me</Button>
<Button inverse big>
Click me
</Button>
</div>
)
}
import React from 'react'
import styled, { css } from 'styled-components'
const StyledButton = styled.button`
border-radius: 5px;
background-color: ${props => (props.secondary ? '#F7A072' : '#a1cdf1')};
color: #fff;
padding: 10px 15px;
font-size: ${props => {
if (props.big) return '20px'
return '16px'
}};
outline: none;
border: none;
cursor: pointer;
margin: 15px;
border: 2px solid ${props => (props.secondary ? '#F7A072' : '#a1cdf1')};
${props => {
return (
props.inverse &&
css`
background-color: #fff;
color: #a1cdf1;
`
)
}}
`
const Button = ({ secondary, big, inverse, ...props }) => {
return (
<StyledButton
secondary={secondary}
big={big}
inverse={inverse}
{...props}
/>
)
}
export default Button
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment