This application fetch data about authors and the books they have written from My JSON Server API and then displays an interactive table with a list of authors. Each author's row in the table can be clicked to display the details of that author.
Link to the application preview: https://recruitment-task-kongsberg.jacobprogrammer.dev
yarn
ornpm install
yarn start
ornpm run start
- The application can be viewed at
http://localhost:3000
- classnames - Used for joining classNames together
- framer-motion - Used for cool animations
- normalize.css - Used for CSS normalization
- react-router-dom - Used for routing
All application files are placed in the src
directory
- src/api - Contains the hooks that allow fetching data from the API. All hooks use
useAPIQuery
hook.useAuthors
- this hook fetches all authors from the APIuseAuthorBooks
- this hook fetches all books of the specific author from the API
- src/hooks - Contains the global hooks
useAPIQuery
- This hook allows making fetch requests to the specific API target
- src/components - Contains the global components
Book
- Renders bookBreadcrumb
- Renders breadcrumb navigationButton
- Renders a button. HTML element can be modified usingas
property. (e.g. as="a")Footer
- Renders the footerLoadingIcon
- Renders an SVG with loading animationLogo
- Renders the application logoTable
- Renders a table
- src/routes/routes.ts - Contains the routes of the application
- src/theme - Contains the global styles
- src/utils - Contains global utilities
camelCaseToNormalText
- Converts camel case text to normal text (e.g., "helloWorld" to "Hello world")getAuthorName
- Returns the name of a specific author from the authors query arraymapQueryAuthorsToTableItems
- Transforms the authors query array into table-like data
- src/views - Here are all views/routes of the application
Root
- The main application component that specifies all global components and routesHome
- The "/" routeNotFound
- The component for 404 errorsListOfAuthors
- The component for "/list-of-authors" and "/list-of-authors/:authorId" routes. It displays a table with authors and rendersAuthorBooks
whenauthorId
is specified in the URLAuthorBooks
- The component for "/list-of-authors/:authorId" route. It displays all books of the author.