Skip to content

Instantly share code, notes, and snippets.

@johno
Created February 28, 2017 02:31
Show Gist options
  • Save johno/70af17127e5d8ebbaae1134c915f619a to your computer and use it in GitHub Desktop.
Save johno/70af17127e5d8ebbaae1134c915f619a to your computer and use it in GitHub Desktop.
Component based styling rather than css writing with Tachyons
import React from 'react'
export default ({ props, className }) => {
const border = 'ba br3 outline-0'
const spacing = 'ph4 pv3'
const color = 'white hover-near-white bg-red hover-bg-dark-red b--dark-red'
return (
<a
className={`input-reset grow pointer ${border} ${spacing} ${color} ${className}`}
{...props}
/>
)
}
import React from 'react'
export default ({ props, className }) => {
const border = 'ba br3 outline-0'
const spacing = 'ph4 pv3'
const color = 'white hover-near-white bg-blue hover-bg-dark-blue b--dark-blue'
return (
<a
className={`input-reset grow pointer ${border} ${spacing} ${color} ${className}`}
{...props}
/>
)
}
import React from 'react'
import PrimaryButton from './primary-button'
import DangerButton from './danger-button'
export default () => (
<div>
<h1>Hello, world!</h1>
<PrimaryButton>
Yessss!
</PrimaryButton>
<DangerButton>
NOOOOO
</DangerButton>
</div>
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment