From 2569d0e79b807af440fa6934b5d50d42bad155f6 Mon Sep 17 00:00:00 2001 From: Rodrigo Antinarelli Date: Tue, 1 Jan 2019 09:23:17 -0200 Subject: [PATCH] Header component (#328) * add .DS_Store to .gitignore * create header component * add icons image file to the project * add new theme variables * insert header component into Viewer * add web fonts * create dropdown component * update header styles * import dropdown with custom list into header component * reindent index * Update index.html * create json file for header menu settings * import header menu * header prefix * remove overflow hidden -- it's hiding Dropdown menu * header fixes * header css adjustments * add Back to Viewer btn --- OHIFViewer-react/src/Header/Header.css | 44 +++++++++++++++++-- OHIFViewer-react/src/Header/Header.js | 41 ++++++++++++----- OHIFViewer-react/src/StudyListWithData.js | 6 +-- OHIFViewer-react/src/Viewer/Viewer.js | 18 ++++---- .../src/components/Dropdown/Dropdown.js | 2 +- OHIFViewer-react/src/sha.js | 2 +- 6 files changed, 84 insertions(+), 29 deletions(-) diff --git a/OHIFViewer-react/src/Header/Header.css b/OHIFViewer-react/src/Header/Header.css index 52bd48a59..df92c7e8f 100644 --- a/OHIFViewer-react/src/Header/Header.css +++ b/OHIFViewer-react/src/Header/Header.css @@ -1,16 +1,38 @@ -.header { +.entry-header { padding: 10px 10px 0; - height: var(--top-bar-height); - overflow: hidden; +} + +.entry-header.header-big { + background: rgba(21,25,30,0.7); + padding: 10px var(--study-list-padding); + height: auto; + display: inline-block; + width: 100%; +} + +.header-left-box { + display: inline-block; + position: relative; +} + +.header-viewerLink { + float: left; } .header-brand { height: 30px; text-decoration: none; float: left; + clear: both; } +.entry-header.header-big .header-brand { + height: auto; + padding: 25px 0; +} + + .header-logo-image { fill: transparent; height: 100%; @@ -19,6 +41,12 @@ float: left; } +.entry-header.header-big .header-logo-image { + margin: 0 20px 0 0; + width: 50px; + height: 50px; +} + .header-logo-text { display: inline-block; font-family: var(--logo-font-family); @@ -28,6 +56,11 @@ line-height: 30px; } +.entry-header.header-big .header-logo-text { + font-size: 30px; + line-height: 36px; +} + .header-btn { color: var(--text-secondary-color); cursor: pointer; @@ -48,6 +81,7 @@ border-left: var(--ui-border-thickness) solid var(--ui-border-color); margin: 3px 0 0 10px; padding: 0 0 0 10px; + display: inline-block; } .header-menu { @@ -60,3 +94,7 @@ text-decoration: none; margin-right: 10px; } + +.entry-header.header-big .header-menu { + margin-right: 0; +} diff --git a/OHIFViewer-react/src/Header/Header.js b/OHIFViewer-react/src/Header/Header.js index 30b13a877..77400270b 100644 --- a/OHIFViewer-react/src/Header/Header.js +++ b/OHIFViewer-react/src/Header/Header.js @@ -1,21 +1,38 @@ import React from 'react' -import { Link } from 'react-router-dom' +import { Link, withRouter } from 'react-router-dom' import { Dropdown } from "../components" import Icons from "../images/icons.svg" import './Header.css' import list from './HeaderMenuList.json' -function Header() { - return ( -
- - - - -
Open Health Imaging Foundation
-
+function Header({ home, lastStudy, location }) { + const { state } = location + + return ( +
+
+ { + state && state.studyLink && + + Back to Viewer + + } + + + + + +
Open Health Imaging Foundation
+
+ + {!home && + Study list + } +
- Study list
{/* TODO: research-use */} @@ -31,4 +48,4 @@ function Header() { ) } -export default Header +export default withRouter(Header) diff --git a/OHIFViewer-react/src/StudyListWithData.js b/OHIFViewer-react/src/StudyListWithData.js index 455c85067..b71e8af89 100644 --- a/OHIFViewer-react/src/StudyListWithData.js +++ b/OHIFViewer-react/src/StudyListWithData.js @@ -1,4 +1,4 @@ -import React, {Component} from "react"; +import React, { Component } from "react"; import PropTypes from "prop-types"; import OHIF from 'ohif-core'; import { withRouter } from 'react-router-dom'; @@ -98,7 +98,7 @@ class StudyListWithData extends Component { const studyCount = this.state.studies ? this.state.studies.length : 0; return (<> -
+
- + ); } } diff --git a/OHIFViewer-react/src/Viewer/Viewer.js b/OHIFViewer-react/src/Viewer/Viewer.js index b0c440fac..eb4963d51 100644 --- a/OHIFViewer-react/src/Viewer/Viewer.js +++ b/OHIFViewer-react/src/Viewer/Viewer.js @@ -84,15 +84,15 @@ class Viewer extends Component { render() { return (<> -
-
- {/**/} -
-
- - -
- +
+
+ {/**/} +
+
+ + +
+ ); } } diff --git a/OHIFViewer-react/src/components/Dropdown/Dropdown.js b/OHIFViewer-react/src/components/Dropdown/Dropdown.js index d046b0de5..1c72a74db 100644 --- a/OHIFViewer-react/src/components/Dropdown/Dropdown.js +++ b/OHIFViewer-react/src/components/Dropdown/Dropdown.js @@ -8,7 +8,7 @@ class Dropdown extends Component { } renderList = () => { - const { list, align } = this.props + const { list, link, align } = this.props if (!this.state.open) { return null diff --git a/OHIFViewer-react/src/sha.js b/OHIFViewer-react/src/sha.js index 9d6a5da56..15a86e156 100644 --- a/OHIFViewer-react/src/sha.js +++ b/OHIFViewer-react/src/sha.js @@ -1 +1 @@ -export default '4fbc208b41fcaa0f957a49409cb55e91c6397d03'; +export default '2cf00fe8274068bf5b06bac94c813d242bc90eb1';