create-treble-app
Advanced tools
Comparing version 0.0.23 to 0.0.24
{ | ||
"name": "create-treble-app", | ||
"version": "0.0.23", | ||
"version": "0.0.24", | ||
"main": "index.js", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -5,3 +5,3 @@ import { Children, useState, cloneElement } from 'react'; | ||
export function AccordionItem(props) { | ||
const { selected, handleClick, label, children } = props; | ||
const { selected, handleSelect, label, children } = props; | ||
@@ -11,3 +11,3 @@ return ( | ||
<div | ||
onClick={handleClick} | ||
onClick={handleSelect} | ||
className="h-12 flex flex-row space-x-1 cursor-pointer px-3 items-center" | ||
@@ -45,3 +45,6 @@ > | ||
selected: selected === idx, | ||
handleClick: () => handleSelect(idx), | ||
handleSelect: () => { | ||
if (child.props.onClick) child.props.onClick(); | ||
handleSelect(idx); | ||
}, | ||
}); | ||
@@ -48,0 +51,0 @@ }); |
@@ -1,2 +0,2 @@ | ||
import { useState, Children, cloneElement } from 'react'; | ||
import { useState, Children } from 'react'; | ||
@@ -10,3 +10,3 @@ export function TabPane(props) { | ||
const handleSelect = (idx) => setSelected(idx === selected ? undefined : idx); | ||
const handleSelect = (idx) => setSelected(idx); | ||
@@ -28,3 +28,6 @@ if (!children) return null; | ||
selected={selected === idx} | ||
onClick={() => handleSelect(idx)} | ||
onClick={() => { | ||
if (child.props.onClick) child.props.onClick(); | ||
handleSelect(idx); | ||
}} | ||
> | ||
@@ -40,6 +43,3 @@ {child.props.label} | ||
if (selected !== idx) return null; | ||
return cloneElement(child, { | ||
selected: selected === idx, | ||
handleClick: () => handleSelect(idx), | ||
}); | ||
return child; | ||
})} | ||
@@ -46,0 +46,0 @@ </div> |
42684
807