Fix List component styling
This commit is contained in:
@@ -2,8 +2,6 @@ import Radium from 'radium'
|
|||||||
import PropTypes from 'prop-types'
|
import PropTypes from 'prop-types'
|
||||||
import React, { Component } from 'react'
|
import React, { Component } from 'react'
|
||||||
|
|
||||||
// TODO: Refactor this to allow setting each border property separately
|
|
||||||
|
|
||||||
class Box extends Component {
|
class Box extends Component {
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
borderTop: PropTypes.object,
|
borderTop: PropTypes.object,
|
||||||
@@ -13,6 +11,7 @@ class Box extends Component {
|
|||||||
border: PropTypes.object,
|
border: PropTypes.object,
|
||||||
radius: PropTypes.number,
|
radius: PropTypes.number,
|
||||||
background: PropTypes.string,
|
background: PropTypes.string,
|
||||||
|
style: PropTypes.object,
|
||||||
children: PropTypes.node,
|
children: PropTypes.node,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -20,7 +19,7 @@ class Box extends Component {
|
|||||||
let {
|
let {
|
||||||
children, background,
|
children, background,
|
||||||
borderTop, borderBottom, borderLeft, borderRight,
|
borderTop, borderBottom, borderLeft, borderRight,
|
||||||
border, radius } = this.props
|
border, radius, style } = this.props
|
||||||
const flatten = (border) => {
|
const flatten = (border) => {
|
||||||
if (!border) {
|
if (!border) {
|
||||||
return null
|
return null
|
||||||
@@ -44,9 +43,10 @@ class Box extends Component {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div style={[
|
<div style={[
|
||||||
{ height: '100%', width: '100%', borderTop, borderBottom, borderLeft, borderRight },
|
{ height: '100%', width: '100%', boxSizing: 'border-box', borderTop, borderBottom, borderLeft, borderRight },
|
||||||
background && { backgroundColor: background },
|
background && { backgroundColor: background },
|
||||||
radius && { borderRadius: radius },
|
radius && { borderRadius: radius },
|
||||||
|
style,
|
||||||
]}>
|
]}>
|
||||||
{children}
|
{children}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ class HeaderButton extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const size = sizeInfo.headerHeight - sizeInfo.headerBorderWidth
|
const size = sizeInfo.headerHeight - 2 * sizeInfo.headerBorderWidth
|
||||||
const { onClick, icon, image } = this.props
|
const { onClick, icon, image } = this.props
|
||||||
let content = null
|
let content = null
|
||||||
|
|
||||||
|
|||||||
@@ -6,32 +6,26 @@ import { sizeInfo, colorInfo, fontInfo } from './style'
|
|||||||
|
|
||||||
class List extends Component {
|
class List extends Component {
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
children: PropTypes.node
|
children: PropTypes.node,
|
||||||
|
// data: PropTypes.array,
|
||||||
|
// render: PropTypes.func,
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { children } = this.props
|
const { children } = this.props
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div style={{
|
<Box
|
||||||
position: 'absolute',
|
border={{ width: sizeInfo.listBorderWidth, color: colorInfo.listBorder }}
|
||||||
width: '100%',
|
radius={sizeInfo.formBoxRadius} style={{
|
||||||
height: '100%',
|
position: 'absolute',
|
||||||
fontSize: fontInfo.size.large,
|
overflowY: 'hidden',
|
||||||
fontFamily: fontInfo.family,
|
fontSize: fontInfo.size.large,
|
||||||
}}>
|
fontFamily: fontInfo.family,
|
||||||
<Box
|
overflow: 'scroll',
|
||||||
border={{ width: sizeInfo.listBorderWidth, color: colorInfo.listBorder }}
|
}}>
|
||||||
radius={sizeInfo.formBoxRadius}>
|
{children}
|
||||||
<div style={{
|
</Box>
|
||||||
height: '100%',
|
|
||||||
width: '100%',
|
|
||||||
overflowY: 'scroll',
|
|
||||||
}}>
|
|
||||||
{children}
|
|
||||||
</div>
|
|
||||||
</Box>
|
|
||||||
</div>
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -48,7 +42,7 @@ List.Item = Radium(class ListItem extends Component {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div style={{
|
<div style={{
|
||||||
display: 'table-row',
|
width: '100%',
|
||||||
background: active ? colorInfo.listBackgroundActive : 'transparent',
|
background: active ? colorInfo.listBackgroundActive : 'transparent',
|
||||||
':hover': {
|
':hover': {
|
||||||
background: colorInfo.listBackgroundHover
|
background: colorInfo.listBackgroundHover
|
||||||
@@ -72,7 +66,6 @@ List.Icon = Radium(class ListIcon extends Component {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<img src={source} style={{
|
<img src={source} style={{
|
||||||
display: 'table-cell',
|
|
||||||
verticalAlign: 'middle',
|
verticalAlign: 'middle',
|
||||||
width: size,
|
width: size,
|
||||||
height: size,
|
height: size,
|
||||||
@@ -91,11 +84,8 @@ List.Text = Radium(class ListText extends Component {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<span style={{
|
<span style={{
|
||||||
display: 'table-cell',
|
|
||||||
width: '100%',
|
|
||||||
color: fontInfo.color.normal,
|
color: fontInfo.color.normal,
|
||||||
align: 'left',
|
align: 'left',
|
||||||
verticalAlign: 'middle',
|
|
||||||
textAlign: 'left',
|
textAlign: 'left',
|
||||||
cursor: 'default',
|
cursor: 'default',
|
||||||
}}>{children}</span>
|
}}>{children}</span>
|
||||||
|
|||||||
Reference in New Issue
Block a user