import Radium from 'radium' import PropTypes from 'prop-types' import React, { Component } from 'react' import { Box, Icon } from '.' import { sizeInfo, colorInfo, fontInfo } from './style' @Radium export class List extends Component { static propTypes = { data: PropTypes.array, render: PropTypes.func.isRequired, } render() { const { data, render } = this.props return ( {data ? data.map(render) : null} ) } } List.Item = Radium(class ListItem extends Component { static propTypes = { children: PropTypes.node, active: PropTypes.bool, onClick: PropTypes.func } render() { const { children, active, onClick } = this.props return (
{children}
) } }) List.Icon = Radium(class ListIcon extends Component { static propTypes = { name: PropTypes.string, size: PropTypes.number, } render() { const { size, name } = this.props let source = Icon.svgs[name] || Icon.svgs['placeholder'] return ( ) } }) List.Text = Radium(class ListText extends Component { static propTypes = { children: PropTypes.node, } render() { const { children } = this.props return ( {children} ) } })