Sha256: b11681fd5952cb258112cc313a1484752c85a07b6b569c683b229b3018b121ec
Contents?: true
Size: 1.2 KB
Versions: 14
Compression:
Stored size: 1.2 KB
Contents
Rev.registerComponent 'Tabs', getDefaultProps: -> props = onChange: () -> # noop activeKey: null getInitialState: -> children = @getNormalizedChildren() activeTabKey = @props.activeKey activeTabKey ||= children[0].key if children.length > 0 state = activeTabKey: activeTabKey renderTab: (child) -> key = child.key className = @classSet active: key == @state.activeTabKey <dd key={key} className={className} onClick={@handleTabClick(child)}>{child.props.tab}</dd> renderContent: (child) -> newProps = key: child.key newProps.active = true if child.key == @state.activeTabKey React.addons.cloneWithProps child, newProps render: -> children = @getNormalizedChildren() dlClassName = @classSet tabs: true vertical: @props.vertical <div> <dl className={dlClassName}> {children.map @renderTab} </dl> <div className="RevTabsContent tabs-content"> {children.map @renderContent} </div> </div> handleTabClick: (activeTab) -> (e) => e.preventDefault() e.stopPropagation() @setState activeTabKey: activeTab.key e.activeTab = activeTab @props.onChange(e)
Version data entries
14 entries across 14 versions & 1 rubygems