import './LabeledField.scss';
import Input from './Input.jsx';

export default D.declare('view.cmp.field.LabeledField', (cfg, children)=> {
  console.log(cfg.invalid)
  return <div class={D.cls( "labeled-field", cfg.cls, { "labeled-field--invalid": cfg.invalid } )}>
    <label class="labeled-field__label">
      <span class="labeled-field__label-text">{cfg.label}</span>
      <Input class="labeled-field__input" type={cfg.type} placeholder={cfg.placeholder} {...cfg}/>
    </label>
    {children}
  </div>
})
