import React from 'react' import { Platform } from 'react-native' import styled, { css } from 'styled-components/native' import { Props as TableCellProps, SectionedTableCellTouchableHighlight } from './SectionedTableCell' type Props = { testID?: string maxHeight?: number leftAligned?: boolean bold?: boolean disabled?: boolean important?: boolean onPress: () => void first?: boolean last?: boolean title?: string } type ContainerProps = Pick & TableCellProps const Container = styled(SectionedTableCellTouchableHighlight).attrs(props => ({ underlayColor: props.theme.stylekitBorderColor, }))` padding-top: ${12}px; justify-content: center; ${({ maxHeight }) => maxHeight && css` max-height: 50px; `}; ` const ButtonContainer = styled.View`` type ButtonLabelProps = Pick const ButtonLabel = styled.Text` text-align: ${props => (props.leftAligned ? 'left' : 'center')}; text-align-vertical: center; color: ${props => { let color = Platform.OS === 'android' ? props.theme.stylekitForegroundColor : props.theme.stylekitInfoColor if (props.disabled) { color = 'gray' } else if (props.important) { color = props.theme.stylekitDangerColor } return color }}; font-size: ${props => props.theme.mainTextFontSize}px; ${({ bold }) => bold && css` font-weight: bold; `} ${({ disabled }) => disabled && css` opacity: 0.6; `} ` export const ButtonCell: React.FC = props => ( {props.title} {props.children && props.children} )