Skip to content

Instantly share code, notes, and snippets.

@pward123
Created February 17, 2017 16:41
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save pward123/0c67499fdb07117eae29b53d17253e53 to your computer and use it in GitHub Desktop.
Save pward123/0c67499fdb07117eae29b53d17253e53 to your computer and use it in GitHub Desktop.
tachyons list using styled-components
import React, { PropTypes } from 'react'
import styled from 'styled-components'
import t from 'tachyons-js'
export const List = ({
className,
children,
}) => (
<ul className={className}>
{React.Children.map(children, (child) => (
<li>
{child}
</li>
))}
</ul>
)
List.propTypes = {
className: PropTypes.string.isRequired,
children : PropTypes.oneOfType([
PropTypes.arrayOf(PropTypes.node),
PropTypes.node,
]).isRequired,
}
export const BlockItemDottedBorderList = styled(List)`
${{
...t.list,
...t.pl0,
...t.measure,
...t.center,
}}
li {${{
...t.lh_copy,
...t.pv3,
...t.ba,
...t.bl_0,
...t.bt_0,
...t.br_0,
...t.b__dotted,
...t.b__black_30,
}}}
`
const BorderList = styled(List)`
${{
...t.list,
...t.pl0,
...t.ml0,
...t.center,
...t.ba,
...t.b__light_silver,
}}
li {${{
...t.ph3,
}}}
li:not(:last-child) {${{
...t.bb,
...t.b__light_silver,
}}}
`
export const BorderSpacedList = styled(BorderList)`
${{
...t.mw6,
...t.br2,
}}
li {${{
...t.pv3,
}}}
`
export const BorderTightList = styled(BorderList)`
${{
...t.mw5,
...t.br3,
}}
li {${{
...t.pv2,
}}}
`
export default BlockItemDottedBorderList
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment