polish style

master
Aaron Yu 2021-12-25 00:26:00 +08:00
parent 8af62b5566
commit ae94e98ecf
12 changed files with 90 additions and 65 deletions

View File

@ -1,14 +1,12 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="utf-8" /> <meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" /> <link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" /> <meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" /> <meta name="theme-color" content="#000000" />
<meta <meta name="description" content="Web site created using create-react-app" />
name="description"
content="Web site created using create-react-app"
/>
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" /> <link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
<!-- <!--
manifest.json provides metadata used when your web app is installed on a manifest.json provides metadata used when your web app is installed on a
@ -26,6 +24,7 @@
--> -->
<title>React App</title> <title>React App</title>
</head> </head>
<body> <body>
<noscript>You need to enable JavaScript to run this app.</noscript> <noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div> <div id="root"></div>
@ -40,4 +39,5 @@
To create a production bundle, use `npm run build` or `yarn build`. To create a production bundle, use `npm run build` or `yarn build`.
--> -->
</body> </body>
</html> </html>

View File

@ -1,6 +1,7 @@
.App { .App {
text-align: center; text-align: center;
display: flex; display: flex;
align-items: stretch;
} }
.App-logo { .App-logo {

View File

@ -38,16 +38,17 @@ class App extends React.Component {
}); });
} }
fetchData() { async fetchData() {
fetch('http://123.56.161.61:1157/home/GetServerJsonData', { var response = await fetch('http://123.56.161.61:1157/home/GetServerJsonData', {
headers: { headers: {
'Content-Type': 'application/json' 'Content-Type': 'application/json'
}, },
}).then((response) => });
response.json() var projects = await response.json();
.then(projects => this.setState({ this.setState({
projects projects,
}))); selectedProject: projects[0]
})
} }
UpdateSetting(obj) { UpdateSetting(obj) {
@ -72,8 +73,8 @@ class App extends React.Component {
mode={mode} mode={mode}
onModeChange={(_mode) => this.setMode(_mode) } onModeChange={(_mode) => this.setMode(_mode) }
projects={projects} projects={projects}
device={device}
onProjectSelect={(project) => { onProjectSelect={(project) => {
console.log(project)
this.setSelectedProject(project) this.setSelectedProject(project)
}} }}
onDeviceChange={(_device) => this.setDevice(_device)}/> onDeviceChange={(_device) => this.setDevice(_device)}/>

View File

@ -0,0 +1,10 @@
.deviceFrameContainer {
width: 100%;
flex: 1 1 0%;
align-items: center;
position: relative;
display: flex;
height: 100vh;
justify-content: center;
overflow: hidden;
}

View File

@ -48,27 +48,22 @@ function DeviceFrame(props) {
useEffect(() => { useEffect(() => {
setConfig(configMap[props.device]) setConfig(configMap[props.device])
console.log(props.device, config)
}, [props.device, config]) }, [props.device, config])
var refresh = () => setIframeKey(Math.round(Math.random() * 10000)); var refresh = () => setIframeKey(Math.round(Math.random() * 10000));
useEffect(() => { useEffect(() => {
console.log(props.htmlUrl)
refresh() refresh()
}, [props.htmlUrl]) }, [props.htmlUrl])
return ( return (
<div style={{ <div className='deviceFrameContainer'>
width: '100%',
flex: 1,
alignItems: 'center',
position: 'relative'
}}>
<img src={refreshButtonPng} alt='refresh' onClick={() => refresh()} style={{ <img src={refreshButtonPng} alt='refresh' onClick={() => refresh()} style={{
position: 'absolute', position: 'absolute',
left: '20px', left: '30px',
bottom: '20px', bottom: '30px',
cursor: 'pointer' cursor: 'pointer'
}}/> }}/>
<div> <div>

View File

@ -1,8 +1,7 @@
.Pane { .Pane {
width: 25vw; width: 30vw;
min-width: 200px;
background-color: rgb(52, 90, 176); background-color: rgb(52, 90, 176);
height: 100vh; min-height: 100vh;
} }
.modeSelect { .modeSelect {
@ -17,5 +16,16 @@
} }
.deviceContent { .deviceContent {
text-align: left;
color: white; color: white;
} }
.deviceButtons {
width: 160px;
display: flex;
justify-content: space-between;
}
.deviceButtons img {
cursor: pointer;
}

View File

@ -6,6 +6,10 @@ import { Chip, List, ListItem } from '@mui/material';
import ipadPng from '../../images/ipad.png' import ipadPng from '../../images/ipad.png'
import iphonePng from '../../images/iphone.png' import iphonePng from '../../images/iphone.png'
import androidPng from '../../images/android.png' import androidPng from '../../images/android.png'
import horizentalChecked from '../../images/horizental-button-checked.png'
import horizentalButton from '../../images/horizental-button.png'
import verticalChecked from '../../images/vertical-button-checked.png'
import verticalButton from '../../images/vertical-button.png'
var deviceConfigs = [ var deviceConfigs = [
{ {
@ -79,21 +83,20 @@ function Pane(props) {
key={_device.name} key={_device.name}
sx={{ sx={{
display: 'flex', display: 'flex',
alignItems: 'center' textAlign: 'center'
}}> }}>
<div style={{ width: '120px', alignItems: 'center' }}>
<img className='deviceIcon' src={_device.icon} alt={_device.name}/> <img className='deviceIcon' src={_device.icon} alt={_device.name}/>
</div>
<div className='deviceContent'> <div className='deviceContent'>
<p>{_device.name}</p> <p style={{ margin: "14px 0"}}>{_device.name}</p>
<div className='deviceButtons'> <div className='deviceButtons'>
<Chip label='横屏' <img src={device === _device.horizental ? horizentalChecked : horizentalButton}
onClick={() => deviceChange(_device.horizental)} alt='horizental'
color={ device === _device.horizental ? 'success' : 'default'} onClick={() => deviceChange(_device.horizental)}/>
sx={{ <img src={device === _device.vertical ? verticalChecked : verticalButton}
marginRight: '10px' alt='vertical'
}}/> onClick={() => deviceChange(_device.vertical)}/>
<Chip label='竖屏'
onClick={() => deviceChange(_device.vertical)}
color={ device === _device.vertical ? 'success' : 'default'}/>
</div> </div>
</div> </div>
</ListItem>) </ListItem>)

View File

@ -23,7 +23,10 @@ function SettingFrame(props) {
<ListItem key={rowIndex}> <ListItem key={rowIndex}>
<span>{rowTitles[rowIndex]}</span> <span>{rowTitles[rowIndex]}</span>
<Grid container spacing={{ xs: 2, md: 3 }} columns={{ xs: 4, sm: 8, md: 12 }}> <Grid container spacing={{ xs: 2, md: 3 }} columns={{ xs: 4, sm: 8, md: 12 }}>
{props.setting && props.setting[rowKey] && Array.from(props.setting[rowKey].split('|')).map((text, index) => ( {(props.setting && props.setting[rowKey]
? Array.from(props.setting[rowKey].split('|'))
: ['无', '无', '无'])
.map((text, index) => (
<Grid item xs={2} sm={4} md={4} key={index}> <Grid item xs={2} sm={4} md={4} key={index}>
<div style={{ <div style={{
backgroundImage: `url('${settingCardPng}')`, backgroundImage: `url('${settingCardPng}')`,
@ -62,7 +65,8 @@ function SettingFrame(props) {
cursor: 'pointer', cursor: 'pointer',
marginTop: '30px' marginTop: '30px'
}}> }}>
<img {
props.setting && <img
src={generateButtonPng} src={generateButtonPng}
alt='generate' alt='generate'
style={{ style={{
@ -73,6 +77,7 @@ function SettingFrame(props) {
centreType: settingArr[1]+'', centreType: settingArr[1]+'',
middleType: settingArr[2]+'' middleType: settingArr[2]+''
})}/> })}/>
}
</div> </div>
</div> </div>
) )

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 622 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 596 B