This project implements a simple "Story" feature, inspired by platforms like Instagram and WhatsApp. Users can upload short, temporary content (stories) that disappears after 24 hours. It provides a user-friendly interface to add, view, and manage stories directly from the browser.
- Upload Stories: Users can upload an image as a story by clicking the "+" button.
- Temporary Stories: Stories are automatically removed after 24 hours.
- Local Storage Management: Stories are saved in the browser's local storage and are dynamically retrieved when the app is reopened.
- Dynamic Story Viewer: View stories in a modal with a clean and interactive interface.
- Skeleton Loading: Displays a loading animation while stories are fetched.
- Dark Mode Support: Switch between light and dark themes for better user experience.
-
Clone the repository:
git clone https://github.com/HadiDevLabx/insta-story cd insta-story -
Install dependencies:
npm install # or yarn install -
Start the development server:
npm start # or yarn start -
Open the app in your browser:
http://localhost:3000
src/
├── components/ # UI components like StoryItem, StoryViewer, etc.
├── hooks/ # Custom React hooks (e.g., useImageUpload)
├── utils/ # Helper functions for stories (e.g., storyHelpers)
├── types/ # TypeScript type definitions (e.g., Story type)
├── App.tsx # Main app component
├── index.tsx # Entry point of the React app
- How it works:
- Users click the "Plus" button to upload an image.
- The image is converted to a Base64 string and stored in
localStoragewith a timestamp.
- Stories are displayed as a scrollable horizontal list.
- Clicking on a story opens it in a modal viewer.
- A cleanup mechanism runs every minute to remove expired stories from
localStorage.
- A toggle button allows users to switch between light and dark themes dynamically.
- React: Frontend library for building the UI.
- TypeScript: For static typing and better code maintainability.
- Tailwind CSS: Utility-first CSS framework for styling.
- LocalStorage: Browser storage for saving stories temporarily.