Layout changes

This commit is contained in:
Scott E. Graves
2018-10-04 15:09:42 -05:00
parent 4aac967081
commit 93f16eb929
10 changed files with 132 additions and 88 deletions

View File

@@ -21,7 +21,7 @@ let mountedPIDs = [];
function createWindow() { function createWindow() {
// Create the browser window. // Create the browser window.
const height = process.env.ELECTRON_START_URL ? 344 : 324; const height = process.env.ELECTRON_START_URL ? 324 : 304;
mainWindow = new BrowserWindow({ mainWindow = new BrowserWindow({
width: 425, width: 425,
height: height, height: height,

View File

@@ -634,7 +634,7 @@ class App extends Component {
let key = 0; let key = 0;
mainContent.push(( mainContent.push((
<div key={'rvd_' + key++} <div key={'rvd_' + key++}
style={{height: '40%'}}> style={{height: '44%'}}>
<ReleaseVersionDisplay disabled={this.state.DownloadActive || this.state.ExtractActive || this.state.MountsBusy} <ReleaseVersionDisplay disabled={this.state.DownloadActive || this.state.ExtractActive || this.state.MountsBusy}
downloadClicked={this.handleReleaseDownload} downloadClicked={this.handleReleaseDownload}
downloadDisabled={!downloadEnabled} downloadDisabled={!downloadEnabled}
@@ -653,7 +653,7 @@ class App extends Component {
if (allowMount) { if (allowMount) {
mainContent.push(( mainContent.push((
<div key={'md_' + key++} <div key={'md_' + key++}
style={{height: '60%'}}> style={{height: '56%'}}>
<MountItems allowConfig={allowConfig} <MountItems allowConfig={allowConfig}
autoMountChanged={this.handleAutoMountChanged} autoMountChanged={this.handleAutoMountChanged}
autoMountProcessed={this.notifyAutoMountProcessed} autoMountProcessed={this.notifyAutoMountProcessed}

View File

@@ -1,7 +0,0 @@
.MountItem {
padding: 0;
margin: 0;
width: 100%;
box-sizing: border-box;
}

View File

@@ -4,70 +4,92 @@ import styles from './MountItem.css';
import DropDown from '../UI/DropDown/DropDown'; import DropDown from '../UI/DropDown/DropDown';
import Button from '../UI/Button/Button'; import Button from '../UI/Button/Button';
import Loader from 'react-loader-spinner'; import Loader from 'react-loader-spinner';
import Text from '../UI/Text/Text';
import Grid from '../UI/Grid/Grid';
import configureImage from '../../assets/images/configure.png'; import configureImage from '../../assets/images/configure.png';
import RootElem from '../../hoc/RootElem/RootElem';
export default CSSModules((props) => { export default CSSModules((props) => {
let configButton = null; let configButton = null;
let secondRow = 6;
if (props.allowConfig) { if (props.allowConfig) {
configButton = ( configButton = (
<RootElem colSpan={4}
rowSpan={6}>
<img alt='' <img alt=''
height={'16px'} height={'16px'}
onClick={props.configClicked} onClick={props.configClicked}
src={configureImage} src={configureImage}
style={{padding: 0, border: 0, margin: 0, cursor: 'pointer'}} style={{padding: 0, border: 0, margin: 0, cursor: 'pointer'}}
width={'16px'}/> width={'16px'}/>
</RootElem>
); );
} }
let inputColumnSpan;
let inputControl = null; let inputControl = null;
let mountWidth = '70%';
if (props.platform === 'win32') { if (props.platform === 'win32') {
inputColumnSpan = 20;
inputControl = <DropDown changed={props.changed} inputControl = <DropDown changed={props.changed}
colSpan={inputColumnSpan}
disabled={!props.allowMount || props.mounted} disabled={!props.allowMount || props.mounted}
items={props.items} items={props.items}
row={secondRow}
rowSpan={7}
selected={props.items.indexOf(props.location)}/>; selected={props.items.indexOf(props.location)}/>;
mountWidth = '18%';
} else { } else {
inputControl = <input disabled={!props.allowMount || props.mounted} inputColumnSpan = 60;
inputControl = (
<RootElem colSpan={inputColumnSpan}
row={secondRow}
rowSpan={7}>
<input disabled={!props.allowMount || props.mounted}
onChange={props.changed} onChange={props.changed}
type={'text'} type={'text'}
value={props.location}/>; value={props.location}/>
</RootElem>);
} }
let actionDisplay = null; const buttonDisplay = props.allowMount ?
if (props.allowMount) { (props.mounted ? 'Unmount' : 'Mount') :
actionDisplay = <Button buttonStyles={{width: '100%'}} <Loader color={'var(--heading_text_color)'}
clicked={()=>props.clicked(props.title, !props.mounted, props.location, props.pid)}>{props.mounted ? 'Unmount' : 'Mount'}</Button>; height='19px'
} else {
actionDisplay = <Loader color={'var(--heading_text_color)'}
height='24px'
type='Circles' type='Circles'
width='24px'/>; width='19px'/>;
}
return ( const actionsDisplay = (
<div styleName='MountItem'> <Button clicked={()=>props.clicked(props.title, !props.mounted, props.location, props.pid)}
<table><tbody><tr><td>{configButton}</td><td><h2>{props.title}</h2></td></tr></tbody></table> col={inputColumnSpan + 2}
<table cellPadding='2' colSpan={20}
width='100%'> disabled={!props.allowMount}
<tbody> row={secondRow}
<tr> rowSpan={7}>
<td height='30px' {buttonDisplay}
width={mountWidth}>{inputControl} </Button>);
</td>
<td align='center' const autoMountControl = (
valign='middle' <RootElem col={inputColumnSpan + 23}
width='25%'> colSpan={26}
{actionDisplay} row={secondRow}
</td> rowSpan={7}>
<td>
<input checked={props.autoMount} <input checked={props.autoMount}
onChange={props.autoMountChanged} onChange={props.autoMountChanged}
type='checkbox'/>Auto-mount type='checkbox'/>Auto-mount
</td> </RootElem>
</tr> );
</tbody>
</table> return (
</div> <Grid>
{configButton}
<Text
col={configButton ? 6 : 0}
rowSpan={5}
text={props.title}
type={'Heading1'}/>
{inputControl}
{actionsDisplay}
{autoMountControl}
</Grid>
); );
}, styles, {allowMultiple: true}); }, styles, {allowMultiple: true});

View File

@@ -1,7 +1,6 @@
.Button { .Button {
display: block; display: block;
text-align: center; text-align: center;
margin: 0;
padding: 4px; padding: 4px;
outline: 0; outline: 0;
color: var(--text_color); color: var(--text_color);
@@ -10,8 +9,10 @@
border: none; border: none;
text-decoration: none; text-decoration: none;
text-outline: none; text-outline: none;
vertical-align: center;
height: 100%; height: 100%;
width: 100%; width: 100%;
overflow: hidden;
} }
.Button:hover:enabled { .Button:hover:enabled {
@@ -21,7 +22,7 @@
} }
.Button:hover:disabled { .Button:hover:disabled {
cursor: default; cursor: no-drop;
} }
.Button:active, .Button:active,

View File

@@ -24,3 +24,16 @@
border-color: rgba(10, 10, 20, 0.9); border-color: rgba(10, 10, 20, 0.9);
color: var(--text_color); color: var(--text_color);
} }
.Select:hover:enabled {
cursor: pointer;
}
.Select:hover:disabled {
cursor: no-drop;
}
.Select:active,
.Select.active {
cursor: pointer;
}

View File

@@ -66,6 +66,7 @@ export default CSSModules(class extends Component {
const dimensions = this.state.dimensions; const dimensions = this.state.dimensions;
if (this.state.calculated) { if (this.state.calculated) {
children = React.Children.map(this.props.children, (child, i) => { children = React.Children.map(this.props.children, (child, i) => {
if (child) {
let row = child.props.row || 0; let row = child.props.row || 0;
if (typeof(row) === 'function') { if (typeof(row) === 'function') {
row = row(dimensions); row = row(dimensions);
@@ -95,7 +96,11 @@ export default CSSModules(class extends Component {
rowSpan={rowSpan} rowSpan={rowSpan}
colSpan={colSpan} colSpan={colSpan}
key={'gc_' + i}>{child}</GridComponent>; key={'gc_' + i}>{child}</GridComponent>;
}); } else {
return null;
}
})
.filter(i => i !== null);
} }
const style = { const style = {

View File

@@ -1,5 +1,6 @@
.MountItems { .MountItems {
padding: 0; padding: 0;
margin: 0;
width: 100%; width: 100%;
box-sizing: border-box; box-sizing: border-box;
} }

View File

@@ -0,0 +1,9 @@
import React from 'react';
export default (props) => {
return (
<div style={{margin: 0, padding: 0}} {...props}>
{props.children}
</div>
)
};

View File

@@ -2,7 +2,7 @@
--border_radius: 4px; --border_radius: 4px;
--control_background: rgba(150, 150, 190, .15); --control_background: rgba(150, 150, 190, .15);
--control_background_hover: rgba(150, 150, 190, .3); --control_background_hover: rgba(150, 150, 190, .35);
--control_border: 1px solid rgba(70, 70, 70, 0.9); --control_border: 1px solid rgba(70, 70, 70, 0.9);
--control_box_shadow: 1px 1px 1px black; --control_box_shadow: 1px 1px 1px black;
--control_transparent_background: rgba(40, 40, 55, 0.45); --control_transparent_background: rgba(40, 40, 55, 0.45);
@@ -11,7 +11,7 @@
--text_color: rgba(200, 205, 220, 0.7); --text_color: rgba(200, 205, 220, 0.7);
--text_color_hover: rgba(200, 205, 220, 0.7); --text_color_hover: rgba(200, 205, 220, 0.7);
--text_color_error: rgba(203, 120, 120, 0.8); --text_color_error: rgba(203, 120, 120, 0.8);
--heading_text_color: rgba(166, 177, 219, 0.7); --heading_text_color: rgba(161, 190, 219, 0.7);
--heading_other_text_color: var(--heading_text_color); --heading_other_text_color: var(--heading_text_color);
--text_color_transition: color 0.3s; --text_color_transition: color 0.3s;
} }