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 = (
<img alt='' <RootElem colSpan={4}
height={'16px'} rowSpan={6}>
onClick={props.configClicked} <img alt=''
src={configureImage} height={'16px'}
style={{padding: 0, border: 0, margin: 0, cursor: 'pointer'}} onClick={props.configClicked}
width={'16px'}/> src={configureImage}
style={{padding: 0, border: 0, margin: 0, cursor: 'pointer'}}
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;
onChange={props.changed} inputControl = (
type={'text'} <RootElem colSpan={inputColumnSpan}
value={props.location}/>; row={secondRow}
rowSpan={7}>
<input disabled={!props.allowMount || props.mounted}
onChange={props.changed}
type={'text'}
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 { type='Circles'
actionDisplay = <Loader color={'var(--heading_text_color)'} width='19px'/>;
height='24px'
type='Circles' const actionsDisplay = (
width='24px'/>; <Button clicked={()=>props.clicked(props.title, !props.mounted, props.location, props.pid)}
} col={inputColumnSpan + 2}
colSpan={20}
disabled={!props.allowMount}
row={secondRow}
rowSpan={7}>
{buttonDisplay}
</Button>);
const autoMountControl = (
<RootElem col={inputColumnSpan + 23}
colSpan={26}
row={secondRow}
rowSpan={7}>
<input checked={props.autoMount}
onChange={props.autoMountChanged}
type='checkbox'/>Auto-mount
</RootElem>
);
return ( return (
<div styleName='MountItem'> <Grid>
<table><tbody><tr><td>{configButton}</td><td><h2>{props.title}</h2></td></tr></tbody></table> {configButton}
<table cellPadding='2' <Text
width='100%'> col={configButton ? 6 : 0}
<tbody> rowSpan={5}
<tr> text={props.title}
<td height='30px' type={'Heading1'}/>
width={mountWidth}>{inputControl} {inputControl}
</td> {actionsDisplay}
<td align='center' {autoMountControl}
valign='middle' </Grid>
width='25%'>
{actionDisplay}
</td>
<td>
<input checked={props.autoMount}
onChange={props.autoMountChanged}
type='checkbox'/>Auto-mount
</td>
</tr>
</tbody>
</table>
</div>
); );
}, 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

@@ -23,4 +23,17 @@
background: rgba(10, 10, 15, 0.8); background: rgba(10, 10, 15, 0.8);
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,36 +66,41 @@ 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) => {
let row = child.props.row || 0; if (child) {
if (typeof(row) === 'function') { let row = child.props.row || 0;
row = row(dimensions); if (typeof(row) === 'function') {
row = row(dimensions);
}
let col = child.props.col || 0;
if (typeof(col) === 'function') {
col = col(dimensions);
}
let rowSpan = child.props.rowSpan;
if (typeof(rowSpan) === 'function') {
rowSpan = rowSpan(dimensions.rows - row, dimensions.rows);
}
let colSpan = child.props.colSpan;
if (typeof(colSpan) === 'function') {
colSpan = colSpan(dimensions.columns - col, dimensions.columns);
}
rowSpan = rowSpan ? (rowSpan === 'remain' ? (dimensions.rows - row) : rowSpan) : null;
colSpan = colSpan ? (colSpan === 'remain' ? dimensions.columns - col : colSpan) : null;
return <GridComponent
row={row}
col={col}
rowSpan={rowSpan}
colSpan={colSpan}
key={'gc_' + i}>{child}</GridComponent>;
} else {
return null;
} }
})
let col = child.props.col || 0; .filter(i => i !== null);
if (typeof(col) === 'function') {
col = col(dimensions);
}
let rowSpan = child.props.rowSpan;
if (typeof(rowSpan) === 'function') {
rowSpan = rowSpan(dimensions.rows - row, dimensions.rows);
}
let colSpan = child.props.colSpan;
if (typeof(colSpan) === 'function') {
colSpan = colSpan(dimensions.columns - col, dimensions.columns);
}
rowSpan = rowSpan ? (rowSpan === 'remain' ? (dimensions.rows - row) : rowSpan) : null;
colSpan = colSpan ? (colSpan === 'remain' ? dimensions.columns - col : colSpan) : null;
return <GridComponent
row={row}
col={col}
rowSpan={rowSpan}
colSpan={colSpan}
key={'gc_' + i}>{child}</GridComponent>;
});
} }
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;
} }