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

export default D.declare('view.cmp.field.LabeledField', (cfg, children)=>
  <div class={D.cls("labeled-field", {"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>
)
