/**
 * PostCardStyle component
 *
 * Generated by coz on 2017-01-03,
 * from a template provided by apeman-asset-templates.
 *
 * @function PostCardStyle
 */
'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:post-card-style')

/** @lends PostCardStyle */
const PostCardStyle = ({
  prefix = '.post-card',
  color = DEFAULT_COLOR
}) => {
  let monoColor = isDark(color) ? 'white' : '#333'
  let data = prefixedStyle(prefix, {
    '.thread-link .link-icon': {
      backgroundColor: color,
      color: monoColor
    }
  })
  return (
    <ApStyle className='post-card-style'
             data-prefix={ prefix }
             data={ data }
    />
  )
}

export default PostCardStyle
