Showing
15 changed files
with
461 additions
and
1 deletions
.gitignore
0 β 100644
1 | +# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. | ||
2 | + | ||
3 | +# dependencies | ||
4 | +/node_modules | ||
5 | +/.pnp | ||
6 | +.pnp.js | ||
7 | + | ||
8 | +# testing | ||
9 | +/coverage | ||
10 | + | ||
11 | +# production | ||
12 | +/build | ||
13 | + | ||
14 | +# misc | ||
15 | +.DS_Store | ||
16 | +.env.local | ||
17 | +.env.development.local | ||
18 | +.env.test.local | ||
19 | +.env.production.local | ||
20 | +.eslintcache | ||
21 | + | ||
22 | +npm-debug.log* | ||
23 | +yarn-debug.log* | ||
24 | +yarn-error.log* |
... | @@ -14,4 +14,9 @@ | ... | @@ -14,4 +14,9 @@ |
14 | ### νμ | 14 | ### νμ |
15 | - κΆλμ (2016110307) | 15 | - κΆλμ (2016110307) |
16 | 16 | ||
17 | -- κΉλ€μ (2017110268) | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
17 | +- κΉλ€μ (2017110268) | ||
18 | + | ||
19 | +#### | ||
20 | +- `$ yarn global add create-react-app` | ||
21 | +- `$ create-react-app teleprompt-sst` | ||
22 | +- `$ yarn add @material-ui/core` | ||
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
package.json
0 β 100644
1 | +{ | ||
2 | + "name": "teleprompter-sst", | ||
3 | + "version": "0.1.0", | ||
4 | + "private": true, | ||
5 | + "dependencies": { | ||
6 | + "@material-ui/core": "^4.11.0", | ||
7 | + "@testing-library/jest-dom": "^5.11.4", | ||
8 | + "@testing-library/react": "^11.1.0", | ||
9 | + "@testing-library/user-event": "^12.1.10", | ||
10 | + "react": "^17.0.1", | ||
11 | + "react-dom": "^17.0.1", | ||
12 | + "react-scripts": "4.0.1", | ||
13 | + "web-vitals": "^0.2.4" | ||
14 | + }, | ||
15 | + "scripts": { | ||
16 | + "start": "react-scripts start", | ||
17 | + "build": "react-scripts build", | ||
18 | + "test": "react-scripts test", | ||
19 | + "eject": "react-scripts eject" | ||
20 | + }, | ||
21 | + "eslintConfig": { | ||
22 | + "extends": [ | ||
23 | + "react-app", | ||
24 | + "react-app/jest" | ||
25 | + ] | ||
26 | + }, | ||
27 | + "browserslist": { | ||
28 | + "production": [ | ||
29 | + ">0.2%", | ||
30 | + "not dead", | ||
31 | + "not op_mini all" | ||
32 | + ], | ||
33 | + "development": [ | ||
34 | + "last 1 chrome version", | ||
35 | + "last 1 firefox version", | ||
36 | + "last 1 safari version" | ||
37 | + ] | ||
38 | + } | ||
39 | +} |
public/index.html
0 β 100644
1 | +<!DOCTYPE html> | ||
2 | +<html lang="en"> | ||
3 | + <head> | ||
4 | + <meta charset="utf-8" /> | ||
5 | + <link rel="icon" href="%PUBLIC_URL%/favicon.ico" /> | ||
6 | + <meta name="viewport" content="width=device-width, initial-scale=1" /> | ||
7 | + <meta name="theme-color" content="#000000" /> | ||
8 | + <meta | ||
9 | + name="description" | ||
10 | + content="Web site created using create-react-app" | ||
11 | + /> | ||
12 | + <link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" /> | ||
13 | + <!-- | ||
14 | + manifest.json provides metadata used when your web app is installed on a | ||
15 | + user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/ | ||
16 | + --> | ||
17 | + <link rel="manifest" href="%PUBLIC_URL%/manifest.json" /> | ||
18 | + <!-- | ||
19 | + Notice the use of %PUBLIC_URL% in the tags above. | ||
20 | + It will be replaced with the URL of the `public` folder during the build. | ||
21 | + Only files inside the `public` folder can be referenced from the HTML. | ||
22 | + | ||
23 | + Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will | ||
24 | + work correctly both with client-side routing and a non-root public URL. | ||
25 | + Learn how to configure a non-root public URL by running `npm run build`. | ||
26 | + --> | ||
27 | + <title>React App</title> | ||
28 | + </head> | ||
29 | + <body> | ||
30 | + <noscript>You need to enable JavaScript to run this app.</noscript> | ||
31 | + <div id="root"></div> | ||
32 | + <!-- | ||
33 | + This HTML file is a template. | ||
34 | + If you open it directly in the browser, you will see an empty page. | ||
35 | + | ||
36 | + You can add webfonts, meta tags, or analytics to this file. | ||
37 | + The build step will place the bundled scripts into the <body> tag. | ||
38 | + | ||
39 | + To begin the development, run `npm start` or `yarn start`. | ||
40 | + To create a production bundle, use `npm run build` or `yarn build`. | ||
41 | + --> | ||
42 | + </body> | ||
43 | +</html> |
public/manifest.json
0 β 100644
1 | +{ | ||
2 | + "short_name": "React App", | ||
3 | + "name": "Create React App Sample", | ||
4 | + "icons": [ | ||
5 | + { | ||
6 | + "src": "favicon.ico", | ||
7 | + "sizes": "64x64 32x32 24x24 16x16", | ||
8 | + "type": "image/x-icon" | ||
9 | + }, | ||
10 | + { | ||
11 | + "src": "logo192.png", | ||
12 | + "type": "image/png", | ||
13 | + "sizes": "192x192" | ||
14 | + }, | ||
15 | + { | ||
16 | + "src": "logo512.png", | ||
17 | + "type": "image/png", | ||
18 | + "sizes": "512x512" | ||
19 | + } | ||
20 | + ], | ||
21 | + "start_url": ".", | ||
22 | + "display": "standalone", | ||
23 | + "theme_color": "#000000", | ||
24 | + "background_color": "#ffffff" | ||
25 | +} |
public/robots.txt
0 β 100644
src/App.css
0 β 100644
1 | +.App { | ||
2 | + text-align: center; | ||
3 | +} | ||
4 | + | ||
5 | +.App-logo { | ||
6 | + height: 40vmin; | ||
7 | + pointer-events: none; | ||
8 | +} | ||
9 | + | ||
10 | +@media (prefers-reduced-motion: no-preference) { | ||
11 | + .App-logo { | ||
12 | + animation: App-logo-spin infinite 20s linear; | ||
13 | + } | ||
14 | +} | ||
15 | + | ||
16 | +.App-header { | ||
17 | + background-color: #282c34; | ||
18 | + min-height: 100vh; | ||
19 | + display: flex; | ||
20 | + flex-direction: column; | ||
21 | + align-items: center; | ||
22 | + justify-content: center; | ||
23 | + font-size: calc(10px + 2vmin); | ||
24 | + color: white; | ||
25 | +} | ||
26 | + | ||
27 | +.App-link { | ||
28 | + color: #61dafb; | ||
29 | +} | ||
30 | + | ||
31 | +@keyframes App-logo-spin { | ||
32 | + from { | ||
33 | + transform: rotate(0deg); | ||
34 | + } | ||
35 | + to { | ||
36 | + transform: rotate(360deg); | ||
37 | + } | ||
38 | +} |
src/App.js
0 β 100644
1 | +import React, { Component, Fragment } from 'react'; | ||
2 | +import './App.css'; | ||
3 | +import { withStyles, Typography, Paper, Button} from '@material-ui/core'; | ||
4 | +import TextField from '@material-ui/core/TextField'; | ||
5 | + | ||
6 | +const styles = theme => ({ | ||
7 | + root: { | ||
8 | + '& .MuiTextField-root': { | ||
9 | + margin: theme.spacing(1), | ||
10 | + width: '100%', | ||
11 | + minWidth: 1080 | ||
12 | + }, | ||
13 | + }, | ||
14 | + title: { | ||
15 | + marginTop: 150, | ||
16 | + textAlign: 'center', | ||
17 | + display: 'none', | ||
18 | + fontSize: '3.0rem', | ||
19 | + [theme.breakpoints.up('sm')]: { | ||
20 | + display: 'block', | ||
21 | + // fontSize: '20', | ||
22 | + } | ||
23 | + }, | ||
24 | + paper: { | ||
25 | + marginTop: 100, | ||
26 | + marginLeft: 500, | ||
27 | + marginRight: 500 | ||
28 | + }, | ||
29 | + button: { | ||
30 | + marginTop: 15, | ||
31 | + marginLeft: 1320, | ||
32 | + }, | ||
33 | + }); | ||
34 | + | ||
35 | +class App extends Component { | ||
36 | + render() { | ||
37 | + const { classes } = this.props; | ||
38 | + return ( | ||
39 | + <> | ||
40 | + <Typography className={classes.title} variant="h6" color="inherit" noWrap> | ||
41 | + μμ±μ λ§μΆ° λλ³Έμ νλ©΄μ μ€μκ°μΌλ‘ μΆλ ₯νλ ν둬νν° μλΉμ€ | ||
42 | + </Typography> | ||
43 | + <Paper className={classes.paper} elevation={3}> | ||
44 | + <TextField id="outlined-textarea" label="Scriptλ₯Ό μ λ ₯ν΄μ£ΌμΈμ." fullWidth="true" rows={20} placeholder="Script" multiline variant="outlined"/> | ||
45 | + </Paper> | ||
46 | + <Button className={classes.button} variant="contained" color="primary">μμν©λλ€.</Button> | ||
47 | + </> | ||
48 | + ); | ||
49 | + } | ||
50 | +} | ||
51 | + | ||
52 | +// export default makeStyles(useStyles)(App); | ||
53 | +// export default App; | ||
54 | +export default withStyles(styles)(App); | ||
55 | + |
src/App.test.js
0 β 100644
src/index.css
0 β 100644
1 | +@import url(http://fonts.googleapis.com/earlyaccess/notosanskr.css); | ||
2 | + | ||
3 | +body { | ||
4 | + margin: 0; | ||
5 | + padding: 0; | ||
6 | + font-family: "Noto Sans KR", -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", | ||
7 | + "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", | ||
8 | + sans-serif; | ||
9 | + -webkit-font-smoothing: antialiased; | ||
10 | + -moz-osx-font-smoothing: grayscale; | ||
11 | +} | ||
12 | + | ||
13 | +code { | ||
14 | + font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New", | ||
15 | + monospace; | ||
16 | +} | ||
17 | + | ||
18 | +/* body { | ||
19 | + margin: 0; | ||
20 | + font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', | ||
21 | + 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', | ||
22 | + sans-serif; | ||
23 | + -webkit-font-smoothing: antialiased; | ||
24 | + -moz-osx-font-smoothing: grayscale; | ||
25 | +} | ||
26 | + | ||
27 | +code { | ||
28 | + font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', | ||
29 | + monospace; | ||
30 | +} */ |
src/index.js
0 β 100644
1 | +import React from 'react'; | ||
2 | +import ReactDOM from 'react-dom'; | ||
3 | +import './index.css'; | ||
4 | +import App from './App'; | ||
5 | +import * as serviceWorker from './serviceWorker'; | ||
6 | +import { MuiThemeProvider, createMuiTheme } from '@material-ui/core/styles'; | ||
7 | + | ||
8 | +const theme = createMuiTheme({ | ||
9 | + typography: { | ||
10 | + fontFamily: '"Noto Sans KR", serif', | ||
11 | + } | ||
12 | +}) | ||
13 | + | ||
14 | +ReactDOM.render(<MuiThemeProvider theme={theme}><App /></MuiThemeProvider>, document.getElementById('root')); | ||
15 | + | ||
16 | +// If you want your app to work offline and load faster, you can change | ||
17 | +// unregister() to register() below. Note this comes with some pitfalls. | ||
18 | +// Learn more about service workers: http://bit.ly/CRA-PWA | ||
19 | +serviceWorker.unregister(); | ||
20 | + | ||
21 | +// import React from 'react'; | ||
22 | +// import ReactDOM from 'react-dom'; | ||
23 | +// import './index.css'; | ||
24 | +// import App from './App'; | ||
25 | +// import reportWebVitals from './reportWebVitals'; | ||
26 | + | ||
27 | +// ReactDOM.render( | ||
28 | +// <React.StrictMode> | ||
29 | +// <App /> | ||
30 | +// </React.StrictMode>, | ||
31 | +// document.getElementById('root') | ||
32 | +// ); | ||
33 | + | ||
34 | +// // If you want to start measuring performance in your app, pass a function | ||
35 | +// // to log results (for example: reportWebVitals(console.log)) | ||
36 | +// // or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals | ||
37 | +// reportWebVitals(); |
src/reportWebVitals.js
0 β 100644
1 | +const reportWebVitals = onPerfEntry => { | ||
2 | + if (onPerfEntry && onPerfEntry instanceof Function) { | ||
3 | + import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => { | ||
4 | + getCLS(onPerfEntry); | ||
5 | + getFID(onPerfEntry); | ||
6 | + getFCP(onPerfEntry); | ||
7 | + getLCP(onPerfEntry); | ||
8 | + getTTFB(onPerfEntry); | ||
9 | + }); | ||
10 | + } | ||
11 | +}; | ||
12 | + | ||
13 | +export default reportWebVitals; |
src/serviceWorker.js
0 β 100644
1 | +// This optional code is used to register a service worker. | ||
2 | +// register() is not called by default. | ||
3 | + | ||
4 | +// This lets the app load faster on subsequent visits in production, and gives | ||
5 | +// it offline capabilities. However, it also means that developers (and users) | ||
6 | +// will only see deployed updates on subsequent visits to a page, after all the | ||
7 | +// existing tabs open on the page have been closed, since previously cached | ||
8 | +// resources are updated in the background. | ||
9 | + | ||
10 | +// To learn more about the benefits of this model and instructions on how to | ||
11 | +// opt-in, read http://bit.ly/CRA-PWA | ||
12 | + | ||
13 | +const isLocalhost = Boolean( | ||
14 | + window.location.hostname === 'localhost' || | ||
15 | + // [::1] is the IPv6 localhost address. | ||
16 | + window.location.hostname === '[::1]' || | ||
17 | + // 127.0.0.1/8 is considered localhost for IPv4. | ||
18 | + window.location.hostname.match( | ||
19 | + /^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/ | ||
20 | + ) | ||
21 | + ); | ||
22 | + | ||
23 | + export function register(config) { | ||
24 | + if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) { | ||
25 | + // The URL constructor is available in all browsers that support SW. | ||
26 | + const publicUrl = new URL(process.env.PUBLIC_URL, window.location.href); | ||
27 | + if (publicUrl.origin !== window.location.origin) { | ||
28 | + // Our service worker won't work if PUBLIC_URL is on a different origin | ||
29 | + // from what our page is served on. This might happen if a CDN is used to | ||
30 | + // serve assets; see https://github.com/facebook/create-react-app/issues/2374 | ||
31 | + return; | ||
32 | + } | ||
33 | + | ||
34 | + window.addEventListener('load', () => { | ||
35 | + const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`; | ||
36 | + | ||
37 | + if (isLocalhost) { | ||
38 | + // This is running on localhost. Let's check if a service worker still exists or not. | ||
39 | + checkValidServiceWorker(swUrl, config); | ||
40 | + | ||
41 | + // Add some additional logging to localhost, pointing developers to the | ||
42 | + // service worker/PWA documentation. | ||
43 | + navigator.serviceWorker.ready.then(() => { | ||
44 | + console.log( | ||
45 | + 'This web app is being served cache-first by a service ' + | ||
46 | + 'worker. To learn more, visit http://bit.ly/CRA-PWA' | ||
47 | + ); | ||
48 | + }); | ||
49 | + } else { | ||
50 | + // Is not localhost. Just register service worker | ||
51 | + registerValidSW(swUrl, config); | ||
52 | + } | ||
53 | + }); | ||
54 | + } | ||
55 | + } | ||
56 | + | ||
57 | + function registerValidSW(swUrl, config) { | ||
58 | + navigator.serviceWorker | ||
59 | + .register(swUrl) | ||
60 | + .then(registration => { | ||
61 | + registration.onupdatefound = () => { | ||
62 | + const installingWorker = registration.installing; | ||
63 | + if (installingWorker == null) { | ||
64 | + return; | ||
65 | + } | ||
66 | + installingWorker.onstatechange = () => { | ||
67 | + if (installingWorker.state === 'installed') { | ||
68 | + if (navigator.serviceWorker.controller) { | ||
69 | + // At this point, the updated precached content has been fetched, | ||
70 | + // but the previous service worker will still serve the older | ||
71 | + // content until all client tabs are closed. | ||
72 | + console.log( | ||
73 | + 'New content is available and will be used when all ' + | ||
74 | + 'tabs for this page are closed. See http://bit.ly/CRA-PWA.' | ||
75 | + ); | ||
76 | + | ||
77 | + // Execute callback | ||
78 | + if (config && config.onUpdate) { | ||
79 | + config.onUpdate(registration); | ||
80 | + } | ||
81 | + } else { | ||
82 | + // At this point, everything has been precached. | ||
83 | + // It's the perfect time to display a | ||
84 | + // "Content is cached for offline use." message. | ||
85 | + console.log('Content is cached for offline use.'); | ||
86 | + | ||
87 | + // Execute callback | ||
88 | + if (config && config.onSuccess) { | ||
89 | + config.onSuccess(registration); | ||
90 | + } | ||
91 | + } | ||
92 | + } | ||
93 | + }; | ||
94 | + }; | ||
95 | + }) | ||
96 | + .catch(error => { | ||
97 | + console.error('Error during service worker registration:', error); | ||
98 | + }); | ||
99 | + } | ||
100 | + | ||
101 | + function checkValidServiceWorker(swUrl, config) { | ||
102 | + // Check if the service worker can be found. If it can't reload the page. | ||
103 | + fetch(swUrl) | ||
104 | + .then(response => { | ||
105 | + // Ensure service worker exists, and that we really are getting a JS file. | ||
106 | + const contentType = response.headers.get('content-type'); | ||
107 | + if ( | ||
108 | + response.status === 404 || | ||
109 | + (contentType != null && contentType.indexOf('javascript') === -1) | ||
110 | + ) { | ||
111 | + // No service worker found. Probably a different app. Reload the page. | ||
112 | + navigator.serviceWorker.ready.then(registration => { | ||
113 | + registration.unregister().then(() => { | ||
114 | + window.location.reload(); | ||
115 | + }); | ||
116 | + }); | ||
117 | + } else { | ||
118 | + // Service worker found. Proceed as normal. | ||
119 | + registerValidSW(swUrl, config); | ||
120 | + } | ||
121 | + }) | ||
122 | + .catch(() => { | ||
123 | + console.log( | ||
124 | + 'No internet connection found. App is running in offline mode.' | ||
125 | + ); | ||
126 | + }); | ||
127 | + } | ||
128 | + | ||
129 | + export function unregister() { | ||
130 | + if ('serviceWorker' in navigator) { | ||
131 | + navigator.serviceWorker.ready.then(registration => { | ||
132 | + registration.unregister(); | ||
133 | + }); | ||
134 | + } | ||
135 | + } | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
src/setupTests.js
0 β 100644
yarn.lock
0 β 100644
This diff could not be displayed because it is too large.
-
Please register or login to post a comment