Skip to content

Commit 0c3abd8

Browse files
author
Tim Sinaeve
committed
Implement Antigravity styling across UI components
- Sharper corners (rounded-sm instead of rounded-md/lg) - Reduced focus rings (ring-1, subtle opacity) - Removed shadows from modals, tooltips, dropdowns, context menus - Updated hover states to use tree-selected for list items - Ghost buttons now use text-only hover (no background) - Smaller toggle switch for compact feel
1 parent a66c73a commit 0c3abd8

8 files changed

Lines changed: 66 additions & 69 deletions

File tree

components/Button.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@ interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
99

1010
const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
1111
({ children, variant = 'primary', isLoading = false, className, ...props }, ref) => {
12-
const baseClasses = 'inline-flex items-center justify-center px-3 py-1.5 border text-xs font-semibold rounded-md focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-background disabled:opacity-60 disabled:cursor-not-allowed transition-colors duration-150';
13-
12+
const baseClasses = 'inline-flex items-center justify-center px-3 py-1.5 border text-xs font-semibold rounded-sm focus:outline-none focus:ring-1 disabled:opacity-50 disabled:cursor-not-allowed transition-colors duration-100';
13+
1414
const variantClasses = {
15-
primary: 'bg-primary text-primary-text border-transparent hover:bg-primary-hover focus:ring-primary',
16-
secondary: 'bg-secondary text-text-main border-border-color hover:bg-border-color focus:ring-primary',
17-
destructive: 'bg-destructive-bg text-destructive-text border-destructive-border hover:bg-destructive-bg-hover focus:ring-destructive-text',
18-
ghost: 'bg-transparent text-text-main border-transparent hover:bg-border-color focus:ring-primary',
15+
primary: 'bg-primary text-primary-text border-transparent hover:bg-primary-hover focus:ring-primary/50',
16+
secondary: 'bg-secondary text-text-main border-border-color hover:bg-border-color/50 focus:ring-primary/50',
17+
destructive: 'bg-destructive-bg text-destructive-text border-destructive-border hover:bg-destructive-bg-hover focus:ring-destructive-text/50',
18+
ghost: 'bg-transparent text-text-secondary border-transparent hover:text-text-main focus:ring-primary/30',
1919
};
20-
20+
2121
const disabled = props.disabled || isLoading;
2222

2323
return (

components/ContextMenu.tsx

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,21 @@ import ReactDOM from 'react-dom';
33

44
export type MenuItem =
55
| {
6-
label: string;
7-
action: () => void;
8-
icon?: React.FC<{ className?: string }>;
9-
disabled?: boolean;
10-
shortcut?: string;
11-
submenu?: never;
12-
}
6+
label: string;
7+
action: () => void;
8+
icon?: React.FC<{ className?: string }>;
9+
disabled?: boolean;
10+
shortcut?: string;
11+
submenu?: never;
12+
}
1313
| {
14-
label: string;
15-
submenu: MenuItem[];
16-
icon?: React.FC<{ className?: string }>;
17-
disabled?: boolean;
18-
shortcut?: string;
19-
action?: never;
20-
}
14+
label: string;
15+
submenu: MenuItem[];
16+
icon?: React.FC<{ className?: string }>;
17+
disabled?: boolean;
18+
shortcut?: string;
19+
action?: never;
20+
}
2121
| { type: 'separator' };
2222

