diff --git a/.eslintrc b/.eslintrc new file mode 100644 index 0000000..15b1ed9 --- /dev/null +++ b/.eslintrc @@ -0,0 +1,3 @@ +{ + "extends": "next" +} diff --git a/.gitignore b/.gitignore index 6704566..1437c53 100644 --- a/.gitignore +++ b/.gitignore @@ -1,104 +1,34 @@ -# Logs -logs -*.log +# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. + +# dependencies +/node_modules +/.pnp +.pnp.js + +# testing +/coverage + +# next.js +/.next/ +/out/ + +# production +/build + +# misc +.DS_Store +*.pem + +# debug npm-debug.log* yarn-debug.log* yarn-error.log* -lerna-debug.log* -# Diagnostic reports (https://nodejs.org/api/report.html) -report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json +# local env files +.env.local +.env.development.local +.env.test.local +.env.production.local -# Runtime data -pids -*.pid -*.seed -*.pid.lock - -# Directory for instrumented libs generated by jscoverage/JSCover -lib-cov - -# Coverage directory used by tools like istanbul -coverage -*.lcov - -# nyc test coverage -.nyc_output - -# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) -.grunt - -# Bower dependency directory (https://bower.io/) -bower_components - -# node-waf configuration -.lock-wscript - -# Compiled binary addons (https://nodejs.org/api/addons.html) -build/Release - -# Dependency directories -node_modules/ -jspm_packages/ - -# TypeScript v1 declaration files -typings/ - -# TypeScript cache -*.tsbuildinfo - -# Optional npm cache directory -.npm - -# Optional eslint cache -.eslintcache - -# Microbundle cache -.rpt2_cache/ -.rts2_cache_cjs/ -.rts2_cache_es/ -.rts2_cache_umd/ - -# Optional REPL history -.node_repl_history - -# Output of 'npm pack' -*.tgz - -# Yarn Integrity file -.yarn-integrity - -# dotenv environment variables file -.env -.env.test - -# parcel-bundler cache (https://parceljs.org/) -.cache - -# Next.js build output -.next - -# Nuxt.js build / generate output -.nuxt -dist - -# Gatsby files -.cache/ -# Comment in the public line in if your project uses Gatsby and *not* Next.js -# https://nextjs.org/blog/next-9-1#public-directory-support -# public - -# vuepress build output -.vuepress/dist - -# Serverless directories -.serverless/ - -# FuseBox cache -.fusebox/ - -# DynamoDB Local files -.dynamodb/ - -# TernJS port file -.tern-port +# vercel +.vercel diff --git a/README.md b/README.md index 2d7db0a..3cb3ae3 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,47 @@ -# lucid-creations-wesbite -The new and improved Lucid Creations Media website. +# TypeScript Next.js example + +This is a really simple project that shows the usage of Next.js with TypeScript. + +## Preview + +Preview the example live on [StackBlitz](http://stackblitz.com/): + +[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/vercel/next.js/tree/canary/examples/with-typescript) + +## Deploy your own + +Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_medium=readme&utm_campaign=next-example): + +[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/git/external?repository-url=https://github.com/vercel/next.js/tree/canary/examples/with-typescript&project-name=with-typescript&repository-name=with-typescript) + +## How to use it? + +Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example: + +```bash +npx create-next-app --example with-typescript with-typescript-app +# or +yarn create next-app --example with-typescript with-typescript-app +``` + +Deploy it to the cloud with [Vercel](https://vercel.com/new?utm_source=github&utm_medium=readme&utm_campaign=next-example) ([Documentation](https://nextjs.org/docs/deployment)). + +## Notes + +This example shows how to integrate the TypeScript type system into Next.js. Since TypeScript is supported out of the box with Next.js, all we have to do is to install TypeScript. + +``` +npm install --save-dev typescript +``` + +To enable TypeScript's features, we install the type declarations for React and Node. + +``` +npm install --save-dev @types/react @types/react-dom @types/node +``` + +When we run `next dev` the next time, Next.js will start looking for any `.ts` or `.tsx` files in our project and builds it. It even automatically creates a `tsconfig.json` file for our project with the recommended settings. + +Next.js has built-in TypeScript declarations, so we'll get autocompletion for Next.js' modules straight away. + +A `type-check` script is also added to `package.json`, which runs TypeScript's `tsc` CLI in `noEmit` mode to run type-checking separately. You can then include this, for example, in your `test` scripts. diff --git a/components/layout/Footer.tsx b/components/layout/Footer.tsx new file mode 100644 index 0000000..8613950 --- /dev/null +++ b/components/layout/Footer.tsx @@ -0,0 +1,12 @@ +import React, { Fragment } from "react"; + +const Footer = (): JSX.Element => { + return ( + + ) +}; + +export default Footer; \ No newline at end of file diff --git a/interfaces/index.ts b/interfaces/index.ts new file mode 100644 index 0000000..68528c5 --- /dev/null +++ b/interfaces/index.ts @@ -0,0 +1,10 @@ +// You can include shared interfaces/types in a separate file +// and then use them in any component by importing them. For +// example, to import the interface below do: +// +// import { User } from 'path/to/interfaces'; + +export type User = { + id: number + name: string +} diff --git a/next-env.d.ts b/next-env.d.ts new file mode 100644 index 0000000..c6643fd --- /dev/null +++ b/next-env.d.ts @@ -0,0 +1,3 @@ +/// +/// +/// diff --git a/package.json b/package.json new file mode 100644 index 0000000..e854a27 --- /dev/null +++ b/package.json @@ -0,0 +1,24 @@ +{ + "private": true, + "scripts": { + "dev": "next", + "build": "next build", + "start": "next start", + "type-check": "tsc", + "lint": "next lint" + }, + "dependencies": { + "next": "latest", + "react": "^17.0.2", + "react-dom": "^17.0.2" + }, + "devDependencies": { + "@types/node": "^16.4.13", + "@types/react": "^17.0.2", + "@types/react-dom": "^17.0.1", + "eslint": "^7.32.0", + "eslint-config-next": "^11.0.1", + "typescript": "4.3.5" + }, + "license": "MIT" +} diff --git a/pages/_document.tsx b/pages/_document.tsx new file mode 100644 index 0000000..49474bd --- /dev/null +++ b/pages/_document.tsx @@ -0,0 +1,24 @@ +import Document, { Html, Main, NextScript, Head } from 'next/document' +import Footer from '../components/layout/Footer' + +class MyDocument extends Document { + render() { + return ( + + + + + + + + +
+ + +