Initial changes for SidePanel
This commit is contained in:
parent
c902ba201f
commit
8be7854118
@ -27,6 +27,7 @@ export {
|
|||||||
Label,
|
Label,
|
||||||
NavBar,
|
NavBar,
|
||||||
Select,
|
Select,
|
||||||
|
SidePanel,
|
||||||
StudyListExpandedRow,
|
StudyListExpandedRow,
|
||||||
StudyListPagination,
|
StudyListPagination,
|
||||||
StudyListTable,
|
StudyListTable,
|
||||||
@ -41,5 +42,4 @@ export {
|
|||||||
} from './src/components';
|
} from './src/components';
|
||||||
|
|
||||||
/** VIEWS */
|
/** VIEWS */
|
||||||
export { StudyList } from './src/views';
|
export { StudyList, Viewer } from './src/views';
|
||||||
export { ModalProvider, ModalConsumer, useModal, withModal, utils };
|
|
||||||
|
|||||||
80
platform/ui/src/components/SidePanel/SidePanel.jsx
Normal file
80
platform/ui/src/components/SidePanel/SidePanel.jsx
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
import React, { useState } from 'react';
|
||||||
|
import PropTypes from 'prop-types';
|
||||||
|
import classnames from 'classnames';
|
||||||
|
|
||||||
|
import { Button, Icon } from '@ohif/ui';
|
||||||
|
|
||||||
|
const baseStyle = {
|
||||||
|
maxWidth: '320px',
|
||||||
|
};
|
||||||
|
|
||||||
|
const dynamicStyle = {
|
||||||
|
open: {
|
||||||
|
left: {},
|
||||||
|
right: {},
|
||||||
|
},
|
||||||
|
closed: {
|
||||||
|
left: {},
|
||||||
|
right: {},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
const sideClasses = {
|
||||||
|
left: 'border-r-1',
|
||||||
|
right: 'border-l-1',
|
||||||
|
};
|
||||||
|
|
||||||
|
const baseClassName =
|
||||||
|
'transition-all duration-300 ease-in-out h-100 bg-primary-light border-black';
|
||||||
|
|
||||||
|
const SidePanel = ({
|
||||||
|
side,
|
||||||
|
className,
|
||||||
|
children,
|
||||||
|
defaultIsOpen,
|
||||||
|
componentName,
|
||||||
|
iconName,
|
||||||
|
}) => {
|
||||||
|
const [isOpen, setIsOpen] = useState(defaultIsOpen);
|
||||||
|
|
||||||
|
const style = Object.assign({}, isOpen ? openStyle : closedStyle, baseStyle);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
className={classnames(className, baseClassName, sideClasses[side])}
|
||||||
|
style={style}
|
||||||
|
>
|
||||||
|
{isOpen ? (
|
||||||
|
<React.Fragment>
|
||||||
|
<div className="border-b-1">
|
||||||
|
{componentName}
|
||||||
|
<Button onClick={() => setIsOpen(false)}>
|
||||||
|
<Icon name="chevron-right" />
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
{children}
|
||||||
|
</React.Fragment>
|
||||||
|
) : (
|
||||||
|
<Button onClick={() => setIsOpen(true)}>
|
||||||
|
<div>
|
||||||
|
<Icon name={iconName} />
|
||||||
|
{componentName}
|
||||||
|
</div>
|
||||||
|
</Button>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
SidePanel.defaultProps = {
|
||||||
|
defaultIsOpen: false,
|
||||||
|
};
|
||||||
|
|
||||||
|
SidePanel.propTypes = {
|
||||||
|
side: PropTypes.oneOf(['left', 'right']).isRequired,
|
||||||
|
className: PropTypes.string,
|
||||||
|
children: PropTypes.node,
|
||||||
|
isOpen: PropTypes.bool,
|
||||||
|
};
|
||||||
|
|
||||||
|
export default SidePanel;
|
||||||
2
platform/ui/src/components/SidePanel/index.js
Normal file
2
platform/ui/src/components/SidePanel/index.js
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
import SidePanel from './SidePanel';
|
||||||
|
export default SidePanel;
|
||||||
@ -13,6 +13,7 @@ import InputText from './InputText';
|
|||||||
import Label from './Label';
|
import Label from './Label';
|
||||||
import NavBar from './NavBar';
|
import NavBar from './NavBar';
|
||||||
import Select from './Select';
|
import Select from './Select';
|
||||||
|
import SidePanel from './SidePanel';
|
||||||
import Svg from './Svg';
|
import Svg from './Svg';
|
||||||
import StudyListExpandedRow from './StudyListExpandedRow';
|
import StudyListExpandedRow from './StudyListExpandedRow';
|
||||||
import StudyListPagination from './StudyListPagination';
|
import StudyListPagination from './StudyListPagination';
|
||||||
@ -41,6 +42,7 @@ export {
|
|||||||
Label,
|
Label,
|
||||||
NavBar,
|
NavBar,
|
||||||
Select,
|
Select,
|
||||||
|
SidePanel,
|
||||||
Svg,
|
Svg,
|
||||||
StudyListExpandedRow,
|
StudyListExpandedRow,
|
||||||
StudyListPagination,
|
StudyListPagination,
|
||||||
|
|||||||
40
platform/ui/src/views/Viewer/Viewer.js
Normal file
40
platform/ui/src/views/Viewer/Viewer.js
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { NavBar, SidePanel, Svg } from '@ohif/ui';
|
||||||
|
|
||||||
|
const Viewer = () => {
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<NavBar className="justify-start">
|
||||||
|
<div className="m-3">
|
||||||
|
<Svg name="logo-ohif" />
|
||||||
|
</div>
|
||||||
|
</NavBar>
|
||||||
|
<div
|
||||||
|
className="flex flex-row flex-no-wrap flex-1 items-stretch overflow-hidden w-full"
|
||||||
|
style={{ height: 'calc(100vh - 57px' }}
|
||||||
|
>
|
||||||
|
<SidePanel
|
||||||
|
side="left"
|
||||||
|
className="h-100 bg-primary-light border-r-1 border-black"
|
||||||
|
iconName="launch-arrow"
|
||||||
|
componentName="Study List"
|
||||||
|
>
|
||||||
|
<div>GUSTAVO</div>
|
||||||
|
</SidePanel>
|
||||||
|
<div className="flex-1 h-100 overflow-hidden w-100 bg-black">
|
||||||
|
CONTENT
|
||||||
|
</div>
|
||||||
|
<SidePanel
|
||||||
|
side="right"
|
||||||
|
className="h-100 bg-primary-light border-l-1 border-black"
|
||||||
|
iconName="launch-arrow"
|
||||||
|
componentName="Measurements"
|
||||||
|
>
|
||||||
|
<div>GUSTAVO DO OUTRO LADO</div>
|
||||||
|
</SidePanel>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default Viewer;
|
||||||
14
platform/ui/src/views/Viewer/Viewer.mdx
Normal file
14
platform/ui/src/views/Viewer/Viewer.mdx
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
---
|
||||||
|
name: Viewer
|
||||||
|
menu: Views
|
||||||
|
route: views/viewer
|
||||||
|
---
|
||||||
|
|
||||||
|
import { Playground, Props } from 'docz';
|
||||||
|
import { Viewer } from '@ohif/ui';
|
||||||
|
|
||||||
|
# Viewer
|
||||||
|
|
||||||
|
<Playground>
|
||||||
|
<Viewer />
|
||||||
|
</Playground>
|
||||||
2
platform/ui/src/views/Viewer/index.js
Normal file
2
platform/ui/src/views/Viewer/index.js
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
import Viewer from './Viewer';
|
||||||
|
export default Viewer;
|
||||||
@ -1,3 +1,4 @@
|
|||||||
import StudyList from './StudyList';
|
import StudyList from './StudyList';
|
||||||
|
import Viewer from './Viewer';
|
||||||
|
|
||||||
export { StudyList };
|
export { StudyList, Viewer };
|
||||||
|
|||||||
@ -1,12 +1,12 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { ThemeWrapper } from '@ohif/ui';
|
import { ThemeWrapper, Viewer } from '@ohif/ui';
|
||||||
|
|
||||||
import ConnectedStudyList from './connectedComponents/ConnectedStudyList';
|
import ConnectedStudyList from './connectedComponents/ConnectedStudyList';
|
||||||
|
|
||||||
const App = () => {
|
const App = () => {
|
||||||
return (
|
return (
|
||||||
<ThemeWrapper>
|
<ThemeWrapper>
|
||||||
<ConnectedStudyList />
|
<Viewer />
|
||||||
</ThemeWrapper>
|
</ThemeWrapper>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user