-
Notifications
You must be signed in to change notification settings - Fork 12
added margins to certain pages to make the look consistant across the… #96
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
| @@ -1,4 +1,4 @@ | ||||||||
| import React, { createContext, useContext } from 'react'; | ||||||||
| import React, { createContext, useContext, useRef, useEffect, useState } from 'react'; | ||||||||
|
|
||||||||
| const TabsContext = createContext(); | ||||||||
|
|
||||||||
|
|
@@ -13,23 +13,55 @@ const Tabs = ({ value, onValueChange, children, className = '' }) => { | |||||||
| }; | ||||||||
|
|
||||||||
| const TabsList = ({ children, className = '', ...props }) => { | ||||||||
| const { value: currentValue } = useContext(TabsContext); | ||||||||
| const [indicatorStyle, setIndicatorStyle] = useState({ left: 0, width: 0 }); | ||||||||
| const tabsRef = useRef({}); | ||||||||
|
|
||||||||
| useEffect(() => { | ||||||||
| const activeTab = tabsRef.current[currentValue]; | ||||||||
| if (activeTab) { | ||||||||
| setIndicatorStyle({ | ||||||||
| left: activeTab.offsetLeft, | ||||||||
| width: activeTab.offsetWidth, | ||||||||
| }); | ||||||||
| } | ||||||||
| }, [currentValue]); | ||||||||
|
|
||||||||
| return ( | ||||||||
| <div className={`inline-flex h-10 items-center justify-center rounded-lg bg-gray-100 p-1 text-gray-500 ${className}`} {...props}> | ||||||||
| {children} | ||||||||
| <div className={`relative flex h-10 items-center justify-center rounded-lg bg-gray-100 p-1 gap-1 text-gray-500 ${className}`} {...props}> | ||||||||
| <div | ||||||||
| className="absolute h-8 rounded-md border-2 border-emerald-600 transition-all duration-300 ease-in-out" | ||||||||
| style={{ | ||||||||
| left: `${indicatorStyle.left}px`, | ||||||||
| width: `${indicatorStyle.width}px`, | ||||||||
| top: '4px', | ||||||||
| }} | ||||||||
| /> | ||||||||
| {React.Children.map(children, (child) => | ||||||||
| React.cloneElement(child, { tabsRef }) | ||||||||
| )} | ||||||||
| </div> | ||||||||
| ); | ||||||||
| }; | ||||||||
|
|
||||||||
| const TabsTrigger = ({ value, children, className = '', ...props }) => { | ||||||||
| const TabsTrigger = ({ value, children, className = '', tabsRef, ...props }) => { | ||||||||
| const { value: currentValue, onValueChange } = useContext(TabsContext); | ||||||||
| const isActive = currentValue === value; | ||||||||
| const buttonRef = useRef(null); | ||||||||
|
|
||||||||
| useEffect(() => { | ||||||||
| if (tabsRef && buttonRef.current) { | ||||||||
| tabsRef.current[value] = buttonRef.current; | ||||||||
| } | ||||||||
| }, [tabsRef, value]); | ||||||||
|
|
||||||||
| return ( | ||||||||
| <button | ||||||||
|
||||||||
| <button | |
| <button | |
| type="button" |
Copilot
AI
Oct 19, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removing the visible focus ring makes keyboard navigation harder. Restore accessible focus-visible styles (e.g., focus-visible:ring-2 focus-visible:ring-emerald-500 focus-visible:ring-offset-2) so users can see which tab is focused.
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -221,16 +221,19 @@ const MessagesPage = () => { | |||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| return ( | ||||||||||||||||||||||||||||||||||||||
| <div className="container mx-auto px-4 py-6"> | ||||||||||||||||||||||||||||||||||||||
| <div className="mb-6"> | ||||||||||||||||||||||||||||||||||||||
| <div className="container mx-auto" style={{ paddingTop: '6px' }}> | ||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||
| <div className="container mx-auto" style={{ paddingTop: '6px' }}> | |
| <div className="container mx-auto px-4 pt-1.5"> |
Copilot
AI
Oct 19, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Prefer Tailwind classes over inline color styles for consistency and easier theming. For example: use text-white when senderId matches and text-gray-900/text-gray-500 otherwise, e.g., className={text-sm ${message.senderId === user.uid ? 'text-white' : 'text-gray-900'}} and className={text-xs mt-1 ${message.senderId === user.uid ? 'text-white' : 'text-gray-500'}}.
| className={`text-sm ${ | |
| message.senderId === user.uid ? '' : 'text-gray-900' | |
| }`} | |
| style={message.senderId === user.uid ? { color: '#FFFFFF' } : undefined} | |
| > | |
| {message.text} | |
| </p> | |
| <p | |
| className={`text-xs mt-1 ${ | |
| message.senderId === user.uid ? '' : 'text-gray-500' | |
| }`} | |
| style={message.senderId === user.uid ? { color: '#FFFFFF' } : undefined} | |
| className={`text-sm ${message.senderId === user.uid ? 'text-white' : 'text-gray-900'}`} | |
| > | |
| {message.text} | |
| </p> | |
| <p | |
| className={`text-xs mt-1 ${message.senderId === user.uid ? 'text-white' : 'text-gray-500'}`} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The active tab indicator only updates when the selected value changes. After a window resize (or container width change), the indicator can become misaligned because offsetLeft/offsetWidth change but this effect doesn't re-run. Add a resize listener or a ResizeObserver to recompute the indicator on layout changes.