UNPKG

1.39 kBJavaScriptView Raw
1import React from 'react'
2import PropTypes from 'prop-types'
3import styled, { css } from 'styled-components'
4
5import { theme } from 'SRC/core/theme'
6
7const inline = css`
8flex-direction: row;
9 > li {
10 margin-left: 2rem;
11 margin-right: 0.5rem;
12 &:last-of-type {
13 margin-right: 0;
14 }
15 }
16`
17
18const UL = styled(({className, children}) => {
19 return (
20 <ul className={className}>
21 {children}
22 </ul>
23 )
24})`
25 display: flex;
26 ${props => props.inline ? inline : `flex-direction: column;`}
27 color: ${props => props.color};
28 ${props => props.image ? `list-style-image: url(${props.image});` : ''}
29 ${props => props.leftPad ? `padding-left: ${props.leftPad}` : ''}
30 list-style-type: ${props => props.type};
31 list-style-position: ${props => props.outside ? 'outside' : 'inside'};
32 font-size: ${props => props.fontSize};
33 ${props => (props.direction === 'row') }
34 > li {
35 height: ${props => props.itemHeight};
36 }
37`
38
39UL.propTypes = {
40 color: PropTypes.string,
41 itemHeight: PropTypes.string,
42 inline: PropTypes.bool,
43 image: PropTypes.string,
44 fontSize: PropTypes.string,
45 leftPad: PropTypes.string,
46 outside: PropTypes.bool,
47 type: PropTypes.string
48}
49
50UL.defaultProps = {
51 color: theme.colors.rocketBlue,
52 itemHeight: 'auto',
53 fontSize: '1.6rem',
54 leftPad: '4rem',
55 outside: true,
56 type: 'disc'
57}
58
59/** @component */
60export default UL