A modern, responsive React application that replicates the core functionality of Deliveroo's restaurant ordering interface. This project demonstrates advanced React concepts, state management, authentication, and modern UI/UX patterns.
- Features
- Technology Stack
- Key Implementations
- Project Structure
- Installation
- Usage
- API Reference
- Contributing
- License
- Interactive Menu Navigation: Dynamic menu categories with smooth scrolling
- IntersectionObserver Integration: Automatic menu category highlighting based on scroll position
- Product Detail Modals: Responsive dialogs with comprehensive product information
- Shopping Cart Simulation: Visual basket component (UI ready for cart functionality)
- Firebase Authentication: Google OAuth integration
- Multi-provider Login: Facebook, Google, Apple, and email options
- Protected Routes: Private route implementation with Redux state management
- User Session Management: Persistent login state across app sessions
- Material-UI Components: Professional UI component library
- Responsive Design: Mobile-first approach with breakpoint optimization
- Bootstrap Integration: Enhanced styling and layout system
- Custom CSS Animations: Smooth transitions and hover effects
- Progressive Web App Ready: Optimized for mobile devices
- Touch-friendly Interface: Large tap targets and gesture support
- Responsive Navigation: Collapsible sidebar and mobile-optimized layouts
- React 18.2.0: Modern React with hooks and functional components
- React Router DOM 6.21.2: Client-side routing and navigation
- Redux Toolkit 2.1.0: State management with modern Redux patterns
- Firebase 10.7.1: Authentication and backend services
- Material-UI 5.15.5: Component library with theming
- React Bootstrap 2.9.2: Bootstrap components for React
- CSS3: Custom styling with flexbox and grid layouts
- React Scripts 5.0.1: Create React App build tools
- Jest & React Testing Library: Unit and integration testing
- ESLint: Code quality and consistency
The application uses the IntersectionObserver API for advanced scroll-based interactions:
// MenuListCategory.jsx - Smart category highlighting
const intersectionCallback = ([entry], observer) => {
handleScroll(entry.isIntersecting, entry.target.getAttribute("data-name"));
};
useEffect(() => {
const observer = new IntersectionObserver(intersectionCallback, {
rootMargin: "-180px 0px -30% 0px",
});
if (ref != null && !isScrolling) observer.observe(ref.current);
return () => {
observer.disconnect();
};
}, [isScrolling]);Key Features:
- Automatic Category Detection: Highlights active menu category based on viewport
- Smart Scroll Management: Prevents conflicts during programmatic scrolling
- Performance Optimization: Efficient cleanup and observer management
- Custom Root Margins: Fine-tuned visibility detection zones
Dynamic category switching with smooth scrolling:
// MenuList.jsx - Intelligent scrolling system
const scrollTo = (e) => {
setIsScrolling(true);
const target = e.target;
let matchedRef = dataRefs.find(
(ref) => ref.current?.getAttribute("data-name") === target.innerText
);
if (matchedRef && matchedRef.current) {
setCurrentCategory(matchedRef.current.getAttribute("data-name") || "");
matchedRef.current.scrollIntoView({ behavior: "smooth", block: "start" });
window.addEventListener(
"scrollend",
() => {
setIsScrolling((prevState) => !prevState);
},
{ once: true }
);
}
};Modern Redux implementation with Redux Toolkit:
// userSlice.js - User authentication state
export const userSlice = createSlice({
name: "user",
initialState: {
user: null,
},
reducers: {
login: (state, action) => {
state.user = action.payload;
},
logout: (state) => {
state.user = null;
},
},
});Secure routing with authentication guards:
// PrivateRoutes.js - Route protection
const PrivateRoutes = () => {
const user = useSelector(selectUser);
let auth = { token: user };
return auth.token ? <Outlet /> : <Navigate to="/" />;
};Mobile-first modal implementation:
// ResponsiveDialog.jsx - Adaptive modal system
export default function ResponsiveDialog(props) {
const theme = useTheme();
const fullScreen = useMediaQuery(theme.breakpoints.down("md"));
return (
<Dialog fullScreen={fullScreen} open={open} onClose={handleClose}>
{content}
</Dialog>
);
}src/
βββ Components/
β βββ Footer/ # App footer with links and social media
β βββ MenuList/ # Main menu display system
β β βββ MenuListCategory/ # Individual category components
β β βββ MenuListItem/ # Menu item cards
β βββ Navigation/ # Header navigation and authentication
β βββ ProductDetails/ # Product detail modal content
β βββ ResponsiveDialog/ # Reusable modal component
β βββ Restaurant/ # Restaurant information banner
β βββ SideBar/ # Mobile sidebar navigation
βββ Pages/
β βββ Home.jsx # Main restaurant page
β βββ InitialLogin.jsx # Landing page with auth options
β βββ Login.jsx # Email login form
β βββ SignUp.jsx # User registration form
βββ Redux/
β βββ store.js # Redux store configuration
β βββ userSlice.js # User authentication slice
βββ Assets/ # Images, icons, and static files
βββ utils/
β βββ PrivateRoutes.js # Protected route component
βββ data.js # Mock menu data
βββ firebase.js # Firebase configuration
βββ App.js # Main app component and routing
- Node.js (v14 or higher)
- npm or yarn package manager
- Firebase account (for authentication)
-
Clone the repository
git clone https://github.com/yourusername/deliveroo-clone.git cd deliveroo-clone -
Install dependencies
npm install
-
Firebase Configuration
- Create a new Firebase project at Firebase Console
- Enable Authentication and configure providers (Google, Facebook, etc.)
- Update
src/firebase.jswith your Firebase config:
const firebaseConfig = { apiKey: "your-api-key", authDomain: "your-auth-domain", projectId: "your-project-id", storageBucket: "your-storage-bucket", messagingSenderId: "your-messaging-sender-id", appId: "your-app-id", };
-
Start the development server
npm start
-
Open your browser Navigate to
http://localhost:3000
- Email: user@gmail.com
- Password: 1234
- Landing Page: Choose from multiple authentication providers
- Email Login: Enter credentials (demo credentials above)
- Registration: Create new account with email verification
- Dashboard Access: Automatic redirect to restaurant menu
- Category Selection: Click category chips to jump to sections
- Scroll Navigation: Automatic category highlighting while scrolling
- Product Details: Click any menu item to view detailed information
- Basket Integration: UI ready for cart functionality implementation
- Smooth Scrolling: Categories auto-scroll into view
- Responsive Modals: Product details adapt to screen size
- Touch Gestures: Mobile-optimized touch interactions
- State Persistence: Login state maintained across sessions
- Google OAuth: Configured through Firebase
- Email/Password: Firebase Authentication API
- Session Management: Redux state with localStorage persistence
{
id: number,
categoryTitle: string,
items: [
{
itemID: number,
title: string,
description: string,
price: string,
imageURL: string
}
]
}- Smart Category Tracking: Automatically highlights visible menu sections
- Performance Optimized: Efficient DOM observation with cleanup
- Scroll Conflict Prevention: Manages programmatic vs. user scrolling
- Custom Thresholds: Fine-tuned visibility detection
- Redux Toolkit: Modern Redux with simplified syntax
- Selector Pattern: Efficient state subscription
- Immutable Updates: Safe state modifications
- Middleware Integration: Development tools and debugging
- Breakpoint System: Material-UI responsive breakpoints
- Touch Optimization: Large tap targets and gesture support
- Progressive Enhancement: Core functionality works on all devices
- Performance: Optimized bundle size and loading
npm start: Development server with hot reloadnpm build: Production build optimizationnpm test: Run test suitenpm eject: Eject from Create React App (irreversible)
- ESLint: Configured for React best practices
- Component Testing: Jest and React Testing Library
- Type Safety: PropTypes validation where applicable
- Fork the repository
- Create a feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
- Follow React best practices and hooks patterns
- Maintain responsive design principles
- Write comprehensive tests for new features
- Update documentation for significant changes
This project is licensed under the MIT License - see the LICENSE.md file for details.