Install dependencies
npm install
Update your .env
file with values for each environment variable
API_KEY=AIzaSyBkkFF0XhNZeWuDmOfEhsgdfX1VBG7WTas
etc ...
Run the development server
npm run dev
When the above command completes you'll be able to view your website at http://localhost:3000
This project uses the following libraries and services:
- Framework - Next.js
- UI Kit - Bootstrap
- Analytics - Google Analytics
- Hosting - TBD
Styles
You can edit Bootstrap SASS variables in the global stylesheet located at src/styles/global.scss
. Variables allow you to control global styles (like colors and fonts), as well as element specific styles (like button padding). Before overriding Bootstrap elements with custom style check the Bootstrap docs to see if you can do what need by tweaking a SASS variable.
Custom styles are located in their related component's directory. For example, if any custom style is applied to the Navbar component you'll find it in src/components/Navbar.scss
. We ensure custom styles are scoped to their component by prepending the classname with the component name (such as .Navbar__brand
). This ensures styles never affect elements in other components. If styles need to be re-used in multiple components consider creating a new component that encapsulates that style and structure and using that component in multiple places.
Routing
This project uses the built-in Next.js router and its convenient useRouter
hook. Learn more in the Next.js docs.
import Link from 'next/link';
import { useRouter } from 'next/router';
function MyComponent() {
// Get the router object
const router = useRouter();
// Get value from query string (?postId=123) or route param (/:postId)
console.log(router.query.postId);
// Get current pathname
console.log(router.pathname);
// Navigate with the <Link> component or with router.push()
return (
<div>
<Link href="/about"><a>About</a></Link>
<button onClick={(e) => router.push("/about")}>About</button>
</div>
);
}
Deployment
This project wasn't setup with a specific web host in mind. Please follow the Next.js deployment docs to learn how to deploy your project to various hosts.
Other
This project was created using Divjoy, the React codebase generator. You can find more info in the Divjoy Docs.