Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added labelBefore to bootstrap themes #36

Merged
merged 5 commits into from
Jun 28, 2016

Conversation

zeroasterisk
Copy link
Contributor

@zeroasterisk zeroasterisk commented Jun 17, 2016

The modifyProps function is just an idea, but easiest to communicate this way....

@radekmie
Copy link
Contributor

I'm generally against such wrappers, so how about this:

const Bool = ({label, labelBefore, ...props}) =>
    <FormGroup label={labelBefore} {...props}>
        <section className={classnames(props.inputClassName, `checkbox${props.inline ? '-inline' : ''}`)}>
            <label htmlFor={props.id}>
                <input
                    checked={props.value}
                    disabled={props.disabled}
                    id={props.id}
                    name={props.name}
                    onChange={() => props.onChange(!props.value)}
                    type="checkbox"
                />&nbsp;
                {label}
            </label>
        </section>
    </FormGroup>
;

It will pass your labelBefore (or as you already named it labelLeft) to the <FormGroup />, and leave it's current label,

@@ -15,7 +15,7 @@ const Bool = props =>
name={props.name}
onChange={() => props.onChange(!props.value)}
type="checkbox"
/>
/>&nbsp;
{props.label}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now props.label is always undefined - change it to label.

@zeroasterisk
Copy link
Contributor Author

updated... better?

@radekmie
Copy link
Contributor

Great!

@radekmie radekmie merged commit c4e54e6 into vazco:master Jun 28, 2016
@radekmie radekmie changed the title Dev issue 35 label left Added labelBefore to bootstrap themes Sep 14, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Feature New features and feature requests
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants