Skip to content

Commit

Permalink
Summary: In this conversation, we worked on designing and refining th…
Browse files Browse the repository at this point in the history
…e Navbar for your React app. We started from the basic code and made adjustments to ensure it is fixed at the top of the page with a user dropdown menu. We added visual effects like hover color changes and made the layout responsive to adapt to different screen sizes.

Description:

1- Fixed Logo: A fixed logo on the left side with hover effects.

2- Navigation Links: Links for different app pages with hover color transitions.

3- User Dropdown Menu: A clickable user icon revealing options like "Manage Account" and "Logout."

4- Responsive Design: Ensured that the Navbar adapts to smaller screen sizes for a smooth mobile experience.
  • Loading branch information
Bavly-Hamdy committed Dec 9, 2024
1 parent 83c4049 commit fa8f071
Show file tree
Hide file tree
Showing 6 changed files with 378 additions and 105 deletions.
41 changes: 41 additions & 0 deletions src/components/Chatbot/Navbar.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// Navbar.js
import React, { useState } from "react";
import { useNavigate } from "react-router-dom";
import styles from "./Navbar.module.css";

const Navbar = ({ user }) => {
const navigate = useNavigate();
const [showDropdown, setShowDropdown] = useState(false);

const toggleDropdown = () => {
setShowDropdown((prev) => !prev);
};

return (
<nav className={styles.navbar}>
<h1 className={styles.logo} onClick={() => navigate("/")}>
Logo
</h1>
<ul className={styles.nav_links}>
<li onClick={() => navigate("/chatbot")}>Chatbot</li>
<li onClick={() => navigate("/reminder")}>Reminder</li>
<li onClick={() => navigate("/plan")}>Plan & Bay Chart</li>
<li onClick={() => navigate("/about")}>About Us</li>
<li onClick={() => navigate("/contact")}>Contact Us</li>
</ul>
<div className={styles.user_menu} onClick={toggleDropdown}>
<div className={styles.user_icon}>
<i className={`fas fa-${user ? "user" : "female"} fa-1x`}></i>
</div>
{showDropdown && (
<div className={styles.dropdown_content}>
<a href="#">Manage Account</a>
<a onClick={() => alert("Logging out...")}>Logout</a>
</div>
)}
</div>
</nav>
);
};

export default Navbar;
93 changes: 93 additions & 0 deletions src/components/Chatbot/Navbar.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
/* Navbar.module.css */

.navbar {
display: flex;
justify-content: space-between;
align-items: center;
padding: 15px 30px;
background-color: #333;
color: white;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.logo {
font-size: 24px;
font-weight: bold;
cursor: pointer;
color: white;
text-transform: uppercase;
}

.nav_links {
display: flex;
list-style: none;
margin: 0;
padding: 0;
}

.nav_links li {
margin-left: 20px;
cursor: pointer;
font-size: 16px;
transition: color 0.3s;
}

.nav_links li:hover {
color: #4CAF50;
}

.user_menu {
position: relative;
cursor: pointer;
}

.user_icon {
font-size: 22px;
color: white;
}

.dropdown_content {
position: absolute;
top: 30px;
right: 0;
background-color: #fff;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
border-radius: 8px;
padding: 10px;
z-index: 10;
}

.dropdown_content a {
display: block;
padding: 8px 15px;
text-decoration: none;
color: #333;
font-size: 16px;
transition: background-color 0.3s;
}

.dropdown_content a:hover {
background-color: #f1f1f1;
}

.favourited {
color: #ff6347;
}

@media (max-width: 768px) {
.navbar {
flex-direction: column;
align-items: flex-start;
}

.nav_links {
flex-direction: column;
margin-top: 10px;
}

.nav_links li {
margin-left: 0;
margin-bottom: 10px;
}
}

201 changes: 173 additions & 28 deletions src/components/Chatbot/Save.module.css
Original file line number Diff line number Diff line change
@@ -1,11 +1,139 @@
/* Styles for Navbar */
.navbar_section {
position: fixed;
top: 0;
/* Page Container */
.pageContainer {
padding: 20px;
font-family: Arial, sans-serif;
}

/* Title */
.title {
text-align: center;
font-size: 28px;
margin-bottom: 20px;
color: #333;
}

/* Message Table */
.messageTable {
width: 100%;
z-index: 1000;
margin-top: 20px;
}

/* Table Header */
.tableHeader {
display: flex;
padding: 20px;
background-color: #f1f1f1;
border-radius: 8px;
justify-content: space-between;
margin-bottom: 10px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.columnHeader {
font-weight: bold;
width: 48%;
text-align: center;
color: #555;
}

/* Message Row */
.messageRow {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 10px;
padding: 15px;
background-color: #fff;
border-radius: 8px;
border: 1px solid #ddd;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
transition: transform 0.3s, box-shadow 0.3s;
}

.messageRow:hover {
transform: translateY(-5px);
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* Message Text */
.messageText {
width: 48%;
padding: 10px;
background-color: #f9f9f9;
border: 1px solid #ddd;
border-radius: 4px;
transition: background-color 0.3s;
}

.messageText:hover {
background-color: #eaeaea;
}

/* Action Icons */
.actionIcons {
width: 48%;
display: flex;
justify-content: center;
gap: 15px;
}

.deleteButton, .favouriteButton {
background: none;
border: none;
font-size: 22px;
cursor: pointer;
transition: color 0.3s, transform 0.3s;
}

.deleteButton:hover, .favouriteButton:hover {
color: #ff4d4d;
transform: scale(1.2);
}

.favourited {
color: #ff6347;
}

/* Buttons Container */
.buttonsContainer {
display: flex;
justify-content: space-between;
margin-top: 30px;
}

.backButton, .clearButton {
padding: 12px 25px;
background-color: #4CAF50;
color: white;
border-radius: 8px;
border: none;
cursor: pointer;
font-size: 16px;
transition: background-color 0.3s, transform 0.3s;
}

.backButton:hover, .clearButton:hover {
background-color: #45a049;
transform: scale(1.05);
}

.clearButton {
background-color: #f44336;
}

.clearButton:hover {
background-color: #e53935;
}

/* No Messages */
.noMessages {
text-align: center;
color: #777;
font-size: 18px;
font-style: italic;
}

/* Navbar Styles */
.navbar {
height: 70px;
background-color: #52a7bc;
Expand All @@ -15,6 +143,10 @@
padding: 0 20px;
margin: 0;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
position: fixed;
top: 0;
width: 100%;
z-index: 1000;
}

.logo {
Expand All @@ -23,12 +155,14 @@
cursor: pointer;
}

/* Navbar Links Section */
.nav_links {
list-style-type: none;
display: flex;
gap: 20px;
}

/* Each Navbar Item */
.nav_links li {
color: white;
padding: 10px;
Expand All @@ -41,40 +175,51 @@
color: #cfcfcf;
}

/* Styles for Saved Messages */
.title {
text-align: center;
margin: 20px 0;
/* User Menu Section */
.user_menu {
display: flex;
align-items: center;
position: relative;
cursor: pointer;
margin-left: 20px;
}

.messageTable {
/* User Icon Style (دائرة تمثل نوع المستخدم) */
.user_icon {
width: 40px;
height: 40px;
border-radius: 50%;
background-color: #f1f1f1;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
color: white;
font-size: 1.2rem;
cursor: pointer;
margin-left: 20px;
}

.messageRow {
.dropdown_content {
display: flex;
justify-content: space-between;
width: 80%;
padding: 10px;
border-bottom: 1px solid #ddd;
flex-direction: column;
position: absolute;
top: 50px;
right: 0;
background-color: white;
min-width: 160px;
box-shadow: 0px 8px 16px rgba(0, 0, 0, 0.2);
z-index: 1;
border-radius: 5px;
}

.iconContainer {
display: flex;
gap: 10px;
.dropdown_content a {
padding: 10px;
text-decoration: none;
color: black;
border-radius: 5px;
}

.backButton, .clearButton {
margin: 10px;
padding: 10px 20px;
border: none;
.dropdown_content a:hover {
background-color: #52a7bc;
color: white;
cursor: pointer;
}

.clearButton {
background-color: #ff4d4d; /* Red color for clear button */
}
Loading

0 comments on commit fa8f071

Please sign in to comment.