Skip to content

Commit

Permalink
+: output area functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
lynklody authored and billchenchina committed Aug 13, 2020
1 parent f22508b commit 0bd4aba
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 13 deletions.
49 changes: 37 additions & 12 deletions src/Components/OutputArea.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from 'react'
import { Container, Card, CardContent, Grid } from '@material-ui/core'
import React, {useEffect, useState} from 'react'
import { Container, Card, CardContent, Grid, TextField } from '@material-ui/core'
import { makeStyles } from '@material-ui/core/styles'
import { useSelector } from 'react-redux'

const useStyles = makeStyles({
outputBox: {
Expand All @@ -14,18 +15,42 @@ const useStyles = makeStyles({
}
})

const renderOutputArea = () => {
return (
<Container>
<CardContent>
output
</CardContent>
</Container>
)
const renderOutputArea = (output) => {
console.log("output=",output)
if (output === '') {
return (
<Container>
<CardContent>
测试用例输出:
</CardContent>
<CardContent>
请选择测试用例的数据类型
</CardContent>
</Container>
)
}
else {
return (
<Container>
<CardContent>
测试用例输出:
</CardContent>
<TextField
label=""
multiline
rows={8}
defaultValue={output}
variant="filled"
/>
</Container>
)
}
}

const OutputArea = () => {
const classes = useStyles();
const classes = useStyles()
const output = useSelector(state => state.output)

return(
<Container fixed
className={classes.outputBox}
Expand All @@ -39,7 +64,7 @@ const OutputArea = () => {
className={classes.card}
>

{ renderOutputArea() }
{ renderOutputArea(output) }

</Card>
</Grid>
Expand Down
2 changes: 1 addition & 1 deletion src/Store/Actions/StringActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export const startStringGen = (state, dispatch) => {
}
}
}
console.log('RESULT=',result)
// console.log('RESULT=',result)
dispatch({
type: SET_OUTPUT,
payload: result
Expand Down

0 comments on commit 0bd4aba

Please sign in to comment.