From f96f965a76d04b73e1f52c235eb20b576be0027a Mon Sep 17 00:00:00 2001 From: Gustavo Lelis Date: Mon, 13 Apr 2020 10:30:31 -0300 Subject: [PATCH] Small style fixes and implementation of toolbars on viewer docz page --- .../ui/src/components/SidePanel/SidePanel.jsx | 4 +- .../components/StudyBrowser/StudyBrowser.jsx | 2 +- platform/ui/src/views/Viewer/Viewer.js | 14 +- platform/ui/src/views/Viewer/Viewer.mdx | 27 ++-- .../ui/src/views/Viewer/components/Header.js | 146 ++++++++++++++++++ .../Viewer/components/ViewportToolBar.js | 97 ++++++++++++ 6 files changed, 262 insertions(+), 28 deletions(-) create mode 100644 platform/ui/src/views/Viewer/components/Header.js create mode 100644 platform/ui/src/views/Viewer/components/ViewportToolBar.js diff --git a/platform/ui/src/components/SidePanel/SidePanel.jsx b/platform/ui/src/components/SidePanel/SidePanel.jsx index 166eb6742..882fd2ad0 100644 --- a/platform/ui/src/components/SidePanel/SidePanel.jsx +++ b/platform/ui/src/components/SidePanel/SidePanel.jsx @@ -77,7 +77,7 @@ const SidePanel = ({ onClick={() => { setIsOpen(false); }} - className="flex flex-row items-center border-b-2 border-secondary-main border-secondary-light px-3 h-12 relative" + className="flex flex-row items-center border-b border-secondary-light px-3 h-12 relative" > {iconLabel} diff --git a/platform/ui/src/components/StudyBrowser/StudyBrowser.jsx b/platform/ui/src/components/StudyBrowser/StudyBrowser.jsx index 44be7a9ab..c25790019 100644 --- a/platform/ui/src/components/StudyBrowser/StudyBrowser.jsx +++ b/platform/ui/src/components/StudyBrowser/StudyBrowser.jsx @@ -20,7 +20,7 @@ const StudyBrowser = () => { return ( -
+
{ return (
- -
- -
-
+
{
- CONTENT + +
CONTENT
@@ -36,11 +39,7 @@ import { }; return (
- -
- -
-
+
-
- - -
, -
- -
, - ]} - /> +
+
+ +
+
CONTENT
{ + const [activeTool, setActiveTool] = useState(null); + const [showTooltip, setShowTooltip] = useState(null); + const tools = [ + { + id: 'Zoom', + label: 'Zoom', + icon: 'tool-zoom', + type: null, + commandName: 'setToolActive', + commandOptions: { toolName: 'Zoom' }, + }, + { + id: 'Wwwc', + label: 'Levels', + icon: 'tool-window-level', + type: null, + commandName: 'setToolActive', + commandOptions: { toolName: 'Wwwc' }, + }, + { + id: 'Pan', + label: 'Pan', + icon: 'tool-move', + type: null, + commandName: 'setToolActive', + commandOptions: { toolName: 'Pan' }, + }, + { + id: 'Capture', + label: 'Capture', + icon: 'tool-capture', + type: null, + commandName: 'setToolActive', + commandOptions: { toolName: 'Capture' }, + }, + { + id: 'Layout', + label: 'Layout', + icon: 'tool-layout', + type: null, + commandName: 'setToolActive', + commandOptions: { toolName: 'Layout' }, + }, + ]; + const renderToolbar = () => { + return tools.map((tool, i) => { + const isActive = activeTool === tool.id; + const shouldShowTooltip = showTooltip === tool.id; + return ( +
+ { + setActiveTool(tool.id); + }} + onMouseOver={() => setShowTooltip(tool.id)} + onMouseOut={() => setShowTooltip(null)} + key={tool.id} + > + + + {shouldShowTooltip && ( +
+ {tool.label} + + + +
+ )} +
+ ); + }); + }; + return ( + +
+
+
+ alert('Navigate to previous page')} + /> + + + +
+
+
+
+ {renderToolbar()} + + { + alert('Open menu'); + }} + > + + +
+
+
+ + FOR INVESTIGATIONAL USE ONLY + + {}} + > + + + + +
+
+
+ ); +}; + +export default Header; diff --git a/platform/ui/src/views/Viewer/components/ViewportToolBar.js b/platform/ui/src/views/Viewer/components/ViewportToolBar.js new file mode 100644 index 000000000..a0e5a5a51 --- /dev/null +++ b/platform/ui/src/views/Viewer/components/ViewportToolBar.js @@ -0,0 +1,97 @@ +import React, { useState } from 'react'; +import classnames from 'classnames'; + +import { Icon, IconButton } from '@ohif/ui'; + +const ViewportToolbar = () => { + const [activeTool, setActiveTool] = useState(null); + const [showTooltip, setShowTooltip] = useState(null); + const tools = [ + { + id: 'Annotate', + label: 'Annotate', + icon: 'tool-annotate', + type: null, + commandName: 'setToolActive', + commandOptions: { toolName: 'Annotate' }, + }, + { + id: 'Bidirectional', + label: 'Bidirectional', + icon: 'tool-bidirectional', + type: null, + commandName: 'setToolActive', + commandOptions: { toolName: 'Bidirectional' }, + }, + { + id: 'Elipse', + label: 'Elipse', + icon: 'tool-elipse', + type: null, + commandName: 'setToolActive', + commandOptions: { toolName: 'Elipse' }, + }, + { + id: 'Length', + label: 'Length', + icon: 'tool-length', + type: null, + commandName: 'setToolActive', + commandOptions: { toolName: 'Length' }, + }, + ]; + const renderToolbar = () => { + return tools.map((tool, i) => { + const isActive = activeTool === tool.id; + const shouldShowTooltip = showTooltip === tool.id; + return ( +
+ { + setActiveTool(tool.id); + }} + onMouseOver={() => setShowTooltip(tool.id)} + onMouseOut={() => setShowTooltip(null)} + > + + + {shouldShowTooltip && ( +
+ {tool.label} + + + +
+ )} +
+ ); + }); + }; + return ( +
+
{renderToolbar()}
+
+ ); +}; + +export default ViewportToolbar;