-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #67 from Kitware/mobile_popup
fix(MobileOverlay): Add overlay if screen is detected as too small
- Loading branch information
Showing
4 changed files
with
72 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
.overlay { | ||
position: absolute; | ||
top: 0; | ||
left: 0; | ||
bottom: 0; | ||
right: 0; | ||
z-index: 99; | ||
background: $colors.menu; | ||
} | ||
|
||
.centered { | ||
text-align: center; | ||
font-size: 2em; | ||
padding: 15px; | ||
} | ||
|
||
.glance { | ||
max-width: 100%; | ||
} | ||
|
||
.kitware { | ||
margin: 0 auto; | ||
margin-top: 15px; | ||
width: 55%; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import React from 'react'; | ||
|
||
import icons from '../../icons'; | ||
|
||
import style from './Overlay.mcss'; | ||
|
||
const DEFAULT_WIDTH = 700; // px | ||
|
||
function Overlay(props) { | ||
return ( | ||
<div className={style.overlay}> | ||
<div className={style.centered}> | ||
<img className={style.glance} src={icons.Logo} alt="ParaView Glance" /> | ||
<p> | ||
This application is not yet optimized for mobile. Please use a | ||
desktop. | ||
</p> | ||
<p> | ||
For interactive 3D samples on mobile, check out | ||
<a href="https://kitware.github.io/vtk-js/examples/">vtk.js</a>. | ||
</p> | ||
<div className={style.kitware}> | ||
<a href="https://kitware.com/"> | ||
<img src={icons.KitwareLogo} alt="Kitware" /> | ||
</a> | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
} | ||
|
||
export default function MobileOverlay(Component, width = DEFAULT_WIDTH) { | ||
// right now this is not dynamic; only applies on first run | ||
const isMobile = window.innerWidth <= DEFAULT_WIDTH; | ||
|
||
return function WrappedComponent(props) { | ||
if (isMobile) { | ||
return <Overlay />; | ||
} | ||
return <Component {...props} />; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters