Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ansurm/react-card-grid
Coding challenge solution for a Frontend Developer role, demonstrating various skills related to Frontend Development.
https://github.com/ansurm/react-card-grid
aws cicd css react s3 typescript
Last synced: 17 days ago
JSON representation
Coding challenge solution for a Frontend Developer role, demonstrating various skills related to Frontend Development.
- Host: GitHub
- URL: https://github.com/ansurm/react-card-grid
- Owner: AnsurM
- License: mit
- Created: 2024-10-07T19:29:51.000Z (3 months ago)
- Default Branch: main
- Last Pushed: 2024-10-18T02:07:20.000Z (2 months ago)
- Last Synced: 2024-10-23T11:51:24.596Z (2 months ago)
- Topics: aws, cicd, css, react, s3, typescript
- Language: TypeScript
- Homepage: https://dj4xvloye0w0y.cloudfront.net/
- Size: 11.7 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ๐ด React Card Grid Application
## Table of Contents
- [๐ Overview](#-overview)
- [๐ Preview](#-preview)
- [โจ Features](#-features)
- [๐ ๏ธ Technologies Used](#%EF%B8%8F-technologies-used)
- [๐๏ธ Project Structure](#%EF%B8%8F-project-structure)
- [๐ Getting Started](#-getting-started)
- [๐ Prerequisites](#-prerequisites)
- [โ๏ธ Installation](#%EF%B8%8F-installation)
- [๐ฅ๏ธ Usage](#%EF%B8%8F-usage)
- [๐ข Deployment](#-deployment)
- [๐งช Testing](#-testing)
- [โฟ Accessibility](#-accessibility)
- [๐ Next Steps](#-next-steps)
- [๐ License](#-license)## ๐ Overview
This React application displays a responsive grid of GIFs fetched from the Giphy API. It features a dynamic layout that adjusts based on screen size, modal functionality for detailed views, and adheres to accessibility best practices.
## ๐ Preview
## โจ Features
- ๐ฑ Responsive grid layout of GIFs with dynamic rendering:
- Number of cards adjusts based on screen size
- Utilizes a resize event listener for real-time adaptation
- Renders 20 cards for smaller screens and 50 for larger screens (width >= 1920px)
- ๐ Modal view for detailed GIF display
- โฟ Accessibility features including:
- Keyboard navigation using Tab and Arrow keys for efficient browsing
- Screen reader compatibility for improved accessibility
- Visual focus indicators on GridCards to highlight the selected card during keyboard navigation and mouse hovers
- โณ Loading indicators during API fetches:
- SkeletonLoaders displayed in GridCards during initial API call and subsequent fetches
- SkeletonLoader shown in Modal while GIF details are being loaded
- Provides visual feedback to users, enhancing perceived performance and user experience## ๐ ๏ธ Technologies Used
- โ๏ธ React (with Hooks)
- ๐ TypeScript
- โก Vite
- ๐ styled-components
- ๐ CSS Grid
- ๐ผ๏ธ Giphy API
- ๐งช Jest and React Testing Library## ๐๏ธ Project Structure
The project follows a well-organized structure to enhance maintainability and scalability. Here's an overview of the main directories and files:
```
src/
โโโ assets/
โ โโโ icons/
โโโ components/
โ โโโ Card/
โ โโโ ErrorIndicator/
โ โโโ GifGrid/
โ โโโ Loaders/
โ โโโ Modal/
โ โโโ NoResults/
โ โโโ Pagination/
โโโ utils/
โ โโโ api/
โ โโโ constants.ts
โ โโโ types.ts
โโโ App.tsx
โโโ app.styles.ts
โโโ index.css
โโโ main.tsx
โโโ vite-env.d.ts
```- ๐ `assets/`: Contains static assets like icons used in the application.
- ๐ `components/`: Houses all React components used in the app, each in its own directory with associated styles.
- ๐ด `Card/`: Renders individual GIF cards.
- โ `ErrorIndicator/`: Displays error messages
- ๐ผ๏ธ `GifGrid/`: Manages the grid layout of GIF cards.
- โณ `Loaders/`: Contains loading indicators and skeleton loaders.
- ๐ `Modal/`: Handles the detailed view of a selected GIF.
- ๐ซ `NoResults/`: Shows a message when no results are found.
- ๐ `Pagination/`: Manages pagination controls.
- ๐ ๏ธ `utils/`: Contains utility functions and API-related code.
- ๐ `api/`: Handles API calls to the Giphy service.
- ๐ `constants.ts`: Contains constants used throughout the application.
- ๐ `types.ts`: Contains TypeScript types used throughout the application.
- ๐ `App.tsx`: The main application component.
- ๐ `app.styles.ts`: Styled components for the main App component.
- ๐จ `index.css`: Global CSS styles.
- ๐ `main.tsx`: Entry point of the application.
- ๐ `vite-env.d.ts`: TypeScript declarations for Vite.This structure promotes a modular approach, making it easier to maintain and extend the application. Each component is self-contained with its own styles and logic, following best practices for React development.
## ๐ Getting Started
### ๐ Prerequisites
- ๐ฆ Node.js (version 12 or later)
- ๐ฆ npm or yarn### โ๏ธ Installation
1. Clone the repository:
```
git clone https://github.com/your-username/react-card-grid-app.git
```2. Navigate to the project directory:
```
cd react-card-grid-app
```3. Install dependencies:
```
npm install
```or
```
yarn install
```4. Copy the `.env.example` file to create a `.env` file in the root directory and add your Giphy API key:
```
VITE_GIPHY_API_KEY=your_api_key_here
VITE_GIPHY_API_URL=https://api.giphy.com/v1/gifs
```## ๐ฅ๏ธ Usage
To start the development server:
```
npm start
```or
```
yarn start
```The application will be available at `http://localhost:5173`.
## ๐ข Deployment
This project is deployed on Amazon S3 and CloudFront through a CI/CD pipeline using GitHub Actions. The deployment process is automated and triggered on every push to the main branch. Here's an overview of the deployment steps:
1. The GitHub Actions workflow is defined in the `.github/workflows/deploy.yml` file.
2. When code is pushed to the main branch, the workflow is triggered.
3. The workflow runs on an Ubuntu latest environment.
4. It checks out the code, installs dependencies, and builds the project using npm.
5. During the build process, environment variables (including API keys) are securely injected from GitHub Secrets.
6. After a successful build, the AWS CLI is set up using a GitHub Action.
7. The built files are then synced to an Amazon S3 bucket using the `aws s3 sync` command.
8. Finally, a CloudFront invalidation is created to ensure the latest version of the site is served to users.The entire process ensures that the latest version of the application is always available on the production environment.
๐ Checkout the live site here: https://dj4xvloye0w0y.cloudfront.net/
## ๐งช Testing
In Progress โณ
Visit [Test Coverage PR](https://github.com/AnsurM/react-card-grid-challenge/pull/21) to check current progress.
## โฟ Accessibility
The application is designed with accessibility in mind, following WAI-ARIA 1.3 patterns. Key features include:
- โจ๏ธ Keyboard navigation for all interactive elements using Tab and Arrow keys
- ๐ Proper focus management
- ๐ Screen reader compatibility for all components
- ๐๏ธ Semantic HTML structure for all components## ๐ Next Steps
As we continue to improve and expand this application, here are some key areas we're focusing on:
### ๐ง Refactoring
- Move functions such as resize, keypress, and clickOutside listeners to reusable hooks to reduce code duplication and improve maintainability.
### ๐งช Testing
- Implement extensive unit, end-to-end, and integration tests as the app grows, ensuring robust functionality and easier maintenance.
- Visit [Test Coverage PR](https://github.com/AnsurM/react-card-grid-challenge/pull/21) to check current progress.### ๐ฌ Enhancements
- Integrate feature flags for easier deployment and A/B testing.
- Implement observability tools like Sentry and SonarCloud for better monitoring and code quality analysis.### ๐ผ๏ธ Performance Optimization
- Research and implement image caching strategies to improve load times and reduce bandwidth usage.
### ๐ Continuous Integration
- Set up GitHub Actions to perform automated tests in the cloud and generate reports for test coverage.
### ๐ก๏ธ Error Handling
- Implement an Error Boundary to gracefully handle errors and prevent the entire application from crashing.
These next steps will help us improve the application's performance, maintainability, and overall user experience.
## ๐ License
This project is licensed under the MIT License.