fix dropdown title
This commit is contained in:
parent
db0ce2f6f7
commit
a19c1acd7b
@ -67,8 +67,20 @@ function Header({ children }) {
|
|||||||
{t('Header:INVESTIGATIONAL USE ONLY')}
|
{t('Header:INVESTIGATIONAL USE ONLY')}
|
||||||
</span>
|
</span>
|
||||||
<Dropdown
|
<Dropdown
|
||||||
titleElement={
|
showDropdownIcon={false}
|
||||||
<>
|
list={[
|
||||||
|
{
|
||||||
|
title: t('Header:About'),
|
||||||
|
icon: 'info',
|
||||||
|
onClick: showAboutModal,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: t('Header:Preferences'),
|
||||||
|
icon: 'settings',
|
||||||
|
onClick: showPreferencesModal,
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
>
|
||||||
<IconButton
|
<IconButton
|
||||||
variant="text"
|
variant="text"
|
||||||
color="inherit"
|
color="inherit"
|
||||||
@ -85,21 +97,7 @@ function Header({ children }) {
|
|||||||
>
|
>
|
||||||
<Icon name="chevron-down" />
|
<Icon name="chevron-down" />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
</>
|
</Dropdown>
|
||||||
}
|
|
||||||
list={[
|
|
||||||
{
|
|
||||||
title: t('Header:About'),
|
|
||||||
icon: 'info',
|
|
||||||
onClick: showAboutModal,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: t('Header:Preferences'),
|
|
||||||
icon: 'settings',
|
|
||||||
onClick: showPreferencesModal,
|
|
||||||
},
|
|
||||||
]}
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</NavBar>
|
</NavBar>
|
||||||
|
|||||||
@ -4,19 +4,17 @@ import classnames from 'classnames';
|
|||||||
|
|
||||||
import { Icon, Typography } from '@ohif/ui';
|
import { Icon, Typography } from '@ohif/ui';
|
||||||
|
|
||||||
const Dropdown = ({ titleElement, title, list }) => {
|
const Dropdown = ({ children, showDropdownIcon, list }) => {
|
||||||
const [open, setOpen] = useState(false);
|
const [open, setOpen] = useState(false);
|
||||||
const element = useRef(null);
|
const element = useRef(null);
|
||||||
|
|
||||||
const renderTitleElement = () => {
|
const renderTitleElement = () => {
|
||||||
if (titleElement) {
|
|
||||||
return titleElement;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex">
|
<div className="flex text-white items-center">
|
||||||
<Typography>{title}</Typography>
|
{children}
|
||||||
|
{showDropdownIcon && (
|
||||||
<Icon name="chevron-down" className="text-white ml-1" />
|
<Icon name="chevron-down" className="text-white ml-1" />
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
@ -96,9 +94,13 @@ const Dropdown = ({ titleElement, title, list }) => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Dropdown.defaultProps = {
|
||||||
|
showDropdownIcon: true,
|
||||||
|
};
|
||||||
|
|
||||||
Dropdown.propTypes = {
|
Dropdown.propTypes = {
|
||||||
titleElement: PropTypes.node,
|
children: PropTypes.node.isRequired,
|
||||||
title: PropTypes.string,
|
showDropdownIcon: PropTypes.bool,
|
||||||
/** Items to render in the select's drop down */
|
/** Items to render in the select's drop down */
|
||||||
list: PropTypes.arrayOf(
|
list: PropTypes.arrayOf(
|
||||||
PropTypes.shape({
|
PropTypes.shape({
|
||||||
|
|||||||
@ -23,8 +23,16 @@ const PreferencesDropdown = () => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Dropdown
|
<Dropdown
|
||||||
titleElement={
|
showDropdownIcon={false}
|
||||||
<>
|
list={[
|
||||||
|
{ title: 'About', icon: 'info', onClick: showAboutModal },
|
||||||
|
{
|
||||||
|
title: 'Preferences',
|
||||||
|
icon: 'settings',
|
||||||
|
onClick: showPreferencesModal,
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
>
|
||||||
<IconButton
|
<IconButton
|
||||||
variant="text"
|
variant="text"
|
||||||
color="inherit"
|
color="inherit"
|
||||||
@ -42,17 +50,7 @@ const PreferencesDropdown = () => {
|
|||||||
>
|
>
|
||||||
<Icon name="chevron-down" />
|
<Icon name="chevron-down" />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
</>
|
</Dropdown>
|
||||||
}
|
|
||||||
list={[
|
|
||||||
{ title: 'About', icon: 'info', onClick: showAboutModal },
|
|
||||||
{
|
|
||||||
title: 'Preferences',
|
|
||||||
icon: 'settings',
|
|
||||||
onClick: showPreferencesModal,
|
|
||||||
},
|
|
||||||
]}
|
|
||||||
/>
|
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user