feat(toolbar): new Toolbar to enable reactive state synchronization (#3983)

This commit is contained in:
Alireza authored and GitHub committed 2024-03-27 16:01:32 -04:00
1 parent 79d5c36bda
commit 566b25a544
155 files changed
+6311 -6577

No files matched your search

@@ -2,24 +2,25 @@ import React, { useState } from 'react';
import classnames from 'classnames';
import PropTypes from 'prop-types';
const flex = 'flex flex-row justify-between items-center';
const theme = 'bg-indigo-dark text-white';
const ListMenu = ({ items = [], renderer, onClick }) => {
const [selectedIndex, setSelectedIndex] = useState(null);
const ListItem = ({ item, index, isSelected }) => {
const flex = 'flex flex-row justify-between items-center';
const theme = 'bg-indigo-dark';
const onClickHandler = () => {
setSelectedIndex(index);
onClick({ item, selectedIndex: index });
if (item.onClick) {
item.onClick({ ...item, index, isSelected });
}
item.onClick?.({ ...item, index, isSelected });
};
return (
<div
className={classnames(flex, theme, 'cursor-pointer')}
className={classnames(flex, theme, {
'cursor-pointer': !item.disabled,
'ohif-disabled': item.disabled,
})}
onClick={onClickHandler}
data-cy={item.id}
>