-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4640001
commit 61bbdc9
Showing
13 changed files
with
15,903 additions
and
87 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { Fragment, useState } from "react"; | ||
import { Container, Grid, CssBaseline, Paper, Box } from "@material-ui/core"; | ||
|
||
import UserInput from "./UserInput"; | ||
import DbLike from "./DbLike"; | ||
|
||
function App() { | ||
const [savedValue, setSavedValue] = useState(""); | ||
return ( | ||
<Fragment> | ||
<CssBaseline /> | ||
<Container> | ||
<Box height="50px" /> | ||
<Paper square> | ||
<Grid justify="center" container> | ||
<Grid xs={12} sm={6} item> | ||
<UserInput setSavedValue={setSavedValue} /> | ||
</Grid> | ||
<Grid xs={12} sm={6} item> | ||
<DbLike debouncedValue={savedValue} /> | ||
</Grid> | ||
</Grid> | ||
</Paper> | ||
</Container> | ||
</Fragment> | ||
); | ||
} | ||
|
||
export default App; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { Typography, Box } from "@material-ui/core"; | ||
|
||
const DbLike = (props: { debouncedValue: string }) => { | ||
return ( | ||
<Box | ||
p={2} | ||
bgcolor="primary.main" | ||
display="flex" | ||
flexDirection="column" | ||
color="white" | ||
height="100%" | ||
> | ||
<h2>DB like saved output</h2> | ||
<Typography component="p">{props.debouncedValue}</Typography> | ||
</Box> | ||
); | ||
}; | ||
|
||
export default DbLike; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { useCallback } from "react"; | ||
import debounce from "lodash.debounce"; | ||
import { TextField, Box } from "@material-ui/core"; | ||
|
||
const UserInput = (props: { setSavedValue: Function }) => { | ||
const debouncedSave = useCallback( | ||
debounce((newValue: any) => props.setSavedValue(newValue), 1000), | ||
[] | ||
); | ||
|
||
const saveMessage = (e: any) => { | ||
const newValue = e.target.value; | ||
debouncedSave(newValue); | ||
}; | ||
|
||
return ( | ||
<Box p={2} display="flex" flexDirection="column" height="100%"> | ||
<h2>User realtime input</h2> | ||
<TextField | ||
multiline | ||
rows={4} | ||
fullWidth | ||
variant="outlined" | ||
label="Type message here" | ||
onChange={(e) => saveMessage(e)} | ||
/> | ||
</Box> | ||
); | ||
}; | ||
|
||
export default UserInput; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/// <reference types="react-scripts" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
declare module '*.jpg'; | ||
declare module '*.jpeg'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
{ | ||
"compilerOptions": { | ||
"outDir": "build/dist", | ||
"module": "esnext", | ||
"target": "es5", | ||
"lib": [ | ||
"es6", | ||
"dom" | ||
], | ||
"sourceMap": true, | ||
"allowJs": true, | ||
"jsx": "react-jsx", | ||
"moduleResolution": "node", | ||
"esModuleInterop": true, | ||
"rootDir": "src", | ||
"noImplicitReturns": true, | ||
"noImplicitThis": true, | ||
"noImplicitAny": true, | ||
"strictNullChecks": true, | ||
"skipLibCheck": true, | ||
"allowSyntheticDefaultImports": true, | ||
"strict": true, | ||
"forceConsistentCasingInFileNames": true, | ||
"noFallthroughCasesInSwitch": true, | ||
"resolveJsonModule": true, | ||
"isolatedModules": true, | ||
"noEmit": true, | ||
"typeRoots" : ["node_modules/@types", "src/types"], | ||
}, | ||
"exclude": [ | ||
"node_modules", | ||
"build", | ||
"scripts", | ||
"acceptance-tests", | ||
"webpack", | ||
"jest", | ||
"src/setupTests.ts" | ||
], | ||
"types": [ | ||
"typePatches" | ||
], | ||
"include": [ | ||
"src" | ||
] | ||
} |