Skip to content

Commit

Permalink
update: modify UI styles
Browse files Browse the repository at this point in the history
  • Loading branch information
phobal committed May 5, 2018
1 parent 3f237a3 commit 70049a6
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 8 deletions.
2 changes: 1 addition & 1 deletion app/containers/ToolBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const ToolBar = ({ onComeback, onSwitchSource, onSourceSelected, freeUrl, title
return (
<div style={{ display: 'flex', height: '100%', alignItems: 'center', justifyContent: 'space-between', padding: '0 20px' }}>
<div type="rollback" style={{ fontSize: '18px', cursor: 'pointer' }} onClick={onComeback}>返回</div>
<span>{title}</span>
<span style={{ padding: '0 20px', color: 'darkcyan' }}>{title}</span>
<div
style={{ display: 'flex', alignItems: 'center' }}
>
Expand Down
19 changes: 13 additions & 6 deletions app/containers/Video.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import React, { PureComponent } from 'react';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
import { webview } from 'electron';
import { webview, ipcRenderer } from 'electron';

import Channel from './Channel';
import ToolBar from './ToolBar';
Expand All @@ -21,6 +21,7 @@ class VideoPlay extends PureComponent < Props > {
url: 'https://v.qq.com',
freeUrl: [],
selectedUrl: 'http://vip.jlsprh.com/index.php?url=',
isFullScreen: false,
}
componentDidMount() {
this.props.actions.getAllVideoSource();
Expand All @@ -39,6 +40,11 @@ class VideoPlay extends PureComponent < Props > {
url: `${obj.url}`
});
});
ipcRenderer.on('enter-full-screen', (e, msg) => {
this.setState({
isFullScreen: msg
});
});
}
componentWillReceiveProps(nextProps) {
const { source } = nextProps;
Expand Down Expand Up @@ -81,17 +87,18 @@ class VideoPlay extends PureComponent < Props > {
});
}
render() {
const { channel, url, freeUrl, title } = this.state;
const { channel, url, freeUrl, title, isFullScreen } = this.state;
const isHiddenStyle = isFullScreen ? { display: 'none'} : { display: 'flex'};
return (
<div style={{ display: 'flex' }}>
<div style={{ width: '200px' }}>
<div style={{ minWidth: '150px', ...isHiddenStyle }}>
<Channel
channel={channel}
handleSwitchChannel={this.handleSwitchChannel}
/>
</div>
<div style={{ height: '100vh', width: 'calc(100vw - 200px)', display: 'flex', flexDirection: 'column' }}>
<div style={{ height: '60px' }}>
<div style={{ height: '100vh', width: isFullScreen ? '100vw' : 'calc(100vw - 150px)', display: 'flex', flexDirection: 'column' }}>
<div style={{ height: '60px', ...isHiddenStyle }}>
<ToolBar
onComeback={this.onComeback}
onSourceSelected={this.onSourceSelected}
Expand All @@ -103,7 +110,7 @@ class VideoPlay extends PureComponent < Props > {
<webview
ref={ (webview) => {this.webview = webview} }
title="腾讯视频"
style={{ height: 'calc(100vh - 60px)', width: '100%' }}
style={{ height: isFullScreen ? '100vh' : 'calc(100vh - 60px)', width: '100%' }}
src={url}
allowpopups="true"
>
Expand Down
8 changes: 7 additions & 1 deletion app/main.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*
* @flow
*/
import { app, BrowserWindow } from 'electron';
import { app, BrowserWindow, ipcMain} from 'electron';
import MenuBuilder from './menu';

let mainWindow = null;
Expand Down Expand Up @@ -81,6 +81,12 @@ app.on('ready', async () => {
mainWindow = null;
});

mainWindow.on('enter-full-screen', () => {
mainWindow.webContents.send('enter-full-screen', true);
})
mainWindow.on('leave-full-screen', () => {
mainWindow.webContents.send('enter-full-screen', false);
})
const menuBuilder = new MenuBuilder(mainWindow);
menuBuilder.buildMenu();
});

0 comments on commit 70049a6

Please sign in to comment.