Take Home Exam for: Frontend Position at Aha AI Created by: Sergio Suramin, S.Kom
- Next.js 14 (React.js)
- Typescript
- Material UI v5
- Tailwind CSS v3
- PWA Ready
- SEO Ready
- ✔️ Husky
- ✔️ Eslint
- ✔️ Prettier
- ✔️ VS Code formatter
- Exam 1 (UI/UX Component)
- Exam 2 (Page Layout, Routing, API)
- Bug finding (submitted via terraform)
Progressive Web App (PWA) ready for better experience.
PWA Tested on:
- Chrome (Desktop, Mac, Android)
- Firefox (Desktop)
- Safari (iOS)
- Kiwi Browser (Android)
*Note: Firefox needs a browser extension to enable PWA.
First, install the dependencies:
yarn install
Then, run the development server:
yarn dev
Then, open http://localhost:3000 with your browser to see the result.
Yes, I know we dont normally share environment in Readme, but this is an exam.
- If you don't see .env file in the project:
- create
.env
file in root folder. - Then, add this variable(s):
NEXT_PUBLIC_API_URL="https://avl-frontend-exam.herokuapp.com/api"
This Project is deployed to Vercel Platform
Live Link here
In the case your husky is not running when you commit a file, please run this command before your next commit
yarn husky install
Please follow these message format to your commit message:
-
A new feature
feat: your_commit_message
-
A bug fix
fix: your_commit_message
-
Documentation only changes
docs: your_commit_message
-
Changes that do not affect the meaning of the code
style: your_commit_message
-
A code change that neither fixes a bug nor adds a feature
refactor: your_commit_message
-
A code change that improves performance
perf: your_commit_message
-
Adding or modifying tests
test: your_commit_message
-
Changes to the build process or auxiliary tools and libraries such as documentation generation
chore: your_commit_message
-
Revert to a previous commit
revert: your_commit_message
Within the "components" directory, there are four subfolders:
-
ui
- This serves as the designated space for crafting fundamental UI components such as textfields, datepickers, etc.
-
layout
- This serves as the designated space for developing layout components like "Container" or any other layout components when necessary.
-
feature
- This serves as the designated space for creating custom components, typically employed when there is a need for a component with a specific purpose.
-
form
- This serves as the designated space for creating custom form components.
While reviewing the code, you'll observe that all components have a "Th" prefix. Why? Let's take a moment to reflect. How many times have we created a component with the same name as a component from a third-party library, leading to confusion? This is where the prefix becomes crucial. By assigning a prefix to our components, we ensure each one has a unique name, making it easier for other developers to discern and understand the code.
The same reason applied to the tailwind configuration in this repo.
Prefix naming convention:
-
"Th" in components
- This can be any name, I chose "Th" which stands for "Take Home Exam" abbreviation.
-
"tw-" in tailwind
- This can be any name, I chose "tw-" which stands for "Tailwind CSS" abbreviation.
-
Code is available in this repository.
-
A more detailed information in this repository:
- Exam 1: Component (Password Input, Calendar, Advanced Effect)
- datepicker variant.
- A more comprehensive integration of the Material-UI text field component.
- Exam 2: Page (Page Layout, Routing, API Connections, Advanced Effect)
- Skeleton Loading Screen
- Infinite Loading on Result Page and Friend List
- Added a small feature: Users in Result List is interactive. (Click to view their detail)
- Added a small feature: Follow/Following buttons in Friend list are interactive (but the data won't persist since there is no POST API to handle that).
- Exam 1: Component (Password Input, Calendar, Advanced Effect)
-
Editable Figma link here (For Exam 2: pixel perfect section)
-
Feel Free to contact me on LinkedIn if you have any inquiries.
-
Why using Next instead of React.js itself?
- Next.js is built on top of React.js, making it an extension of the React framework. The decision to use Next.js was primarily driven by its additional features and capabilities, such as server-side rendering and simplified routing, which significantly expedite the development process (this was my primary goal timewise).
-
Why not using axios / react-query for data fetching?
- In my opinion, it appeared excessive to employ those libraries for managing three simple GET APIs.
-
Why all images are the same? Are you using a local asset?
- Yes, as all of the images in the API response were not accessible, so I decided to substitute them with a local asset.
-
Why are you using next/link instead of history (router.push)?
- Indeed, both can be used, but since this is a simple project without any specific need to handle routing programmatically, I chose next/link because of its prefetching feature.