2323
interface ContextMenuProps {
@@ -96,9 +96,9 @@ const ContextMenu: React.FC<ContextMenuProps> = ({ isOpen, position, items, onCl
9696
}
9797
};
9898
const handleKeyDown = (event: KeyboardEvent) => {
99-
if (event.key === 'Escape') {
100-
onClose();
101-
}
99+
if (event.key === 'Escape') {
100+
onClose();
101+
}
102102
}
103103

104104
document.addEventListener('mousedown', handleClickOutside);
@@ -200,7 +200,7 @@ const ContextMenu: React.FC<ContextMenuProps> = ({ isOpen, position, items, onCl
200200
}
201201
}}
202202
disabled={item.disabled || !hasEnabledSubitem}
203-
className="w-full flex items-center justify-between text-left px-2 py-1.5 text-xs rounded-md transition-colors text-text-main disabled:text-text-secondary/50 disabled:cursor-not-allowed hover:bg-primary hover:text-primary-text focus:bg-primary focus:text-primary-text focus:outline-none"
203+
className="w-full flex items-center justify-between text-left px-2 py-1 text-xs rounded-sm transition-colors text-text-main disabled:text-text-secondary/50 disabled:cursor-not-allowed hover:bg-tree-selected hover:text-text-main focus:bg-tree-selected focus:text-text-main focus:outline-none"
204204
>
205205
<div className="flex items-center gap-3">
206206
{Icon && <Icon className="w-4 h-4" />}
@@ -209,7 +209,7 @@ const ContextMenu: React.FC<ContextMenuProps> = ({ isOpen, position, items, onCl
209209
<span className="text-text-secondary"></span>
210210
</button>
211211
{isOpen && item.submenu.length > 0 && (
212-
<div className="absolute top-0 left-full ml-1 z-10 w-[16.8rem] rounded-md bg-secondary p-1.5 shadow-2xl border border-border-color animate-fade-in-fast">
212+
<div className="absolute top-0 left-full ml-1 z-10 w-[16.8rem] rounded-sm bg-secondary p-1 border border-border-color animate-fade-in-fast">
213213
<ul className="space-y-1">{renderItems(item.submenu, depth + 1)}</ul>
214214
</div>
215215
)}
@@ -229,7 +229,7 @@ const ContextMenu: React.FC<ContextMenuProps> = ({ isOpen, position, items, onCl
229229
}
230230
}}
231231
disabled={disabled}
232-
className="w-full flex items-center justify-between text-left px-2 py-1.5 text-xs rounded-md transition-colors text-text-main disabled:text-text-secondary/50 disabled:cursor-not-allowed hover:bg-primary hover:text-primary-text focus:bg-primary focus:text-primary-text focus:outline-none"
232+
className="w-full flex items-center justify-between text-left px-2 py-1 text-xs rounded-sm transition-colors text-text-main disabled:text-text-secondary/50 disabled:cursor-not-allowed hover:bg-tree-selected hover:text-text-main focus:bg-tree-selected focus:text-text-main focus:outline-none"
233233
>
234234
<div className="flex items-center gap-3">
235235
{Icon && <Icon className="w-4 h-4" />}
@@ -251,7 +251,7 @@ const ContextMenu: React.FC<ContextMenuProps> = ({ isOpen, position, items, onCl
251251
maxHeight: menuStyle.maxHeight ? menuStyle.maxHeight : undefined,
252252
overflowY: menuStyle.overflowY,
253253
}}
254-
className="fixed z-50 w-[16.8rem] rounded-md bg-secondary p-1.5 shadow-2xl border border-border-color animate-fade-in-fast"
254+
className="fixed z-50 w-[16.8rem] rounded-sm bg-secondary p-1 border border-border-color animate-fade-in-fast"
255255
>
256256
<ul className="space-y-1">
257257
{renderItems(items)}

components/IconButton.tsx

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -9,34 +9,34 @@ interface IconButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>
99
tooltipPosition?: 'top' | 'bottom';
1010
}
1111

