Skip to content

Commit

Permalink
refactor(dropdowns): improve dropdown item display and interaction
Browse files Browse the repository at this point in the history
- Enhanced ToolDropdown and ModelDropdown to refine the display of shortcut keys, improving visibility with dynamic opacity based on active state.
- Updated button styling in ModelDropdown for better consistency and user experience.
- Streamlined the layout of dropdown items to ensure a more cohesive and responsive design.
  • Loading branch information
crazygo committed Jan 17, 2025
1 parent 0b1293c commit 3f8c13f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
5 changes: 4 additions & 1 deletion src/components/ask-tooldropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,10 @@ export default function ToolDropdown({
</span>
<span className="whitespace-nowrap flex-1 flex justify-between items-center">
<span>{tool.name}</span>
<span className="text-gray-400 ml-2 opacity-0 group-hover:opacity-100 transition-opacity duration-200">
<span
className={`ml-2 opacity-0 transition-all duration-100 ${active || 'group-hover:opacity-100'} ${
active && 'opacity-100'
}`}>
[{navigator.platform.includes('Mac') ? '⌘' : 'Ctrl'} + enter]
</span>
</span>
Expand Down
7 changes: 5 additions & 2 deletions src/components/ask/ModelDropDown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export default function ModelDropdown({
<button
className={`${
active ? 'bg-black text-white' : 'text-gray-900'
} flex w-full items-center rounded-md px-2 py-2 text-sm focus:outline-none group`}
} group flex w-full items-center rounded-md px-2 py-2 text-sm focus:outline-none`}
onClick={e => {
e.preventDefault();
handleModelClick(model, e.metaKey || e.ctrlKey);
Expand All @@ -76,7 +76,10 @@ export default function ModelDropdown({
</span>
<span className="whitespace-nowrap flex-1 flex justify-between items-center">
<span>{model.shortName}</span>
<span className="text-gray-400 ml-2 opacity-0 group-hover:opacity-100 transition-opacity duration-200">
<span
className={`ml-2 opacity-0 transition-all duration-100 ${active || 'group-hover:opacity-100'} ${
active && 'opacity-100'
}`}>
[{model.provider}]
</span>
</span>
Expand Down

0 comments on commit 3f8c13f

Please sign in to comment.