🏗️ Migrerer fra Next.js til Vite react
Co-authored-by: Øydis Kind Refsum <oydis.kind.refsum@nav.no> Co-authored-by: Christian Bulow Skovborg <christian.bulow.skovborg@nav.no> Co-authored-by: Amalie Mansåker <amalie.erdal.mansaker@nav.no> Co-authored-by: Sindre Kjelsrud <sindre.kjelsrud@nav.no>
This commit is contained in:
		
							parent
							
								
									aafa3cf243
								
							
						
					
					
						commit
						177d6c7cd8
					
				
					 40 changed files with 4738 additions and 2502 deletions
				
			
		
							
								
								
									
										6
									
								
								next-frontend/pages/_app.tsx
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								next-frontend/pages/_app.tsx
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,6 @@ | |||
| import '@/styles/globals.css' | ||||
| import type { AppProps } from 'next/app' | ||||
| 
 | ||||
| export default function App({ Component, pageProps }: AppProps) { | ||||
|   return <Component {...pageProps} /> | ||||
| } | ||||
							
								
								
									
										13
									
								
								next-frontend/pages/_document.tsx
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								next-frontend/pages/_document.tsx
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,13 @@ | |||
| import { Html, Head, Main, NextScript } from 'next/document' | ||||
| 
 | ||||
| export default function Document() { | ||||
|   return ( | ||||
|     <Html lang="en"> | ||||
|       <Head /> | ||||
|       <body> | ||||
|         <Main /> | ||||
|         <NextScript /> | ||||
|       </body> | ||||
|     </Html> | ||||
|   ) | ||||
| } | ||||
							
								
								
									
										13
									
								
								next-frontend/pages/api/http.ts
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								next-frontend/pages/api/http.ts
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,13 @@ | |||
| import axios from "axios"; | ||||
| 
 | ||||
| export default function post(route: String, data?: Object) { | ||||
|     axios.post("https://helse-sprik.intern.dev.nav.no" + route, data, { | ||||
|         headers: { | ||||
|             'Content-Type': 'application/json' | ||||
|         } | ||||
|     }).then((response) => { | ||||
|         console.log(response) | ||||
|     }).catch((error) => { | ||||
|         console.log(error); | ||||
|     }) | ||||
| } | ||||
							
								
								
									
										90
									
								
								next-frontend/pages/feil/index.tsx
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										90
									
								
								next-frontend/pages/feil/index.tsx
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,90 @@ | |||
| import "@navikt/ds-css"; | ||||
| 
 | ||||
| import { ArrowLeftIcon, BugIcon, UploadIcon } from "@navikt/aksel-icons"; | ||||
| import { Button, Heading, TextField, Textarea } from "@navikt/ds-react"; | ||||
| import post from "../api/http"; | ||||
| import axios from "axios"; | ||||
| import { useState } from "react"; | ||||
| import router from "next/router"; | ||||
| import BildeOpplastning from "@/components/BildeOpplastning"; | ||||
| import Header from "@/components/Header"; | ||||
| 
 | ||||
