/**
 * ThreadCardStyle component
 *
 * Generated by coz on 2017-01-03,
 * from a template provided by apeman-asset-templates.
 *
 * @function ThreadCardStyle
 */
'use strict'

import React from 'react'
import defineDebug from 'debug'
import { ThreadColorCodes } from 'ore-fol-codes'
import { ApStyle } from 'apeman-react-basic'
import { isDark } from 'acolor'
import { prefixedStyle } from 'ore-fol-helpers'

const { COLOR_A: DEFAULT_COLOR } = ThreadColorCodes
const debug = defineDebug('project:fragment:thread-card-style')

/** @lends ThreadCardStyle */
const ThreadCardStyle = ({
  prefix = '.thread-card',
  color = DEFAULT_COLOR
}) => {
  let monoColor = isDark(color) ? 'white' : '#333'
  let transparentColor = 'transparent'
  let inheritColor = 'inherit'
  let data = prefixedStyle(prefix, {
    '.card-inner': {
      background: color,
      color: monoColor
    },
    '.card-info-table th': {
      color: monoColor,
      fontWeight: 'bold'
    },
    '.card-info-table td': {
      color: monoColor
    },
    '.card-image-col': {
      borderColor: color
    }
  })
  return (
    <ApStyle className='thread-card-style'
             data-prefix={ prefix }
             data={ data }
    />
  )
}

export default ThreadCardStyle
