Sha256: 0372b4140c491d3229be805a00dea444c4ba1250ff66cb91cd67d1cfabe41f3b

Contents?: true

Size: 1.1 KB

Versions: 5

Compression:

Stored size: 1.1 KB

Contents

class Lanes.Components.FieldSet extends Lanes.React.Component

    getDefaultProps: ->
        expanded: true

    propTypes:
        title: React.PropTypes.string.isRequired
        expanded: React.PropTypes.bool

    getInitialState: ->
        expanded: @props.expanded

    componentWillReceiveProps: (nextProps) ->
        @setState(expanded: nextProps.expanded) if nextProps.expanded?

    toggleExpanded: ->
        @setState(expanded: not @state.expanded)

    render: ->
        colProps = _.omit(@props, 'name')
        <BS.Col {...colProps}>
            <fieldset className={
                _.classnames("collapsible", @props.className, @state.icon
                    {expanded: @state.expanded, collapsed: !@state.expanded})
            }>
                <legend onClick={@toggleExpanded}>
                    {@props.title}
                </legend>
                <BS.Collapse in={@state.expanded}>
                    <div ref="body" className="fieldset-fields">
                        {@props.children}
                    </div>
                </BS.Collapse>
            </fieldset>
        </BS.Col>

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
lanes-0.5.6 client/lanes/components/shared/FieldSet.cjsx
lanes-0.5.5 client/lanes/components/shared/FieldSet.cjsx
lanes-0.5.0 client/lanes/components/shared/FieldSet.cjsx
lanes-0.4.0 client/lanes/components/shared/FieldSet.cjsx
lanes-0.3.0 client/lanes/components/shared/FieldSet.cjsx