| export default function Feil() { | ||||
|     const [tittel, setTittel] = useState(""); | ||||
|     const [beskrivelse, setBeskrivelse] = useState(""); | ||||
| 
 | ||||
|     const handleSubmit = () => { | ||||
|         axios.post("https://helse-sprik.intern.dev.nav.no/nyFeil", | ||||
|             { | ||||
|                 "data": { | ||||
|                     tittel: tittel, | ||||
|                     beskrivelse: beskrivelse, | ||||
|                     dato: new Date() | ||||
|                 } | ||||
|             }, { | ||||
|                 headers: { | ||||
|                     'Content-Type': 'application/json' | ||||
|                 } | ||||
|             }).then((response) => { | ||||
|                 console.log(response) | ||||
|             }).catch((error) => { | ||||
|                 console.log(error); | ||||
|             }) | ||||
|     } | ||||
| 
 | ||||
|         // TODO: clear data fra felter
 | ||||
| 
 | ||||
| 
 | ||||
|     return ( | ||||
|         <main className="flex flex-col h-screen"> | ||||
|             <Header/> | ||||
|             <div className="flex grow"> | ||||
|                 <div className="w-1/4 bg-bg-subtle"></div> | ||||
|                 <div className="flex flex-col justify-center gap-16 p-8 px-16  grow"> | ||||
|                     <div className=" flex flex-col gap-2 justify-center"> | ||||
|                         <BugIcon | ||||
|                             title="Insekts ikon" | ||||
|                             fontSize="3rem" | ||||
|                         /> | ||||
|                         <Heading | ||||
|                             level="1" | ||||
|                             size="xlarge" | ||||
|                         > | ||||
|                             Innmelding av feil i speil | ||||
|                         </Heading> | ||||
|                     </div> | ||||
|                     <div className="w-1/2 flex flex-col gap-4 justify-center"> | ||||
|                         <TextField | ||||
|                             label="Tittel" | ||||
|                             onChange={e => setTittel(e.target.value)} | ||||
|                         /> | ||||
|                         <Textarea | ||||
|                             label="Beskrivelse" | ||||
|                             description="Detaljert beskrivelse av problemet" | ||||
|                             onChange={e => setBeskrivelse(e.target.value)} | ||||
|                         /> | ||||
|                         <BildeOpplastning/> | ||||
|                     </div> | ||||
|                     <div className="w-1/2 flex flex-col gap-2 justify-center"> | ||||
|                         <Button | ||||
|                             onClick={handleSubmit} | ||||
|                             variant="primary" | ||||
|                         > | ||||
|                             Meld inn feil | ||||
|                         </Button> | ||||
|                         <Button | ||||
|                             variant="tertiary" | ||||
|                             icon={<ArrowLeftIcon />} | ||||
|                             onClick={() => { | ||||
|                                 router.push('/') | ||||
|                             }} | ||||
|                         > | ||||
|                             Gå tilbake til hovedmenyen | ||||
|                         </Button> | ||||
|                     </div>                 | ||||
|                 </div> | ||||
|                 <div className="w-1/4 bg-bg-subtle"></div> | ||||
|             </div> | ||||
|         </main> | ||||
|     ) | ||||
| } | ||||
							
								
								
									
										53
									
								
								next-frontend/pages/index.tsx
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										53
									
								
								next-frontend/pages/index.tsx
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,53 @@ | |||
| import CardsContainer from "@/components/CardsContainer"; | ||||
| import Header from "@/components/Header"; | ||||
| import "@navikt/ds-css"; | ||||
| import { Button, Heading, Search } from "@navikt/ds-react"; | ||||
| import router from "next/router"; | ||||
| 
 | ||||
| export default function Home() { | ||||
|   const handleFeil = () => { | ||||
|     router.push('/feil') | ||||
|   } | ||||
| 
 | ||||
|   return ( | ||||
|     <main className="flex flex-col h-screen"> | ||||
|       <Header/> | ||||
|       <div className="flex justify-center grow"> | ||||
|         <div className="bg-bg-subtle w-1/6 p-8 flex flex-col justify-end"> | ||||
|           <div className="flex flex-col gap-4 text-center bottom-0"> | ||||
|             <Button  | ||||
|               variant="primary"  | ||||
|               onClick={handleFeil} | ||||
|             > | ||||
|               Meld inn feil | ||||
|             </Button> | ||||
|             <Button  | ||||
|               variant="secondary" | ||||
|             > | ||||
|               Meld inn funksjonalitetsønsker | ||||
|             </Button> | ||||
|           </div> | ||||
|         </div> | ||||
| 
 | ||||
|         <div className="p-8 grow flex gap-8 flex-col"> | ||||
|           <Search | ||||
|             label="Søk gjennom innmeldte feil (nøkkelord, tags, status)" | ||||
|             variant="primary" | ||||
|             hideLabel={false} | ||||
|           /> | ||||
|           <Heading  | ||||
|             level="1"  | ||||
|             size="medium" | ||||
|           > | ||||
|             Innmeldte feil (saker, feilmeldinger poster, feil) | ||||
|           </Heading> | ||||
|           <CardsContainer/> | ||||
|         </div> | ||||
| 
 | ||||
|         <div className="bg-bg-subtle w-1/6 p-8"> | ||||
|           <h1>Filter to be</h1> | ||||
|         </div> | ||||
|       </div> | ||||
|     </main> | ||||
|   ) | ||||
| } | ||||
		Reference in a new issue
	
	 Markus Johansen
						Markus Johansen