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