From ac123f23719e3212ec1a6a16e0b1f915d1c175b4 Mon Sep 17 00:00:00 2001 From: Jarred Sumner Date: Sun, 5 Sep 2021 15:34:35 -0700 Subject: create-react-app Former-commit-id: 33647ef65cbac1c89c16a8b81dfa7de0fad5af3e --- examples/hello-create-react-app/src/App.css | 38 ++++++++++++++++++++++ examples/hello-create-react-app/src/App.test.js | 8 +++++ examples/hello-create-react-app/src/index.css | 13 ++++++++ examples/hello-create-react-app/src/logo.svg | 1 + .../hello-create-react-app/src/reportWebVitals.js | 13 ++++++++ examples/hello-create-react-app/src/setupTests.js | 5 +++ 6 files changed, 78 insertions(+) create mode 100644 examples/hello-create-react-app/src/App.css create mode 100644 examples/hello-create-react-app/src/App.test.js create mode 100644 examples/hello-create-react-app/src/index.css create mode 100644 examples/hello-create-react-app/src/logo.svg create mode 100644 examples/hello-create-react-app/src/reportWebVitals.js create mode 100644 examples/hello-create-react-app/src/setupTests.js (limited to 'examples/hello-create-react-app/src') diff --git a/examples/hello-create-react-app/src/App.css b/examples/hello-create-react-app/src/App.css new file mode 100644 index 000000000..74b5e0534 --- /dev/null +++ b/examples/hello-create-react-app/src/App.css @@ -0,0 +1,38 @@ +.App { + text-align: center; +} + +.App-logo { + height: 40vmin; + pointer-events: none; +} + +@media (prefers-reduced-motion: no-preference) { + .App-logo { + animation: App-logo-spin infinite 20s linear; + } +} + +.App-header { + background-color: #282c34; + min-height: 100vh; + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + font-size: calc(10px + 2vmin); + color: white; +} + +.App-link { + color: #61dafb; +} + +@keyframes App-logo-spin { + from { + transform: rotate(0deg); + } + to { + transform: rotate(360deg); + } +} diff --git a/examples/hello-create-react-app/src/App.test.js b/examples/hello-create-react-app/src/App.test.js new file mode 100644 index 000000000..1f03afeec --- /dev/null +++ b/examples/hello-create-react-app/src/App.test.js @@ -0,0 +1,8 @@ +import { render, screen } from '@testing-library/react'; +import App from './App'; + +test('renders learn react link', () => { + render(); + const linkElement = screen.getByText(/learn react/i); + expect(linkElement).toBeInTheDocument(); +}); diff --git a/examples/hello-create-react-app/src/index.css b/examples/hello-create-react-app/src/index.css new file mode 100644 index 000000000..ec2585e8c --- /dev/null +++ b/examples/hello-create-react-app/src/index.css @@ -0,0 +1,13 @@ +body { + margin: 0; + font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', + 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', + sans-serif; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; +} + +code { + font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', + monospace; +} diff --git a/examples/hello-create-react-app/src/logo.svg b/examples/hello-create-react-app/src/logo.svg new file mode 100644 index 000000000..9dfc1c058 --- /dev/null +++ b/examples/hello-create-react-app/src/logo.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/examples/hello-create-react-app/src/reportWebVitals.js b/examples/hello-create-react-app/src/reportWebVitals.js new file mode 100644 index 000000000..5253d3ad9 --- /dev/null +++ b/examples/hello-create-react-app/src/reportWebVitals.js @@ -0,0 +1,13 @@ +const reportWebVitals = onPerfEntry => { + if (onPerfEntry && onPerfEntry instanceof Function) { + import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => { + getCLS(onPerfEntry); + getFID(onPerfEntry); + getFCP(onPerfEntry); + getLCP(onPerfEntry); + getTTFB(onPerfEntry); + }); + } +}; + +export default reportWebVitals; diff --git a/examples/hello-create-react-app/src/setupTests.js b/examples/hello-create-react-app/src/setupTests.js new file mode 100644 index 000000000..8f2609b7b --- /dev/null +++ b/examples/hello-create-react-app/src/setupTests.js @@ -0,0 +1,5 @@ +// jest-dom adds custom jest matchers for asserting on DOM nodes. +// allows you to do things like: +// expect(element).toHaveTextContent(/react/i) +// learn more: https://github.com/testing-library/jest-dom +import '@testing-library/jest-dom'; -- cgit v1.2.3