Skip to content

Commit

Permalink
firing up the map
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcoEscaleira committed Nov 21, 2023
1 parent b726fc9 commit 3ca1634
Show file tree
Hide file tree
Showing 9 changed files with 428 additions and 29 deletions.
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,14 @@
"lint": "next lint"
},
"dependencies": {
"mapbox-gl": "^2.15.0",
"next": "14.0.3",
"react": "^18.2.0",
"react-dom": "^18.2.0"
"react-dom": "^18.2.0",
"react-map-gl": "^7.1.6"
},
"devDependencies": {
"@types/mapbox-gl": "^2.7.19",
"@types/node": "^20.9.2",
"@types/react": "^18.2.37",
"@types/react-dom": "^18.2.15",
Expand Down
10 changes: 5 additions & 5 deletions src/app/about/page.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import Image from 'next/image'
import Image from "next/image";

export default function About() {
return (
<main className="flex w-screen min-h-screen items-center justify-center">
<h1 className='text-4xl text-blue-400'>About page</h1>
</main>
)
<div className="flex w-full">
<h1 className="text-4xl text-blue-400">About page</h1>
</div>
);
}
33 changes: 17 additions & 16 deletions src/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,25 +1,26 @@
import type { Metadata } from 'next'
import { Roboto } from 'next/font/google'
import './globals.css'
import type { Metadata } from "next";
import { Roboto } from "next/font/google";
import { Header } from "@/components/Header";
import "./globals.css";

const roboto = Roboto({
weight: '400',
subsets: ['latin'],
})
weight: "400",
subsets: ["latin"],
});

export const metadata: Metadata = {
title: 'Meet the Countries',
description: 'An app to get to know more about the countries around the globe. Come and meet unknown countries by playing quizzes about them and interacting with friends',
}
title: "Meet the Countries",
description:
"An app to get to know more about the countries around the globe. Come and meet unknown countries by playing quizzes about them and interacting with friends",
};

export default function RootLayout({
children,
}: {
children: React.ReactNode
}) {
export default function RootLayout({ children }: { children: React.ReactNode }) {
return (
<html lang="en">
<body className={roboto.className}>{children}</body>
<body className={roboto.className}>
<Header />
<main className="flex w-full h-[calc(100%-64px)]">{children}</main>
</body>
</html>
)
);
}
25 changes: 25 additions & 0 deletions src/app/map/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
"use client";
import { Map, NavigationControl, MapProvider, Layer } from "react-map-gl";
import "mapbox-gl/dist/mapbox-gl.css";

export default function MapPage() {
return (
<div className="flex w-full justify-center items-center">
<MapProvider>
<Map
id="quizMap"
mapboxAccessToken="pk.eyJ1IjoibWFyY29lc2NhbGVpcmFkbXUiLCJhIjoiY2xwN29ldHIwMG16bjJxbXJhZXc5dXUxOSJ9.ZP0gYeYBB-nL5py2RANUOw"
initialViewState={{
longitude: 5,
latitude: 46,
zoom: 4,
}}
style={{ width: "100%", height: "100%" }}
mapStyle="mapbox://styles/mapbox/streets-v11"
>
<NavigationControl position="bottom-right" showCompass />
</Map>
</MapProvider>
</div>
);
}
10 changes: 4 additions & 6 deletions src/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import Image from 'next/image'

export default function Home() {
return (
<main className="flex w-screen min-h-screen items-center justify-center">
<h1 className='text-4xl text-blue-400'>Meet the countries3</h1>
</main>
)
<div className="flex w-full">
<h1 className="text-4xl text-blue-400">Meet the countries</h1>
</div>
);
}
30 changes: 30 additions & 0 deletions src/components/Header/Header.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import Link from "next/link";
import { FC } from "react";

export const MenuLink: FC<{
href: string;
title: string;
}> = ({ href, title }) => {
return (
<Link
href={href}
className="px-6 py-2 font-medium text-white capitalize transition-colors duration-300 transform bg-blue-600 rounded-lg hover:bg-blue-500"
>
{title}
</Link>
);
};

export function Header() {
return (
<header className="flex w-full justify-between items-center h-16 px-8">
<h2>MtC</h2>

<nav className="flex gap-8 items-center">
<MenuLink href="/" title="Home" />
<MenuLink href="/map" title="Map" />
<MenuLink href="/about" title="About" />
</nav>
</header>
);
}
1 change: 1 addition & 0 deletions src/components/Header/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './Header'
Empty file removed src/components/index.ts
Empty file.
Loading

0 comments on commit 3ca1634

Please sign in to comment.