OHIF-298: Fix dropdown color in win browsers (#1981)
* ohif-298: use new select in pagination * ohif-298: add menu placement * ohif-298: update border * ohif-298: fix sticky menu Co-authored-by: Danny Brown <danny.ri.brown@gmail.com>
This commit is contained in:
parent
8cea1a04d6
commit
db39cc2fde
@ -143,6 +143,7 @@ function ViewerLayout({
|
|||||||
extensionManager,
|
extensionManager,
|
||||||
servicesManager,
|
servicesManager,
|
||||||
hotkeysManager,
|
hotkeysManager,
|
||||||
|
commandsManager,
|
||||||
// From Modes
|
// From Modes
|
||||||
leftPanels,
|
leftPanels,
|
||||||
rightPanels,
|
rightPanels,
|
||||||
|
|||||||
@ -6,7 +6,7 @@ import classNames from 'classnames';
|
|||||||
import { useHistory } from 'react-router-dom';
|
import { useHistory } from 'react-router-dom';
|
||||||
import { NavBar, Svg, Icon, IconButton, Dropdown } from '@ohif/ui';
|
import { NavBar, Svg, Icon, IconButton, Dropdown } from '@ohif/ui';
|
||||||
|
|
||||||
function Header({ children, menuOptions, isReturnEnabled }) {
|
function Header({ children, menuOptions, isReturnEnabled, isSticky }) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const history = useHistory();
|
const history = useHistory();
|
||||||
|
|
||||||
@ -17,7 +17,7 @@ function Header({ children, menuOptions, isReturnEnabled }) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<NavBar className="justify-between border-b-4 border-black">
|
<NavBar className='justify-between border-b-4 border-black' isSticky={isSticky}>
|
||||||
<div className="flex justify-between flex-1">
|
<div className="flex justify-between flex-1">
|
||||||
<div className="flex items-center">
|
<div className="flex items-center">
|
||||||
{/* // TODO: Should preserve filter/sort
|
{/* // TODO: Should preserve filter/sort
|
||||||
@ -60,12 +60,21 @@ function Header({ children, menuOptions, isReturnEnabled }) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Header.propTypes = {
|
Header.propTypes = {
|
||||||
|
menuOptions: PropTypes.arrayOf(
|
||||||
|
PropTypes.shape({
|
||||||
|
title: PropTypes.string.isRequired,
|
||||||
|
icon: PropTypes.string,
|
||||||
|
onClick: PropTypes.func.isRequired,
|
||||||
|
})
|
||||||
|
),
|
||||||
children: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
|
children: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
|
||||||
isReturnEnabled: PropTypes.bool
|
isReturnEnabled: PropTypes.bool,
|
||||||
|
isSticky: PropTypes.bool
|
||||||
};
|
};
|
||||||
|
|
||||||
Header.defaultProps = {
|
Header.defaultProps = {
|
||||||
isReturnEnabled: true
|
isReturnEnabled: true,
|
||||||
|
isSticky: false
|
||||||
};
|
};
|
||||||
|
|
||||||
export default Header;
|
export default Header;
|
||||||
|
|||||||
@ -43,9 +43,13 @@ const Select = ({
|
|||||||
onChange,
|
onChange,
|
||||||
options,
|
options,
|
||||||
placeholder,
|
placeholder,
|
||||||
|
noIcons,
|
||||||
|
menuPlacement,
|
||||||
value,
|
value,
|
||||||
}) => {
|
}) => {
|
||||||
const _components = isMulti ? { Option, MultiValue } : {};
|
const _noIconComponents = { DropdownIndicator: () => null, IndicatorSeparator: () => null };
|
||||||
|
let _components = isMulti ? { Option, MultiValue } : {};
|
||||||
|
_components = noIcons ? { ..._components, ..._noIconComponents } : _components;
|
||||||
const selectedOptions = [];
|
const selectedOptions = [];
|
||||||
|
|
||||||
// Map array of values to an array of selected options
|
// Map array of values to an array of selected options
|
||||||
@ -69,12 +73,13 @@ const Select = ({
|
|||||||
isClearable={isClearable}
|
isClearable={isClearable}
|
||||||
isMulti={isMulti}
|
isMulti={isMulti}
|
||||||
isSearchable={isSearchable}
|
isSearchable={isSearchable}
|
||||||
|
menuPlacement={menuPlacement}
|
||||||
closeMenuOnSelect={closeMenuOnSelect}
|
closeMenuOnSelect={closeMenuOnSelect}
|
||||||
hideSelectedOptions={hideSelectedOptions}
|
hideSelectedOptions={hideSelectedOptions}
|
||||||
components={_components}
|
components={_components}
|
||||||
placeholder={placeholder}
|
placeholder={placeholder}
|
||||||
options={options}
|
options={options}
|
||||||
value={isMulti ? selectedOptions : value}
|
value={value && Array.isArray(value) ? selectedOptions : value}
|
||||||
onChange={(selectedOptions, { action }) => {
|
onChange={(selectedOptions, { action }) => {
|
||||||
const newSelection = !selectedOptions.length
|
const newSelection = !selectedOptions.length
|
||||||
? selectedOptions
|
? selectedOptions
|
||||||
@ -93,6 +98,8 @@ Select.defaultProps = {
|
|||||||
isDisabled: false,
|
isDisabled: false,
|
||||||
isMulti: false,
|
isMulti: false,
|
||||||
isSearchable: true,
|
isSearchable: true,
|
||||||
|
noIcons: false,
|
||||||
|
menuPlacement: 'auto',
|
||||||
value: [],
|
value: [],
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -104,6 +111,8 @@ Select.propTypes = {
|
|||||||
isDisabled: PropTypes.bool,
|
isDisabled: PropTypes.bool,
|
||||||
isMulti: PropTypes.bool,
|
isMulti: PropTypes.bool,
|
||||||
isSearchable: PropTypes.bool,
|
isSearchable: PropTypes.bool,
|
||||||
|
noIcons: PropTypes.bool,
|
||||||
|
menuPlacement: PropTypes.oneOf(['auto', 'bottom', 'top']),
|
||||||
onChange: PropTypes.func.isRequired,
|
onChange: PropTypes.func.isRequired,
|
||||||
options: PropTypes.arrayOf(
|
options: PropTypes.arrayOf(
|
||||||
PropTypes.shape({
|
PropTypes.shape({
|
||||||
@ -112,7 +121,7 @@ Select.propTypes = {
|
|||||||
})
|
})
|
||||||
),
|
),
|
||||||
placeholder: PropTypes.string,
|
placeholder: PropTypes.string,
|
||||||
value: PropTypes.oneOfType(PropTypes.string, PropTypes.arrayOf(PropTypes.string)),
|
value: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string), PropTypes.any]),
|
||||||
};
|
};
|
||||||
|
|
||||||
export default Select;
|
export default Select;
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import React from 'react';
|
import React, { useState } from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { Button, ButtonGroup, Icon, Typography } from '../';
|
import { Button, ButtonGroup, Typography, Select } from '../';
|
||||||
|
|
||||||
const StudyListPagination = ({
|
const StudyListPagination = ({
|
||||||
onChangePage,
|
onChangePage,
|
||||||
@ -13,30 +13,33 @@ const StudyListPagination = ({
|
|||||||
onChangePage(toPage);
|
onChangePage(toPage);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const ranges = [
|
||||||
|
{ value: '25', label: '25' },
|
||||||
|
{ value: '50', label: '50' },
|
||||||
|
{ value: '100', label: '100' },
|
||||||
|
];
|
||||||
|
const [selectedRange, setSelectedRange] = useState(ranges.find(r => r.value == perPage));
|
||||||
|
const onSelectedRange = (selectedRange) => {
|
||||||
|
setSelectedRange(selectedRange);
|
||||||
|
onChangePerPage(selectedRange.value);
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="bg-black py-10">
|
<div className="bg-black py-10">
|
||||||
<div className="container m-auto relative px-8">
|
<div className="container m-auto relative px-8">
|
||||||
<div className="flex justify-between">
|
<div className="flex justify-between">
|
||||||
<div className="flex items-center">
|
<div className="flex items-center">
|
||||||
<div className="relative mr-3">
|
<Select
|
||||||
<select
|
className="relative mr-3 w-16 border-primary-main"
|
||||||
value={perPage}
|
options={ranges}
|
||||||
className="block appearance-none w-full bg-transparent border border-common-active text-white text-base px-2 pr-4 rounded leading-tight focus:outline-none h-8"
|
value={selectedRange}
|
||||||
onChange={e => onChangePerPage(e.target.value)}
|
isMulti={false}
|
||||||
onBlur={() => {}}
|
isClearable={false}
|
||||||
>
|
isSearchable={false}
|
||||||
<option value="25">25</option>
|
closeMenuOnSelect={false}
|
||||||
<option value="50">50</option>
|
hideSelectedOptions={true}
|
||||||
<option value="100">100</option>
|
onChange={onSelectedRange}
|
||||||
</select>
|
/>
|
||||||
<div className="pointer-events-none absolute inset-y-0 right-0 flex items-center px-2">
|
|
||||||
<Icon
|
|
||||||
name="arrow-down"
|
|
||||||
className="text-white"
|
|
||||||
style={{ width: 6 }}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<Typography className="text-base opacity-60">
|
<Typography className="text-base opacity-60">
|
||||||
Results per page
|
Results per page
|
||||||
</Typography>
|
</Typography>
|
||||||
@ -49,7 +52,7 @@ const StudyListPagination = ({
|
|||||||
<ButtonGroup color="primary">
|
<ButtonGroup color="primary">
|
||||||
<Button
|
<Button
|
||||||
size="initial"
|
size="initial"
|
||||||
className="border-common-active px-4 py-2 text-base"
|
className="border-primary-main px-4 py-2 text-base"
|
||||||
color="white"
|
color="white"
|
||||||
onClick={() => navigateToPage(1)}
|
onClick={() => navigateToPage(1)}
|
||||||
>
|
>
|
||||||
@ -57,13 +60,13 @@ const StudyListPagination = ({
|
|||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
size="initial"
|
size="initial"
|
||||||
className="border-common-active py-2 px-2 text-base"
|
className="border-primary-main py-2 px-2 text-base"
|
||||||
color="white"
|
color="white"
|
||||||
onClick={() => navigateToPage(currentPage - 1)}
|
onClick={() => navigateToPage(currentPage - 1)}
|
||||||
>{`< Previous`}</Button>
|
>{`< Previous`}</Button>
|
||||||
<Button
|
<Button
|
||||||
size="initial"
|
size="initial"
|
||||||
className="border-common-active py-2 px-4 text-base"
|
className="border-primary-main py-2 px-4 text-base"
|
||||||
color="white"
|
color="white"
|
||||||
onClick={() => navigateToPage(currentPage + 1)}
|
onClick={() => navigateToPage(currentPage + 1)}
|
||||||
>
|
>
|
||||||
|
|||||||
@ -377,7 +377,7 @@ function WorkList({ history, data: studies, isLoadingData, dataSource, hotkeysMa
|
|||||||
'h-screen': !hasStudies,
|
'h-screen': !hasStudies,
|
||||||
})}
|
})}
|
||||||
>
|
>
|
||||||
<Header menuOptions={menuOptions} isReturnEnabled={false} />
|
<Header isSticky menuOptions={menuOptions} isReturnEnabled={false} />
|
||||||
<StudyListFilter
|
<StudyListFilter
|
||||||
numOfStudies={numOfStudies}
|
numOfStudies={numOfStudies}
|
||||||
filtersMeta={filtersMeta}
|
filtersMeta={filtersMeta}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user