|
|
@ -36,7 +36,7 @@ export const TabsUI = (props: TabsUIProps) => { |
|
|
|
const classNameImg = 'my-1 mr-1 text-dark ' + tab.iconClass |
|
|
|
const classNameImg = 'my-1 mr-1 text-dark ' + tab.iconClass |
|
|
|
const classNameTab = 'nav-item nav-link d-flex justify-content-center align-items-center px-2 py-1 tab' + (index === currentIndexRef.current ? ' active' : '') |
|
|
|
const classNameTab = 'nav-item nav-link d-flex justify-content-center align-items-center px-2 py-1 tab' + (index === currentIndexRef.current ? ' active' : '') |
|
|
|
return ( |
|
|
|
return ( |
|
|
|
<div onClick={() => { props.onSelect(index); currentIndexRef.current = index; setSelectedIndex(index) }} ref={el => { tabsRef.current[index] = el }} className={classNameTab} title={tab.tooltip}> |
|
|
|
<div ref={el => { tabsRef.current[index] = el }} className={classNameTab} title={tab.tooltip}> |
|
|
|
{tab.icon ? (<img className="my-1 mr-1 iconImage" src={tab.icon} />) : (<i className={classNameImg}></i>)} |
|
|
|
{tab.icon ? (<img className="my-1 mr-1 iconImage" src={tab.icon} />) : (<i className={classNameImg}></i>)} |
|
|
|
<span className="title-tabs">{tab.title}</span> |
|
|
|
<span className="title-tabs">{tab.title}</span> |
|
|
|
<span className="close-tabs" onClick={(event) => { props.onClose(index); event.stopPropagation() }}> |
|
|
|
<span className="close-tabs" onClick={(event) => { props.onClose(index); event.stopPropagation() }}> |
|
|
@ -88,6 +88,11 @@ export const TabsUI = (props: TabsUIProps) => { |
|
|
|
tabsElement.current = domEl |
|
|
|
tabsElement.current = domEl |
|
|
|
tabsElement.current.addEventListener('wheel', transformScroll) |
|
|
|
tabsElement.current.addEventListener('wheel', transformScroll) |
|
|
|
}} |
|
|
|
}} |
|
|
|
|
|
|
|
onSelect={(index) => { |
|
|
|
|
|
|
|
props.onSelect(index) |
|
|
|
|
|
|
|
currentIndexRef.current = index |
|
|
|
|
|
|
|
setSelectedIndex(index) |
|
|
|
|
|
|
|
}} |
|
|
|
> |
|
|
|
> |
|
|
|
<TabList className="d-flex flex-row align-items-center"> |
|
|
|
<TabList className="d-flex flex-row align-items-center"> |
|
|
|
{props.tabs.map((tab, i) => <Tab className="py-1" key={tab.name}>{renderTab(tab, i)}</Tab>)} |
|
|
|
{props.tabs.map((tab, i) => <Tab className="py-1" key={tab.name}>{renderTab(tab, i)}</Tab>)} |
|
|
|