Skip to content

Label gets too many props #41

@jbinto

Description

@jbinto

While writing integration tests I noticed Label is getting way too many props from its parent, Input (output below is from Enzyme's .debug()):

<FriggingBootstrap.Label title="City" label="City" placeholder="City" layout="vertical" align="left" name="city" validate={true} disabled={false} errors={[undefined]} onChange={[Function]} onValidChange={[Function]} saved={[undefined]} value="Sunnyvale" theme={{...}} options={{...}} modified={false} labelHtml={{...}} inputHtml={{...}} valueLink={{...}} xs={12} sm={[undefined]} md={[undefined]} lg={[undefined]} xsOffset={[undefined]} smOffset={[undefined]} mdOffset={[undefined]} lgOffset={[undefined]} block={false} labelWidth={{...}} prefix={[undefined]} suffix={[undefined]} onColor="primary" onText="ON" offColor="default" offText="OFF" bsSize={[undefined]} handleWidth={[undefined]} format="0,0[.][00]">
  <div>
    <label saved={[undefined]} modified={false} block={false} validate={true} format="0,0[.][00]" theme={{...}} label="City" md={[undefined]} value="Sunnyvale" options={{...}} onColor="primary" sm={[undefined]} title="City" disabled={false} mdOffset={[undefined]} inputHtml={{...}} labelWidth={{...}} align="left" suffix={[undefined]} bsSize={[undefined]} lg={[undefined]} onText="ON" onValidChange={[Function]} placeholder="City" prefix={[undefined]} errors={[undefined]} layout="vertical" labelHtml={{...}} offColor="default" xsOffset={[undefined]} smOffset={[undefined]} lgOffset={[undefined]} name="city" offText="OFF" valueLink={{...}} handleWidth={[undefined]} xs={12} onChange={[Function]} className="">
      City
    </label>
  </div>
</FriggingBootstrap.Label>

This is probably just a simple overuse of ...props but it's probably worth going through these (use of ...props everywhere) more carefully, and consider being explicit instead.

It also shouldn't pass down any props at all to the HTML <label>.

While we're at it, things like xsOffset, mdOffset, etc. really should be on a bootstrap object (and maybe even on context instead of props).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions