Sha256: f868577ead060efaeaaeb384f6e516b234d1adfeb97d51f16197b54a1c7f0927

Contents?: true

Size: 1.07 KB

Versions: 2

Compression:

Stored size: 1.07 KB

Contents

import React from 'react'
import classnames from 'classnames'
import { Caption } from "../"

type TextareaProps = {
  className?: String,
  children?: Array<React.ReactChild>,
  data?: String,
  id?: String,
  object?: String,
  method?: String,
  label?: String,
  placeholder?: String,
  value?: String,
  name?: String,
  rows?: Number,
  dark?: Boolean,
}

const textareaCSS =({
    dark=false,
}: TextareaProps) => {
  const themeStyle = dark === true ? '_dark' : ''
  return 'pb_textarea_kit' + themeStyle
}

const Textarea = ( props: TextareaProps) => {

  const {
    className,
    children,
    label,
    placeholder,
    value,
    dark=false,
    rows=4,
    name,
  } = props

  const textarea_input = `${textareaCSS(props)}`
  
  return (
    <div className={classnames(textareaCSS(props), className)}>
      <Caption text={label} dark={dark}/>
      <If condition={children}>
        {children}
      <Else/>
        <textarea className={textarea_input} name={name} placeholder={placeholder} rows={rows} value={value} />
      </If>
    </div>
  )
}

export default Textarea

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
playbook_ui-3.0.1 app/pb_kits/playbook/pb_textarea/_textarea.jsx
playbook_ui-3.0.0 app/pb_kits/playbook/pb_textarea/_textarea.jsx