feat(frontend): Scholarchat-inspired UI refactor with top nav, sidebar, and message actions

- Add TopNav component with AI Chat, Study Guides, Progress tabs
- Refactor sidebar to include brand, new chat, subjects, chat history, settings
- Add message action buttons (Helpful, Note, Deeper) on assistant responses
- Enhance ChatInput with photo, mic attachment icons and AI disclaimer
- Improve welcome state with 2x2 suggested prompt grid
- Update global layout for proper sidebar offset (fix nav overlap)
- Remove obsolete Header component
- All styles: strict BEM naming, zero inline CSS, Paper Look theme
This commit is contained in:
2026-08-14 08:07:42 -04:00
commit c9085bdefb
35 changed files with 4907 additions and 0 deletions
+71
View File
@@ -0,0 +1,71 @@
/* ========================================
App Component — padhLe
======================================== */
import { useState } from "react";
import "./styles/App.css";
import Sidebar from "./components/sidebar/Sidebar";
import TopNav from "./components/top-nav/TopNav";
import ChatHistory from "./components/chat-history/ChatHistory";
import ChatInput from "./components/chat-input/ChatInput";
function App() {
const [messages, setMessages] = useState([]);
const [activeSubject, setActiveSubject] = useState("science");
const [activeChat, setActiveChat] = useState(null);
const [activeTab, setActiveTab] = useState("chat");
const handleSend = (text) => {
if (!text.trim()) return;
// Add user message
setMessages((prev) => [...prev, { id: Date.now(), role: "user", text }]);
// TODO: Send to backend and get AI response
// Simulating AI response for now
setTimeout(() => {
setMessages((prev) => [
...prev,
{
id: Date.now() + 1,
role: "assistant",
text: "This is a simulated response. Connect the backend to get real AI answers!",
},
]);
}, 1000);
};
const handlePromptClick = (promptText) => {
handleSend(promptText);
};
return (
<div className="page">
{/* Left Sidebar — brand, subjects, chat history, settings */}
<Sidebar
activeSubject={activeSubject}
onSubjectChange={setActiveSubject}
activeChat={activeChat}
onChatSelect={setActiveChat}
/>
<div className="page__main">
{/* Top Navigation — tabs + actions */}
<TopNav activeTab={activeTab} onTabChange={setActiveTab} />
{/* Chat Area */}
<div className="main-content">
<ChatHistory
messages={messages}
onPromptClick={handlePromptClick}
/>
</div>
{/* Input Bar */}
<ChatInput onSend={handleSend} />
</div>
</div>
);
}
export default App;
@@ -0,0 +1,85 @@
/* ========================================
ChatHistory Component — padhLe
======================================== */
.chat-history {
flex: 1;
padding: var(--spacing-xl) 0;
overflow-y: auto;
}
.chat-history__list {
display: flex;
flex-direction: column;
gap: var(--spacing-xl);
padding-bottom: var(--spacing-xl);
}
/* Empty / Welcome State */
.chat-history__empty {
display: flex;
justify-content: center;
align-items: center;
min-height: 50vh;
text-align: center;
padding: var(--spacing-2xl);
}
.chat-history__empty-content {
max-width: 600px;
}
.chat-history__empty-title {
font-family: var(--font-heading);
font-size: 3rem;
font-weight: 700;
color: var(--color-text);
margin-bottom: var(--spacing-xs);
}
.chat-history__empty-tagline {
font-family: var(--font-body);
font-size: 1.05rem;
font-weight: 300;
color: var(--color-text-muted);
margin-bottom: var(--spacing-2xl);
}
/* Suggested Prompts */
.chat-history__prompts {
display: grid;
grid-template-columns: 1fr 1fr;
gap: var(--spacing-sm);
}
.chat-history__prompt {
display: flex;
align-items: center;
gap: var(--spacing-sm);
padding: var(--spacing-md);
border: var(--border-thin);
border-radius: var(--border-radius);
background-color: var(--color-bg);
cursor: pointer;
text-align: left;
font-family: var(--font-body);
font-size: 0.9rem;
font-weight: 300;
color: var(--color-text);
line-height: 1.5;
transition: all var(--transition-fast);
}
.chat-history__prompt:hover {
background-color: var(--color-hover);
border-color: var(--color-text-muted);
}
.chat-history__prompt-icon {
font-size: 1.25rem;
flex-shrink: 0;
}
.chat-history__prompt-text {
color: var(--color-text);
}
@@ -0,0 +1,55 @@
/* ========================================
ChatHistory Component — padhLe
======================================== */
import Message from "../message/Message";
import "./ChatHistory.css";
const ChatHistory = ({ messages, onPromptClick }) => {
const suggestedPrompts = [
{ icon: "🧪", text: "Explain how photosynthesis works in simple terms" },
{ icon: "📐", text: "Help me understand derivatives in calculus" },
{ icon: "🏛️", text: "What caused the Industrial Revolution?" },
{ icon: "📝", text: "Help me analyze themes in Romeo and Juliet" },
];
const hasMessages = messages.length > 0;
return (
<div className="chat-history">
{hasMessages ? (
<div className="chat-history__list">
{messages.map((message) => (
<Message key={message.id} message={message} />
))}
</div>
) : (
<div className="chat-history__empty">
<div className="chat-history__empty-content">
<h2 className="chat-history__empty-title">
Welcome to padhLe
</h2>
<p className="chat-history__empty-tagline">
Your AI tutor for grades 612. Ask anything!
</p>
<div className="chat-history__prompts">
{suggestedPrompts.map((prompt, index) => (
<button
key={index}
className="chat-history__prompt"
onClick={() => onPromptClick(prompt.text)}
>
<span className="chat-history__prompt-icon">{prompt.icon}</span>
<span className="chat-history__prompt-text">{prompt.text}</span>
</button>
))}
</div>
</div>
</div>
)}
</div>
);
};
export default ChatHistory;
@@ -0,0 +1,117 @@
/* ========================================
ChatInput Component — padhLe
======================================== */
.chat-input {
padding: var(--spacing-md) 0 var(--spacing-xl) 0;
border-top: var(--border-thin);
background-color: var(--color-bg);
}
.chat-input__wrapper {
max-width: 760px;
margin: 0 auto;
}
/* Form */
.chat-input__form {
display: flex;
align-items: flex-end;
gap: var(--spacing-sm);
border: var(--border-thin);
border-radius: var(--border-radius);
padding: var(--spacing-sm) var(--spacing-md);
transition: border-color var(--transition-fast);
}
.chat-input__form:focus-within {
border-color: var(--color-accent);
box-shadow: 0 0 0 2px rgba(26, 26, 26, 0.08);
}
/* Attachments */
.chat-input__attachments {
display: flex;
align-items: center;
gap: 2px;
padding-bottom: var(--spacing-xs);
}
.chat-input__attach-btn {
display: flex;
align-items: center;
justify-content: center;
width: 32px;
height: 32px;
border: none;
background: transparent;
border-radius: var(--border-radius);
cursor: pointer;
color: var(--color-text-muted);
opacity: 0.5;
transition: all var(--transition-fast);
}
.chat-input__attach-btn:hover {
background-color: var(--color-hover);
opacity: 1;
}
/* Textarea Field */
.chat-input__field {
flex: 1;
font-family: var(--font-body);
font-size: 1rem;
font-weight: 300;
line-height: 1.6;
color: var(--color-text);
background-color: transparent;
border: none;
padding: var(--spacing-xs) 0;
resize: none;
outline: none;
min-height: 24px;
max-height: 200px;
}
.chat-input__field::placeholder {
color: var(--color-text-muted);
opacity: 0.5;
}
/* Submit Button */
.chat-input__submit {
display: flex;
align-items: center;
justify-content: center;
width: 36px;
height: 36px;
border: none;
background: transparent;
border-radius: var(--border-radius);
cursor: not-allowed;
opacity: 0.3;
transition: all var(--transition-fast);
flex-shrink: 0;
}
.chat-input__submit--active {
background-color: var(--color-accent);
color: var(--color-bg);
cursor: pointer;
opacity: 1;
}
.chat-input__submit--active:hover {
background-color: var(--color-text-muted);
transform: translateY(-1px);
}
/* Disclaimer */
.chat-input__disclaimer {
font-size: 0.75rem;
color: var(--color-text-muted);
text-align: center;
margin-top: var(--spacing-sm);
opacity: 0.7;
}
@@ -0,0 +1,117 @@
/* ========================================
ChatInput Component — padhLe
======================================== */
import { useState, useRef, useEffect } from "react";
import "./ChatInput.css";
const ChatInput = ({ onSend }) => {
const [text, setText] = useState("");
const textareaRef = useRef(null);
// Auto-expand textarea as content grows
useEffect(() => {
if (textareaRef.current) {
textareaRef.current.style.height = "auto";
textareaRef.current.style.height = `${textareaRef.current.scrollHeight}px`;
}
}, [text]);
const handleSubmit = (e) => {
e.preventDefault();
if (text.trim()) {
onSend(text.trim());
setText("");
if (textareaRef.current) {
textareaRef.current.style.height = "auto";
}
}
};
const handleKeyDown = (e) => {
// Submit on Enter (not Shift+Enter)
if (e.key === "Enter" && !e.shiftKey) {
e.preventDefault();
handleSubmit(e);
}
};
return (
<div className="chat-input">
<div className="chat-input__wrapper">
<form className="chat-input__form" onSubmit={handleSubmit}>
{/* Attachment buttons */}
<div className="chat-input__attachments">
<button
type="button"
className="chat-input__attach-btn"
aria-label="Add photo"
title="Add photo"
>
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
<rect x="3" y="3" width="18" height="18" rx="2" ry="2" />
<circle cx="8.5" cy="8.5" r="1.5" />
<path d="M21 15l-5-5L5 21" />
</svg>
</button>
<button
type="button"
className="chat-input__attach-btn"
aria-label="Voice input"
title="Voice input"
>
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
<path d="M12 1a3 3 0 0 0-3 3v8a3 3 0 0 0 6 0V4a3 3 0 0 0-3-3z" />
<path d="M19 10v2a7 7 0 0 1-14 0v-2" />
<line x1="12" y1="19" x2="12" y2="23" />
<line x1="8" y1="23" x2="16" y2="23" />
</svg>
</button>
</div>
{/* Textarea */}
<textarea
ref={textareaRef}
className="chat-input__field"
placeholder="Ask anything about your subject..."
value={text}
onChange={(e) => setText(e.target.value)}
onKeyDown={handleKeyDown}
rows={1}
/>
{/* Submit button */}
<button
className={`chat-input__submit ${
text.trim() ? "chat-input__submit--active" : ""
}`}
type="submit"
disabled={!text.trim()}
aria-label="Send message"
>
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
strokeWidth="2"
strokeLinecap="round"
strokeLinejoin="round"
width="18"
height="18"
>
<path d="M22 2L15 22l-3-10-10 3z" />
</svg>
</button>
</form>
{/* AI Disclaimer */}
<p className="chat-input__disclaimer">
padhLe AI can make mistakes. Consider verifying important information.
</p>
</div>
</div>
);
};
export default ChatInput;
+102
View File
@@ -0,0 +1,102 @@
/* ========================================
Message Component — padhLe
======================================== */
/* Base Message */
.message {
display: flex;
flex-direction: column;
animation: messageFadeIn 0.3s ease;
}
@keyframes messageFadeIn {
from {
opacity: 0;
transform: translateY(10px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
/* Alignment */
.message--user {
align-items: flex-end;
}
.message--assistant {
align-items: flex-start;
}
/* Bubble */
.message__bubble {
max-width: 80%;
padding: var(--spacing-lg);
border-radius: var(--border-radius);
line-height: 1.6;
}
.message--assistant .message__bubble {
background-color: var(--color-bg);
border: var(--border-thin);
}
.message--user .message__bubble {
background-color: var(--color-accent);
color: var(--color-bg);
border: var(--border-thin);
}
/* Text */
.message__text {
font-size: 1rem;
line-height: 1.6;
white-space: pre-wrap;
}
.message--assistant .message__text {
color: var(--color-text);
}
.message--user .message__text {
color: var(--color-bg);
}
/* Action Buttons */
.message__actions {
display: flex;
align-items: center;
gap: var(--spacing-xs);
margin-top: var(--spacing-sm);
padding-left: var(--spacing-xs);
}
.message__action {
display: flex;
align-items: center;
gap: 4px;
padding: 4px var(--spacing-sm);
border: none;
background: transparent;
border-radius: var(--border-radius);
cursor: pointer;
font-family: var(--font-body);
font-size: 0.75rem;
font-weight: 400;
color: var(--color-text-muted);
transition: all var(--transition-fast);
}
.message__action:hover {
background-color: var(--color-hover);
color: var(--color-text);
}
.message__action svg {
opacity: 0.6;
}
.message__action:hover svg {
opacity: 1;
}
@@ -0,0 +1,45 @@
/* ========================================
Message Component — padhLe
======================================== */
import "./Message.css";
const Message = ({ message }) => {
const { role, text } = message;
const isUser = role === "user";
return (
<div className={`message ${isUser ? "message--user" : "message--assistant"}`}>
<div className="message__bubble">
<div className="message__text">{text}</div>
</div>
{/* Action buttons only for assistant messages */}
{!isUser && (
<div className="message__actions">
<button className="message__action" aria-label="Helpful" title="Helpful">
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
<path d="M7 22h4c1.1 0 2-.9 2-2v-4c0-.57-.24-1.09-.62-1.47L13 11.76c.38-.38.62-.9.62-1.47V7c0-1.1-.9-2-2-2H7c-1.1 0-2 .9-2 2v12c0 3.31 2.69 6 6 6h8v-2h-2.11c-.18-.5-.29-1.04-.29-1.6V22z" />
</svg>
<span>Helpful</span>
</button>
<button className="message__action" aria-label="Save note" title="Save Note">
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
<path d="M19 21l-7-5-7 5V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z" />
</svg>
<span>Note</span>
</button>
<button className="message__action" aria-label="Explain deeper" title="Explain Deeper">
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
<path d="M12 2a10 10 0 1 0 10 10H12V2z" />
<path d="M12 2a10 10 0 0 1 10 10" />
</svg>
<span>Deeper</span>
</button>
</div>
)}
</div>
);
};
export default Message;
+220
View File
@@ -0,0 +1,220 @@
/* ========================================
Sidebar Component — padhLe
======================================== */
/* Main Sidebar */
.sidebar {
position: fixed;
top: 0;
left: 0;
width: var(--sidebar-width);
height: 100vh;
background-color: var(--color-bg);
border-right: var(--border-thin);
display: flex;
flex-direction: column;
padding: var(--spacing-lg);
overflow-y: auto;
z-index: 10;
}
/* Scrollbar styling */
.sidebar::-webkit-scrollbar {
width: 4px;
}
.sidebar::-webkit-scrollbar-thumb {
background-color: var(--color-line);
border-radius: 2px;
}
/* Brand */
.sidebar__brand {
padding-bottom: var(--spacing-md);
margin-bottom: var(--spacing-md);
}
.sidebar__title {
font-family: var(--font-heading);
font-size: 2.25rem;
font-weight: 700;
letter-spacing: 0.05em;
color: var(--color-text);
}
/* New Chat Button */
.sidebar__new-chat {
display: flex;
align-items: center;
justify-content: center;
gap: var(--spacing-xs);
width: 100%;
padding: var(--spacing-sm);
border: var(--border-thin);
border-radius: var(--border-radius);
background-color: var(--color-bg);
color: var(--color-text);
font-family: var(--font-body);
font-size: 0.9rem;
font-weight: 400;
cursor: pointer;
transition: all var(--transition-fast);
margin-bottom: var(--spacing-lg);
}
.sidebar__new-chat:hover {
background-color: var(--color-hover);
border-color: var(--color-text-muted);
}
/* Section */
.sidebar__section {
margin-bottom: var(--spacing-md);
}
.sidebar__section--history {
flex: 1;
min-height: 0;
overflow-y: auto;
}
.sidebar__section-title {
font-size: 0.7rem;
font-weight: 500;
text-transform: uppercase;
letter-spacing: 0.1em;
color: var(--color-text-muted);
margin-bottom: var(--spacing-sm);
padding-left: var(--spacing-sm);
}
/* Subject List */
.sidebar__list {
list-style: none;
display: flex;
flex-direction: column;
gap: 2px;
}
.sidebar__link {
display: flex;
align-items: center;
gap: var(--spacing-sm);
width: 100%;
padding: var(--spacing-sm);
border: none;
background: transparent;
border-radius: var(--border-radius);
cursor: pointer;
font-family: var(--font-body);
font-size: 0.9rem;
font-weight: 300;
color: var(--color-text-muted);
text-align: left;
transition: all var(--transition-fast);
}
.sidebar__link:hover {
background-color: var(--color-hover);
color: var(--color-text);
}
.sidebar__link--active {
background-color: var(--color-accent);
color: var(--color-bg);
}
.sidebar__link--active:hover {
color: var(--color-bg);
}
.sidebar__icon {
display: flex;
align-items: center;
justify-content: center;
width: 20px;
font-size: 0.95rem;
}
/* Chat List */
.sidebar__chat-list {
list-style: none;
display: flex;
flex-direction: column;
gap: 2px;
}
.sidebar__chat-link {
display: flex;
flex-direction: column;
width: 100%;
padding: var(--spacing-sm);
padding-left: var(--spacing-sm);
border: none;
background: transparent;
border-radius: var(--border-radius);
cursor: pointer;
font-family: var(--font-body);
text-align: left;
transition: all var(--transition-fast);
}
.sidebar__chat-link:hover {
background-color: var(--color-hover);
}
.sidebar__chat-link--active {
background-color: var(--color-hover);
}
.sidebar__chat-preview {
font-size: 0.85rem;
font-weight: 400;
color: var(--color-text);
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.sidebar__chat-time {
font-size: 0.7rem;
color: var(--color-text-muted);
margin-top: 2px;
}
/* Footer */
.sidebar__footer {
display: flex;
flex-direction: column;
gap: 4px;
padding-top: var(--spacing-sm);
border-top: var(--border-thin);
margin-top: auto;
}
.sidebar__footer-btn {
display: flex;
align-items: center;
gap: var(--spacing-sm);
width: 100%;
padding: var(--spacing-sm);
border: none;
background: transparent;
border-radius: var(--border-radius);
cursor: pointer;
font-family: var(--font-body);
font-size: 0.85rem;
font-weight: 300;
color: var(--color-text-muted);
text-align: left;
transition: all var(--transition-fast);
}
.sidebar__footer-btn:hover {
background-color: var(--color-hover);
color: var(--color-text);
}
.sidebar__footer-btn svg {
flex-shrink: 0;
}
@@ -0,0 +1,99 @@
/* ========================================
Sidebar Component — padhLe
======================================== */
import "./Sidebar.css";
const Sidebar = ({ activeSubject, onSubjectChange, activeChat, onChatSelect }) => {
const subjects = [
{ id: "math", name: "Mathematics", icon: "∑" },
{ id: "science", name: "Science", icon: "⚡" },
{ id: "history", name: "History", icon: "📜" },
{ id: "language", name: "Language Arts", icon: "✍" },
{ id: "english", name: "English", icon: "📖" },
{ id: "geography", name: "Geography", icon: "🌍" },
];
const chats = [
{ id: 1, preview: "Explain photosynthesis", time: "Today, 10:42 AM" },
{ id: 2, preview: "Help with integrals", time: "Yesterday, 3:15 PM" },
];
return (
<aside className="sidebar">
{/* Brand */}
<div className="sidebar__brand">
<h1 className="sidebar__title">padhLe</h1>
</div>
{/* New Chat Button */}
<button className="sidebar__new-chat">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
<path d="M12 5v14M5 12h14" />
</svg>
<span>New Chat</span>
</button>
{/* Subjects */}
<div className="sidebar__section">
<h2 className="sidebar__section-title">Subjects</h2>
<ul className="sidebar__list">
{subjects.map((subject) => (
<li key={subject.id}>
<button
className={`sidebar__link ${
activeSubject === subject.id ? "sidebar__link--active" : ""
}`}
onClick={() => onSubjectChange(subject.id)}
>
<span className="sidebar__icon">{subject.icon}</span>
<span className="sidebar__label">{subject.name}</span>
</button>
</li>
))}
</ul>
</div>
{/* Chat History */}
<div className="sidebar__section sidebar__section--history">
<h2 className="sidebar__section-title">Chat History</h2>
<ul className="sidebar__chat-list">
{chats.map((chat) => (
<li key={chat.id}>
<button
className={`sidebar__chat-link ${
activeChat === chat.id ? "sidebar__chat-link--active" : ""
}`}
onClick={() => onChatSelect(chat.id)}
>
<span className="sidebar__chat-preview">{chat.preview}</span>
<span className="sidebar__chat-time">{chat.time}</span>
</button>
</li>
))}
</ul>
</div>
{/* Footer Actions */}
<div className="sidebar__footer">
<button className="sidebar__footer-btn" aria-label="Settings" title="Settings">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
<circle cx="12" cy="12" r="3" />
<path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06A1.65 1.65 0 0 0 4.68 15a1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06A1.65 1.65 0 0 0 9 4.68a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z" />
</svg>
<span>Settings</span>
</button>
<button className="sidebar__footer-btn" aria-label="Help" title="Help">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
<circle cx="12" cy="12" r="10" />
<path d="M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3" />
<path d="M12 17h.01" />
</svg>
<span>Help</span>
</button>
</div>
</aside>
);
};
export default Sidebar;
@@ -0,0 +1,86 @@
/* ========================================
TopNav Component — padhLe
======================================== */
.topnav {
display: flex;
align-items: center;
justify-content: space-between;
padding: var(--spacing-sm) var(--spacing-xl);
border-bottom: var(--border-thin);
background-color: var(--color-bg);
position: sticky;
top: 0;
z-index: 5;
}
/* Tab List */
.topnav__tabs {
display: flex;
gap: var(--spacing-xs);
}
/* Individual Tab */
.topnav__tab {
display: flex;
align-items: center;
gap: var(--spacing-xs);
padding: var(--spacing-sm) var(--spacing-md);
border: none;
background: transparent;
border-radius: var(--border-radius);
cursor: pointer;
font-family: var(--font-body);
font-size: 0.9rem;
font-weight: 400;
color: var(--color-text-muted);
transition: all var(--transition-fast);
}
.topnav__tab:hover {
background-color: var(--color-hover);
color: var(--color-text);
}
.topnav__tab--active {
background-color: var(--color-accent);
color: var(--color-bg);
}
.topnav__tab--active:hover {
color: var(--color-bg);
}
.topnav__icon {
font-size: 1rem;
}
.topnav__label {
font-family: var(--font-body);
}
/* Action Buttons (Search, Notifications) */
.topnav__actions {
display: flex;
align-items: center;
gap: var(--spacing-xs);
}
.topnav__action {
display: flex;
align-items: center;
justify-content: center;
width: 36px;
height: 36px;
border: none;
background: transparent;
border-radius: var(--border-radius);
cursor: pointer;
color: var(--color-text-muted);
transition: all var(--transition-fast);
}
.topnav__action:hover {
background-color: var(--color-hover);
color: var(--color-text);
}
@@ -0,0 +1,48 @@
/* ========================================
TopNav Component — padhLe
======================================== */
import "./TopNav.css";
const TopNav = ({ activeTab, onTabChange }) => {
const tabs = [
{ id: "chat", label: "AI Chat", icon: "💬" },
{ id: "study", label: "Study Guides", icon: "📖" },
{ id: "progress", label: "Progress", icon: "📊" },
];
return (
<nav className="topnav">
<div className="topnav__tabs">
{tabs.map((tab) => (
<button
key={tab.id}
className={`topnav__tab ${
activeTab === tab.id ? "topnav__tab--active" : ""
}`}
onClick={() => onTabChange(tab.id)}
>
<span className="topnav__icon">{tab.icon}</span>
<span className="topnav__label">{tab.label}</span>
</button>
))}
</div>
<div className="topnav__actions">
<button className="topnav__action" aria-label="Search" title="Search">
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
<circle cx="11" cy="11" r="8" />
<path d="M21 21l-4.35-4.35" />
</svg>
</button>
<button className="topnav__action" aria-label="Notifications" title="Notifications">
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
<path d="M18 8A6 6 0 0 0 6 8c0 7-3 9-3 9h18s-3-2-3-9" />
<path d="M13.73 21a2 2 0 0 1-3.46 0" />
</svg>
</button>
</div>
</nav>
);
};
export default TopNav;
+14
View File
@@ -0,0 +1,14 @@
/* ========================================
Main Entry Point — padhLe
======================================== */
import React from "react";
import ReactDOM from "react-dom/client";
import App from "./App.jsx";
import "./styles/global.css";
ReactDOM.createRoot(document.getElementById("root")).render(
<React.StrictMode>
<App />
</React.StrictMode>
);
+6
View File
@@ -0,0 +1,6 @@
/* ========================================
App Component — padhLe
======================================== */
/* All page styles are in global.css */
/* This file is intentionally kept minimal */
+86
View File
@@ -0,0 +1,86 @@
/* ========================================
Global Styles — padhLe
======================================== */
/* Reset */
*,
*::before,
*::after {
margin: 0;
padding: 0;
box-sizing: border-box;
}
/* Root Variables */
:root {
--color-bg: #ffffff;
--color-border: #1a1a1a;
--color-text: #1a1a1a;
--color-text-muted: #555555;
--color-accent: #1a1a1a;
--color-line: #e8e8e8;
--color-hover: #f5f5f5;
--font-heading: "Caveat", cursive, sans-serif;
--font-body: "Inter", system-ui, sans-serif;
--border-thin: 1px solid var(--color-border);
--border-medium: 2px solid var(--color-border);
--border-radius: 4px;
--spacing-xs: 0.5rem;
--spacing-sm: 0.75rem;
--spacing-md: 1rem;
--spacing-lg: 1.5rem;
--spacing-xl: 2rem;
--spacing-2xl: 3rem;
--spacing-3xl: 4rem;
--spacing-4xl: 6rem;
--transition-fast: 150ms ease;
--transition-normal: 250ms ease;
--transition-slow: 350ms ease;
--sidebar-width: 240px;
}
/* Body */
body {
font-family: var(--font-body);
font-weight: 300;
background-color: var(--color-bg);
color: var(--color-text);
line-height: 1.6;
min-height: 100vh;
}
/* Page Frame — sidebar + main layout */
.page {
display: flex;
min-height: 100vh;
width: 100%;
}
/* Main Content Area — offset to right of fixed sidebar */
.page__main {
flex: 1;
display: flex;
flex-direction: column;
margin-left: var(--sidebar-width);
min-width: 0;
}
/* Main Content Wrapper (centered chat area) */
.main-content {
flex: 1;
display: flex;
flex-direction: column;
overflow-y: auto;
}
/* Container — centered content */
.container {
max-width: 800px;
margin: 0 auto;
width: 100%;
}