Sha256: 48653342b012a29249c4d06f2744c7a76f93995dd27c1e9df3fcf89185e3e109
Contents?: true
Size: 1.31 KB
Versions: 2
Compression:
Stored size: 1.31 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 componentWillReceiveProps: (nextProps)-> @setState activeTabKey: nextProps.activeKey if nextProps.activeKey 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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
revelry_core-0.1.6.8 | app/assets/javascripts/revelry/ui/tabs/Tabs.js.cjsx |
revelry_core-0.1.6.7 | app/assets/javascripts/revelry/ui/tabs/Tabs.js.cjsx |