From 6ed835cc3d6ab4bd3016e3381dcfe8b072fb3b74 Mon Sep 17 00:00:00 2001 From: Gabriel Ferraz Date: Wed, 4 Jan 2023 10:36:31 -0300 Subject: [PATCH] =?UTF-8?q?feat:=20cria=C3=A7=C3=A3o=20da=20base=20do=20ro?= =?UTF-8?q?uter?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- desafio-react-e-typescript/src/App.tsx | 4 +++- desafio-react-e-typescript/src/index.tsx | 5 ++++- desafio-react-e-typescript/src/pages/About.tsx | 3 +++ desafio-react-e-typescript/src/pages/home.tsx | 3 +++ desafio-react-e-typescript/src/reportWebVitals.ts | 15 --------------- desafio-react-e-typescript/src/router.tsx | 13 +++++++++++++ 6 files changed, 26 insertions(+), 17 deletions(-) create mode 100644 desafio-react-e-typescript/src/pages/About.tsx create mode 100644 desafio-react-e-typescript/src/pages/home.tsx delete mode 100644 desafio-react-e-typescript/src/reportWebVitals.ts create mode 100644 desafio-react-e-typescript/src/router.tsx diff --git a/desafio-react-e-typescript/src/App.tsx b/desafio-react-e-typescript/src/App.tsx index fa188a4..604da2b 100644 --- a/desafio-react-e-typescript/src/App.tsx +++ b/desafio-react-e-typescript/src/App.tsx @@ -1,3 +1,5 @@ +import { Router } from "./router"; + export const App = () => { - return

Hello World !

; + return ; }; diff --git a/desafio-react-e-typescript/src/index.tsx b/desafio-react-e-typescript/src/index.tsx index 344619d..494dd23 100644 --- a/desafio-react-e-typescript/src/index.tsx +++ b/desafio-react-e-typescript/src/index.tsx @@ -1,5 +1,6 @@ import React from "react"; import ReactDOM from "react-dom/client"; +import { BrowserRouter } from "react-router-dom"; import { App } from "./App"; const root = ReactDOM.createRoot( @@ -7,6 +8,8 @@ const root = ReactDOM.createRoot( ); root.render( - + + + ); diff --git a/desafio-react-e-typescript/src/pages/About.tsx b/desafio-react-e-typescript/src/pages/About.tsx new file mode 100644 index 0000000..fde7c80 --- /dev/null +++ b/desafio-react-e-typescript/src/pages/About.tsx @@ -0,0 +1,3 @@ +export const About = () => { + return

Sobre

; +}; diff --git a/desafio-react-e-typescript/src/pages/home.tsx b/desafio-react-e-typescript/src/pages/home.tsx new file mode 100644 index 0000000..37cf53a --- /dev/null +++ b/desafio-react-e-typescript/src/pages/home.tsx @@ -0,0 +1,3 @@ +export const Home = () => { + return

Hello World

; +}; diff --git a/desafio-react-e-typescript/src/reportWebVitals.ts b/desafio-react-e-typescript/src/reportWebVitals.ts deleted file mode 100644 index 49a2a16..0000000 --- a/desafio-react-e-typescript/src/reportWebVitals.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { ReportHandler } from 'web-vitals'; - -const reportWebVitals = (onPerfEntry?: ReportHandler) => { - 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/desafio-react-e-typescript/src/router.tsx b/desafio-react-e-typescript/src/router.tsx new file mode 100644 index 0000000..c8eb6e2 --- /dev/null +++ b/desafio-react-e-typescript/src/router.tsx @@ -0,0 +1,13 @@ +import { Routes, Route } from "react-router-dom"; + +import { Home } from "./pages/home"; +import { About } from "./pages/About"; + +export const Router = () => { + return ( + + } /> + } /> + + ); +};