From 8f566c7ef425ef1ecb92cbcef5bcabf9b63f0df6 Mon Sep 17 00:00:00 2001 From: Rodrigo Antinarelli Date: Fri, 17 Apr 2020 17:31:12 -0300 Subject: [PATCH] update toolbar documentation page --- .../ui/src/components/Toolbar/Toolbar.mdx | 55 ++++++++- .../ToolbarSecondary/ToolbarSecondary.mdx | 112 ------------------ 2 files changed, 52 insertions(+), 115 deletions(-) delete mode 100644 platform/ui/src/views/ToolbarSecondary/ToolbarSecondary.mdx diff --git a/platform/ui/src/components/Toolbar/Toolbar.mdx b/platform/ui/src/components/Toolbar/Toolbar.mdx index 27c1aa54c..f6837e83c 100644 --- a/platform/ui/src/components/Toolbar/Toolbar.mdx +++ b/platform/ui/src/components/Toolbar/Toolbar.mdx @@ -7,7 +7,7 @@ route: components/toolbar import { useState } from 'react'; import { Playground, Props } from 'docz'; import classnames from 'classnames'; -import { Toolbar } from '@ohif/ui'; +import { Toolbar, Typography } from '@ohif/ui'; # Toolbar @@ -110,9 +110,58 @@ import { Toolbar } from '@ohif/ui'; onClick: () => setActiveTool('Layout 2'), }, ]; + const secondaryTools = [ + { + id: 'Annotate', + label: 'Annotate', + icon: 'tool-annotate', + type: null, + commandName: 'setToolActive', + commandOptions: { toolName: 'Annotate' }, + onClick: () => console.log('Activate Annotate'), + }, + { + id: 'Bidirectional', + label: 'Bidirectional', + icon: 'tool-bidirectional', + type: null, + commandName: 'setToolActive', + commandOptions: { toolName: 'Bidirectional' }, + onClick: () => console.log('Activate Bidirectional'), + }, + { + id: 'Elipse', + label: 'Elipse', + icon: 'tool-elipse', + type: null, + commandName: 'setToolActive', + commandOptions: { toolName: 'Elipse' }, + onClick: () => console.log('Activate Elipse'), + }, + { + id: 'Length', + label: 'Length', + icon: 'tool-length', + type: null, + commandName: 'setToolActive', + commandOptions: { toolName: 'Length' }, + onClick: () => console.log('Activate Length'), + }, + ]; return ( -
- +
+
+ Primary Toolbar + +
+
+ Secondary Toolbar + +
); }} diff --git a/platform/ui/src/views/ToolbarSecondary/ToolbarSecondary.mdx b/platform/ui/src/views/ToolbarSecondary/ToolbarSecondary.mdx deleted file mode 100644 index 3f99d593a..000000000 --- a/platform/ui/src/views/ToolbarSecondary/ToolbarSecondary.mdx +++ /dev/null @@ -1,112 +0,0 @@ ---- -name: Toolbar Secondary -menu: Views -route: examples/toolbarSecondary ---- - -import { useState } from 'react'; -import { Playground } from 'docz'; -import classnames from 'classnames'; -import { Icon, IconButton } from '@ohif/ui'; - -# Toolbar Secondary - -This example shows you how you can build a Toolbar using the available -components. - -## Basic usage - - - {() => { - 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()}
-
-
- ); - }} -