Missing file

This commit is contained in:
Erik Ziegler 2020-05-15 14:30:47 +02:00
parent f3f50d11fe
commit 264a72b566
3 changed files with 53 additions and 7 deletions

View File

@ -0,0 +1,46 @@
---
name: StudyItem
menu: General
route: components/studyItem
---
import { useState } from 'react';
import { Playground, Props } from 'docz';
import { StudyItem } from '@ohif/ui';
# StudyItem
Used to expose study information as a card
## Import
```javascript
import { StudyItem } from '@ohif/ui';
```
## Basic usage
<Playground>
{() => {
const [studyActive, setStudyActive] = useState(null);
return (
<div className="flex flex-1 items-center justify-center p-4">
<div className="w-56">
<StudyItem
studyInstanceUid="1"
date="07-Sept-2010"
description="CHEST/ABD/PELVIS W/CONTRAST"
numInstances={902}
modalities="CT,SR"
isActive={studyActive}
onClick={() => setStudyActive(studyActive === '1' ? null : '1')}
/>
</div>
</div>
);
}}
</Playground>
## Properties
<Props of={StudyItem} />

View File

@ -15,7 +15,7 @@ export const Layout = ({ children }) => {
const nav = useRef(); const nav = useRef();
const handleSidebarToggle = () => { const handleSidebarToggle = () => {
setSidebarOpen((s) => !s); setSidebarOpen(s => !s);
}; };
return ( return (

View File

@ -15,7 +15,7 @@ export const Sidebar = React.forwardRef((props, ref) => {
const menus = useMenus({ query }); const menus = useMenus({ query });
const currentDoc = useCurrentDoc(); const currentDoc = useCurrentDoc();
const currentDocRef = useRef(); const currentDocRef = useRef();
const handleChange = (ev) => { const handleChange = ev => {
setQuery(ev.target.value); setQuery(ev.target.value);
}; };
useEffect(() => { useEffect(() => {
@ -46,20 +46,20 @@ export const Sidebar = React.forwardRef((props, ref) => {
}; };
const renderMenuCategories = () => { const renderMenuCategories = () => {
return Object.keys(customMenus).map((menuName) => { return Object.keys(customMenus).map(menuName => {
return ( return (
<div key={menuName}> <div key={menuName}>
<h2 className="pl-2 border-l-8 -ml-4 border-secondary-active"> <h2 className="pl-2 border-l-8 -ml-4 border-secondary-active">
{menuName} {menuName}
</h2> </h2>
{customMenus[menuName].map((item) => item)} {customMenus[menuName].map(item => item)}
</div> </div>
); );
}); });
}; };
const getMenuCategory = (menuName) => { const getMenuCategory = menuName => {
return Object.keys(MENU_CATEGORIES).find((category) => { return Object.keys(MENU_CATEGORIES).find(category => {
if (MENU_CATEGORIES[category].includes(menuName)) { if (MENU_CATEGORIES[category].includes(menuName)) {
return category; return category;
} }
@ -99,7 +99,7 @@ export const Sidebar = React.forwardRef((props, ref) => {
onChange={handleChange} onChange={handleChange}
/> />
{menus && {menus &&
menus.map((menu) => { menus.map(menu => {
const isGroup = !!menu.menu; const isGroup = !!menu.menu;
const Component = isGroup ? NavGroup : NavLink; const Component = isGroup ? NavGroup : NavLink;
const menuCategory = getMenuCategory(menu.name) || null; const menuCategory = getMenuCategory(menu.name) || null;