-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add Valeriy to reviewers * Ignore IDE * Upgrade next to v14 * Upgrade packages * Eslint config * Prettier, TS type * Sort package json * Take over some more stuff from most recent next app template * Imports * Layout * Imports * Remove tsbuildinfo * Gitignore * Fix eslint * Add format/lint commands to README.md * Use <Link> for fluent navigation
- Loading branch information
1 parent
f1d71aa
commit 57bb523
Showing
20 changed files
with
2,659 additions
and
415 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"extends": "next/core-web-vitals" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,15 @@ | ||
const Layout: React.FC = ({ children }) => { | ||
return <div className='container mx-auto py-5 px-5 md:px-0 md:py-10'> | ||
{children} | ||
</div> | ||
import { FC, ReactNode } from 'react' | ||
|
||
interface Props { | ||
children: ReactNode | ||
} | ||
const Layout: FC<Props> = ({ children }) => { | ||
return ( | ||
<div className="container mx-auto py-5 px-5 md:px-0 md:py-10"> | ||
<header className="py-5">DBL Code Challenge</header> | ||
{children} | ||
</div> | ||
) | ||
} | ||
|
||
export default Layout |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
/** @type {import('next').NextConfig} */ | ||
const nextConfig = {} | ||
|
||
export default nextConfig |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,39 @@ | ||
{ | ||
"name": "code-challenge-nextjs", | ||
"version": "0.1.0", | ||
"version": "1.0.0", | ||
"private": true, | ||
"scripts": { | ||
"dev": "next dev", | ||
"build": "next build", | ||
"dev": "next dev", | ||
"format": "yarn prettier --write './**/*.{js,json,ts,tsx,mjs}'", | ||
"lint": "next lint", | ||
"start": "next start" | ||
}, | ||
"engines": { | ||
"node": ">= 16.15 <19" | ||
"prettier": { | ||
"printWidth": 100, | ||
"semi": false, | ||
"singleQuote": true, | ||
"tabWidth": 2, | ||
"trailingComma": "all" | ||
}, | ||
"dependencies": { | ||
"axios": "^0.27.2", | ||
"next": "12.2.0", | ||
"react": "18.2.0", | ||
"react-dom": "18.2.0" | ||
"axios": "^1.7.2", | ||
"next": "^14.2.5", | ||
"react": "^18.3.1", | ||
"react-dom": "^18.3.1" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "^18.0.3", | ||
"@types/react": "^18.0.15", | ||
"autoprefixer": "^10.4.7", | ||
"postcss": "^8.4.14", | ||
"tailwindcss": "^3.1.4", | ||
"typescript": "^4.7.4" | ||
"@types/node": "^20.14.11", | ||
"@types/react": "^18.3.3", | ||
"autoprefixer": "^10.4.19", | ||
"eslint": "^8", | ||
"eslint-config-next": "^14.2.5", | ||
"postcss": "^8.4.39", | ||
"prettier": "^3.3.2", | ||
"tailwindcss": "^3.4.6", | ||
"typescript": "^5.5.4" | ||
}, | ||
"engines": { | ||
"node": ">=18" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
import { NextApiRequest, NextApiResponse } from 'next' | ||
|
||
import { allAirports } from '../../models/airport' | ||
import { allAirports } from '@/models/airport' | ||
|
||
export default async (req: NextApiRequest, res: NextApiResponse) => { | ||
const airports = async (req: NextApiRequest, res: NextApiResponse) => { | ||
const airports = await allAirports() | ||
|
||
res.status(200).json(airports) | ||
} | ||
|
||
export default airports |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,33 @@ | ||
import { NextPage } from 'next' | ||
|
||
import Layout from '../components/layout' | ||
import useApiData from '../hooks/use-api-data' | ||
import Airport from '../types/airport' | ||
import Layout from '@/components/layout' | ||
import useApiData from '@/hooks/use-api-data' | ||
import Airport from '@/types/airport' | ||
import Link from 'next/link' | ||
|
||
const Page: NextPage = () => { | ||
const airports = useApiData<Airport[]>('/api/airports', []) | ||
|
||
return <Layout> | ||
<h1 className='text-2xl'>DBL Code Challenge: Airports</h1> | ||
return ( | ||
<Layout> | ||
<h1 className="text-2xl">All Airports</h1> | ||
|
||
<h2 className="mt-10 text-xl">All Airports</h2> | ||
|
||
<div> | ||
{airports.map(airport => ( | ||
<a href={`/airports/${airport.iata.toLowerCase()}`} key={airport.iata} className='mt-5 flex items-center shadow p-5 border'> | ||
<div> | ||
{airport.name}, {airport.city} | ||
</div> | ||
<div className='ml-auto text-mono'> | ||
{airport.country} | ||
</div> | ||
</a> | ||
))} | ||
</div> | ||
</Layout> | ||
<div> | ||
{airports.map((airport) => ( | ||
<Link | ||
href={`/airports/${airport.iata.toLowerCase()}`} | ||
key={airport.iata} | ||
className="mt-5 flex items-center shadow p-5 border" | ||
> | ||
<div> | ||
{airport.name}, {airport.city} | ||
</div> | ||
<div className="ml-auto text-mono">{airport.country}</div> | ||
</Link> | ||
))} | ||
</div> | ||
</Layout> | ||
) | ||
} | ||
|
||
export default Page |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/** @type {import('postcss-load-config').Config} */ | ||
const config = { | ||
plugins: { | ||
tailwindcss: {}, | ||
}, | ||
} | ||
|
||
export default config |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import type { Config } from 'tailwindcss' | ||
|
||
const config: Config = { | ||
content: ['./components/**/*.{ts,tsx}', './pages/**/*.{ts,tsx}', './src/**/*.{ts,tsx}'], | ||
theme: { | ||
extend: { | ||
backgroundImage: { | ||
'gradient-radial': 'radial-gradient(var(--tw-gradient-stops))', | ||
'gradient-conic': 'conic-gradient(from 180deg at 50% 50%, var(--tw-gradient-stops))', | ||
}, | ||
}, | ||
}, | ||
plugins: [], | ||
} | ||
export default config |
Oops, something went wrong.