Sha256: 9a60138781e93a65e37a4250adb4307aea16ce765a492fd2523115e73eab26a8
Contents?: true
Size: 1.11 KB
Versions: 22
Compression:
Stored size: 1.11 KB
Contents
Rev.registerComponent 'TabsAccordion', getDefaultProps: -> props = onChange: () -> # noop activeKey: null getInitialState: -> children = @getNormalizedChildren() activeTabKey = @props.activeKey activeTabKey ||= children[0].key if children.length > 0 state = activeTabKey: activeTabKey render: -> children = @getNormalizedChildren() <ul className="RevAccordion accordion">{children.map @renderChild}</ul> renderChild: (child) -> key = child.key active = key == @state.activeTabKey className = @classSet "RevTabsAccordion": true "RevTabsAccordion is-active": true "accordion-navigation": true "active": active tab = React.addons.cloneWithProps child.props.tab, onClick: @handleTabClick child content = React.addons.cloneWithProps child, active: active <li key={key} className={className}> {tab} {content} </li> handleTabClick: (activeTab) -> (e) => e.preventDefault() e.stopPropagation() @setState activeTabKey: activeTab.key e.activeTab = activeTab @props.onChange(e)
Version data entries
22 entries across 22 versions & 1 rubygems