*make sure that you have the node instaled
-
Install Yarn:
npm install --global yarn
-
Install Project Dependencies: inside the project folder run:
yarn install
-
Run the Project:
yarn run dev
For demonstration purposes, a unit test has been implemented to test the search filter functionality.
To run the tests, execute the following command:
yarn jest
The project structure is organized as follows:
- Pages: Contained within the
pages
folder, with local components residing in the same folder. - Global Components: Stored in the
components
folder. - Utilities: Available in the
utils
folder, which contains various tools.
The search feature operates via the URL:
- Upon performing a search, you are redirected to the results page.
- The code on results page collects parameters from the URL and filters the API data accordingly.
- Data retrieval from the table is handled by a function in the
readCSV
file. - Filtering is performed using a function from
filterTools
. - If valid data is found, it is stored in the state and rendered using the
itemResult
component.
Given more time, the following enhancements could be made:
-
Improved Documentation:
- Define types, function and component inputs, and returns more clearly.
-
Scalability Planning:
- Develop the code with the appropriate level of abstraction, ensuring it is neither too abstract nor overly rigid, facilitating easier maintenance.
- Consider using TypeScript to maintain code quality as the project grows.
-
Additional Features:
- Implement a "recent history" feature using the browser's local storage.
- Improve responsiveness for less common devices, such as smartwatches.
Thank you very much in advance!
@Vanilson Silva