12-
const IconButton: React.FC<IconButtonProps> = ({ children, tooltip, className, variant = 'primary', size='md', tooltipPosition = 'top', ...props }) => {
13-
const [isHovered, setIsHovered] = useState(false);
14-
const wrapperRef = useRef<HTMLSpanElement>(null);
15-
const { ['aria-label']: ariaLabel, ...buttonProps } = props;
16-
const computedAriaLabel = ariaLabel ?? tooltip;
12+
const IconButton: React.FC<IconButtonProps> = ({ children, tooltip, className, variant = 'primary', size = 'md', tooltipPosition = 'top', ...props }) => {
13+
const [isHovered, setIsHovered] = useState(false);
14+
const wrapperRef = useRef<HTMLSpanElement>(null);
15+
const { ['aria-label']: ariaLabel, ...buttonProps } = props;
16+
const computedAriaLabel = ariaLabel ?? tooltip;
1717

18-
const handleMouseEnter = useCallback(() => {
19-
if (tooltip) setIsHovered(true);
20-
}, [tooltip]);
18+
const handleMouseEnter = useCallback(() => {
19+
if (tooltip) setIsHovered(true);
20+
}, [tooltip]);
2121

22-
const handleMouseLeave = useCallback(() => {
23-
setIsHovered(false);
24-
}, []);
22+
const handleMouseLeave = useCallback(() => {
23+
setIsHovered(false);
24+
}, []);
2525

26-
const baseClasses = "flex items-center justify-center rounded-md focus:outline-none transition-colors";
27-
28-
const variantClasses = {
29-
primary: 'text-text-secondary hover:bg-border-color hover:text-text-main',
30-
ghost: 'text-text-secondary/80 hover:bg-border-color hover:text-text-main',
31-
destructive: 'text-destructive-text bg-transparent hover:bg-destructive-bg'
32-
};
26+
const baseClasses = "flex items-center justify-center rounded-sm focus:outline-none transition-colors duration-100";
27+
28+
const variantClasses = {
29+
primary: 'text-text-secondary hover:text-text-main hover:bg-border-color/30',
30+
ghost: 'text-text-secondary hover:text-text-main',
31+
destructive: 'text-destructive-text bg-transparent hover:bg-destructive-bg/50'
32+
};
33+
34+
const sizeClasses = {
35+
xs: 'w-6 h-6',
36+
sm: 'w-7 h-7',
37+
md: 'w-8 h-8'
38+
};
3339

34-
const sizeClasses = {
35-
xs: 'w-6 h-6',
36-
sm: 'w-7 h-7',
37-
md: 'w-8 h-8'
38-
};
39-
4040
return (
4141
<>
4242
<span

components/LanguageDropdown.tsx

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ const LanguageDropdown = React.forwardRef<HTMLButtonElement, LanguageDropdownPro
9595
type="button"
9696
ref={setButtonRef}
9797
onClick={toggleOpen}
98-
className="flex items-center gap-2 bg-background text-text-main text-xs rounded-md py-1 pl-2 pr-2 border border-border-color focus:outline-none focus:ring-1 focus:ring-primary"
98+
className="flex items-center gap-2 bg-background text-text-main text-xs rounded-sm py-1 pl-2 pr-2 border border-border-color focus:outline-none focus:ring-1 focus:ring-primary/50"
9999
aria-haspopup="listbox"
100100
aria-expanded={isOpen}
101101
>
@@ -106,7 +106,7 @@ const LanguageDropdown = React.forwardRef<HTMLButtonElement, LanguageDropdownPro
106106
</button>
107107
{isOpen && (
108108
<div
109-
className="absolute right-0 mt-1 z-50 w-72 rounded-md border border-border-color bg-background shadow-lg"
109+
className="absolute right-0 mt-1 z-50 w-72 rounded-sm border border-border-color bg-background"
110110
role="listbox"
111111
aria-activedescendant={activeOptionId}
112112
>
@@ -119,11 +119,10 @@ const LanguageDropdown = React.forwardRef<HTMLButtonElement, LanguageDropdownPro
119119
role="option"
120120
aria-selected={language.id === selectedLanguage.id}
121121
onClick={() => handleSelect(language.id)}
122-
className={`text-left px-3 py-1.5 rounded-md transition-colors ${
123-
language.id === selectedLanguage.id
124-
? 'bg-secondary/70 text-primary font-semibold'
125-
: 'text-text-main hover:bg-secondary'
126-
}`}
122+
className={`text-left px-3 py-1 rounded-sm transition-colors ${language.id === selectedLanguage.id
123+
? 'bg-tree-selected text-text-main font-medium'
124+
: 'text-text-main hover:bg-tree-selected'
125+
}`}
127126
>
128127
{language.label}
129128
</button>

components/Modal.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ const Modal: React.FC<ModalProps> = ({ onClose, children, title, initialFocusRef
118118
>
119119
<div
120120
ref={modalRef}
121-
className="bg-secondary rounded-lg shadow-xl w-full max-w-xl mx-4 border border-border-color"
121+
className="bg-secondary rounded-sm w-full max-w-xl mx-4 border border-border-color"
122122
onClick={(e) => e.stopPropagation()}
123123
>
124124
<div className="flex justify-between items-center px-4 py-3 border-b border-border-color">

components/ToggleSwitch.tsx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,12 @@ const ToggleSwitch: React.FC<ToggleSwitchProps> = ({ id, checked, onChange }) =>
1414
role="switch"
1515
aria-checked={checked}
1616
onClick={() => onChange(!checked)}
17-
className={`relative inline-flex h-6 w-11 flex-shrink-0 items-center rounded-full transition-colors focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-2 focus:ring-offset-secondary ${
18-
checked ? 'bg-primary' : 'bg-border-color'
19-
}`}
17+
className={`relative inline-flex h-5 w-10 flex-shrink-0 items-center rounded-full transition-colors duration-100 focus:outline-none focus:ring-1 focus:ring-primary/50 ${checked ? 'bg-primary' : 'bg-border-color'
18+
}`}
2019
>
2120
<span
22-
className={`inline-block h-4 w-4 transform rounded-full bg-white transition-transform ${
23-
checked ? 'translate-x-6' : 'translate-x-1'
24-
}`}
21+
className={`inline-block h-3.5 w-3.5 transform rounded-full bg-white transition-transform ${checked ? 'translate-x-5' : 'translate-x-0.5'
22+
}`}
2523
/>
2624
</button>
2725
);

components/Tooltip.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ const Tooltip: React.FC<TooltipProps> = ({ targetRef, content, position = 'top',
9090
const overlayRoot = document.getElementById('overlay-root');
9191
if (!overlayRoot) return null;
9292

93-
const baseClassName = 'fixed z-50 w-max px-2 py-1 text-xs font-semibold text-tooltip-text bg-tooltip-bg rounded-md shadow-lg transition-opacity duration-200 pointer-events-none';
93+
const baseClassName = 'fixed z-50 w-max px-2 py-1 text-xs font-semibold text-tooltip-text bg-tooltip-bg rounded-sm border border-border-color transition-opacity duration-100 pointer-events-none';
9494
const composedClassName = className ? `${baseClassName} ${className}` : `${baseClassName} max-w-xs`;
9595

9696
return ReactDOM.createPortal(

components/WelcomeScreen.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ import { PlusIcon, FileIcon } from './Icons';
44
import Button from './Button';
55

66
interface WelcomeScreenProps {
7-
onNewDocument: () => void;
7+
onNewDocument: () => void;
88
}
99

1010
export const WelcomeScreen: React.FC<WelcomeScreenProps> = ({ onNewDocument }) => {
1111
return (
1212
<div className="flex flex-col items-center justify-center h-full text-center text-text-secondary p-8 bg-background">
13-
<div className="p-8 bg-secondary rounded-lg border border-border-color max-w-lg">
13+
<div className="p-8 bg-secondary rounded-sm border border-border-color max-w-lg">
1414
<FileIcon className="w-16 h-16 text-primary mx-auto mb-6" />
1515
<h2 className="text-xl font-semibold text-text-main mb-2">Welcome to DocForge</h2>
1616
<p className="max-w-md mb-8 text-sm">

0 commit comments

Comments
 (0)