feat: Toolbar Header
This commit is contained in:
1 parent
f8bbee22b7
commit
b3dff5ddee
11 files changed
+208
-17
No files matched your search
@@ -1,24 +0,0 @@
|
||||
import React from 'react';
|
||||
import classnames from 'classnames';
|
||||
import tailwindConfig from '../../../tailwind.config';
|
||||
|
||||
const BackgroundColor = ({ color }) => {
|
||||
const getColorValue = () => {
|
||||
const currentColor = color.split('-');
|
||||
const { colors } = tailwindConfig.theme;
|
||||
return colors[currentColor[0]][currentColor[1]];
|
||||
};
|
||||
console.log(tailwindConfig);
|
||||
return (
|
||||
<div
|
||||
className={classnames(
|
||||
`mb-4 w-56 h-10 flex items-center justify-center flex-col text-white text-lg bg-${color} py-8`
|
||||
)}
|
||||
>
|
||||
<p>{getColorValue()}</p>
|
||||
<p>bg-{color}</p>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default BackgroundColor;
|
||||
@@ -1,83 +0,0 @@
|
||||
---
|
||||
name: Colors
|
||||
route: system/colors
|
||||
---
|
||||
|
||||
import { Playground, Props } from 'docz';
|
||||
import BackgroundColor from './BackgroundColor';
|
||||
|
||||
# Color System
|
||||
|
||||
`@ohif/ui` offers a color system with a handful of color utility classes.
|
||||
|
||||
As `@ohif/ui` uses Tailwind as a base styling library, you will be able to use
|
||||
all the default colors from Tailwind, besides our custom colors too.
|
||||
|
||||
# How to use
|
||||
|
||||
To apply color in your element, you will use the same way Tailwind does.
|
||||
|
||||
- Background - `bg-primary-main`
|
||||
- Border - `border-primary-main`
|
||||
- Text - `text-primary-main`
|
||||
- Placeholder - `placeholder-primary-main`
|
||||
|
||||
Check [Tailwind's documentation](https://tailwindcss.com/docs) to see more
|
||||
details about color classes.
|
||||
|
||||
# Examples
|
||||
|
||||
## Text
|
||||
|
||||
<Playground>
|
||||
<div className="p-8">
|
||||
<p className="text-common-bright">text-common-bright</p>
|
||||
<p className="text-common-light">text-common-light</p>
|
||||
<p className="text-common-main">text-common-main</p>
|
||||
<p className="text-common-dark">text-common-dark</p>
|
||||
<p className="text-common-active">text-common-active</p>
|
||||
</div>
|
||||
</Playground>
|
||||
|
||||
## Background
|
||||
|
||||
<div className="flex">
|
||||
<div className="mr-8">
|
||||
<BackgroundColor color="primary-light" />
|
||||
<BackgroundColor color="primary-main" />
|
||||
<BackgroundColor color="primary-dark" />
|
||||
<BackgroundColor color="primary-active" />
|
||||
</div>
|
||||
<div>
|
||||
<BackgroundColor color="secondary-light" />
|
||||
<BackgroundColor color="secondary-main" />
|
||||
<BackgroundColor color="secondary-dark" />
|
||||
<BackgroundColor color="secondary-active" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
# Color palette
|
||||
|
||||
```javascript
|
||||
primary: {
|
||||
light: '#5acce6',
|
||||
main: '#0944b3',
|
||||
dark: '#090c29',
|
||||
active: '#348cfd',
|
||||
},
|
||||
|
||||
secondary: {
|
||||
light: '#3a3f99',
|
||||
main: '#2b166b',
|
||||
dark: '#041c4a',
|
||||
active: '#1f1f27',
|
||||
},
|
||||
|
||||
common: {
|
||||
bright: '#e1e1e1',
|
||||
light: '#a19fad',
|
||||
main: '#fff',
|
||||
dark: '#726f7e',
|
||||
active: '#2c3074',
|
||||
},
|
||||
```
|
||||
@@ -1,11 +1,10 @@
|
||||
---
|
||||
name: Study List
|
||||
menu: Views
|
||||
route: views/studyList
|
||||
route: examples/studyList
|
||||
---
|
||||
|
||||
import { useState } from 'react';
|
||||
import { Playground, Props } from 'docz';
|
||||
import { Playground } from 'docz';
|
||||
import {
|
||||
StudyList,
|
||||
utils,
|
||||
@@ -27,17 +26,10 @@ import { getMockedStudies } from '../../utils/';
|
||||
import classnames from 'classnames';
|
||||
import moment from 'moment';
|
||||
|
||||
# StudyList
|
||||
# Study List
|
||||
|
||||
Description...
|
||||
|
||||
## Import
|
||||
|
||||
```javascript
|
||||
import { StudyList } from '@ohif/ui';
|
||||
```
|
||||
|
||||
## StudyList
|
||||
This example shows you how you can build a Study List page using the available
|
||||
components.
|
||||
|
||||
<Playground>
|
||||
{() => {
|
||||
|
||||
@@ -0,0 +1,174 @@
|
||||
---
|
||||
name: Toolbar Header
|
||||
route: examples/toolbarHeader
|
||||
---
|
||||
|
||||
import { useState } from 'react';
|
||||
import { Playground } from 'docz';
|
||||
import classnames from 'classnames';
|
||||
import { NavBar, Typography, Svg, Icon, IconButton } from '@ohif/ui';
|
||||
|
||||
# Toolbar Header
|
||||
|
||||
This example shows you how you can build a Study List page using the available
|
||||
components.
|
||||
|
||||
## Basic usage
|
||||
|
||||
<Playground>
|
||||
{() => {
|
||||
const [activeTool, setActiveTool] = useState('Zoom');
|
||||
const [showTooltip, setShowTooltip] = useState('Zoom');
|
||||
const tools = [
|
||||
{
|
||||
id: 'Zoom',
|
||||
label: 'Zoom',
|
||||
icon: 'tool-zoom',
|
||||
type: null,
|
||||
commandName: 'setToolActive',
|
||||
commandOptions: { toolName: 'Zoom' },
|
||||
},
|
||||
{
|
||||
id: 'Wwwc',
|
||||
label: 'Levels',
|
||||
icon: 'tool-zoom',
|
||||
type: null,
|
||||
commandName: 'setToolActive',
|
||||
commandOptions: { toolName: 'Wwwc' },
|
||||
},
|
||||
{
|
||||
id: 'Pan',
|
||||
label: 'Pan',
|
||||
icon: 'tool-zoom',
|
||||
type: null,
|
||||
commandName: 'setToolActive',
|
||||
commandOptions: { toolName: 'Pan' },
|
||||
},
|
||||
{
|
||||
id: 'Wwwc',
|
||||
label: 'Levels',
|
||||
icon: 'tool-zoom',
|
||||
type: null,
|
||||
commandName: 'setToolActive',
|
||||
commandOptions: { toolName: 'Wwwc' },
|
||||
},
|
||||
{
|
||||
id: 'Wwwc',
|
||||
label: 'Levels',
|
||||
icon: 'tool-zoom',
|
||||
type: null,
|
||||
commandName: 'setToolActive',
|
||||
commandOptions: { toolName: 'Wwwc' },
|
||||
},
|
||||
];
|
||||
const collapsedTools = [
|
||||
{
|
||||
id: 'Zoom',
|
||||
label: 'Zoom',
|
||||
icon: 'tool-zoom',
|
||||
type: null,
|
||||
commandName: 'setToolActive',
|
||||
commandOptions: { toolName: 'Zoom' },
|
||||
},
|
||||
];
|
||||
const renderToolbar = () => {
|
||||
return tools.map((tool, i) => {
|
||||
const isActive = activeTool === tool.id;
|
||||
const shouldShowTooltip = showTooltip === tool.id;
|
||||
return (
|
||||
<div className="relative flex justify-center">
|
||||
<IconButton
|
||||
variant={isActive ? 'contained' : 'text'}
|
||||
className={classnames('mx-1', {
|
||||
'text-black': isActive,
|
||||
'text-common-bright hover:bg-primary-dark hover:text-primary-light': !isActive,
|
||||
})}
|
||||
onClick={(e) => {
|
||||
setActiveTool(tool.id);
|
||||
}}
|
||||
onMouseOver={() => setShowTooltip(tool.id)}
|
||||
onMouseOut={() => setShowTooltip(null)}
|
||||
key={tool.id}
|
||||
>
|
||||
<Icon name="tool-zoom" />
|
||||
</IconButton>
|
||||
<div
|
||||
class={classnames(
|
||||
'absolute bg-primary-dark border border-secondary-main text-white text-base rounded py-1 px-4 inset-x-auto top-full mt-2 transition duration-300',
|
||||
{
|
||||
'visible opacity-1': shouldShowTooltip,
|
||||
'invisible opacity-0': !shouldShowTooltip,
|
||||
}
|
||||
)}
|
||||
>
|
||||
{tool.label}
|
||||
<svg
|
||||
class="absolute text-primary-dark h-2 w-full left-0 top-full transform scale-150"
|
||||
style={{ top: -8 }}
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
height="24"
|
||||
viewBox="0 0 24 24"
|
||||
>
|
||||
<path
|
||||
fill="currentColor"
|
||||
d="M24 22h-24l12-20z"
|
||||
style={{ stroke: '#373D9A', strokeWidth: 1 }}
|
||||
/>
|
||||
</svg>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
});
|
||||
};
|
||||
return (
|
||||
<div className="pb-10">
|
||||
<NavBar className="justify-between border-b-4 border-black">
|
||||
<div className="flex flex-1 justify-between">
|
||||
<div className="flex items-center">
|
||||
<div className="mx-3 inline-flex items-center">
|
||||
<Icon
|
||||
name="chevron-left"
|
||||
className="text-primary-main w-10 h-10 cursor-pointer transition duration-300 transform hover:scale-125"
|
||||
onClick={() => alert('Navigate to previous page')}
|
||||
/>
|
||||
<a href="#" className="ml-4">
|
||||
<Svg name="logo-ohif" />
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex items-center">
|
||||
<div className="flex items-center">
|
||||
{renderToolbar()}
|
||||
<span
|
||||
className="w-1 border-l py-4 mx-2"
|
||||
style={{ borderColor: '#354A6D' }}
|
||||
/>
|
||||
<button>BUTTON</button>
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex items-center">
|
||||
<span className="mr-3 text-common-light text-lg">
|
||||
FOR INVESTIGATIONAL USE ONLY
|
||||
</span>
|
||||
<IconButton
|
||||
variant="text"
|
||||
color="inherit"
|
||||
className="text-primary-active"
|
||||
onClick={() => {}}
|
||||
>
|
||||
<React.Fragment>
|
||||
<Icon name="settings" /> <Icon name="chevron-down" />
|
||||
</React.Fragment>
|
||||
</IconButton>
|
||||
</div>
|
||||
</div>
|
||||
</NavBar>
|
||||
</div>
|
||||
);
|
||||
}}
|
||||
</Playground>
|
||||
|
||||
## Properties
|
||||
|
||||
<Props of={NavBar} />
|
||||
Reference in new issue
Block a user