Skip to content

Commit 7c6f5da

Browse files
authored
Styling tools selection shortcut buttons (#11)
This pull request includes updates to the `ToolsToggle` component and the `toolIcons` configuration to enhance the styling and functionality of tool icons. The most important changes include adding color properties to the tool icon mappings and updating the `ToolsToggle` component to use these new properties. Improvements to tool icon styling: * [`src/components/ChatInputButton/toolIcons.tsx`](diffhunk://#diff-f9c7082cb98bf0b9e486b971e75e43b385a100093e611408d2e6cb356ec3f655L1-R94): Added `colors` property to each tool icon mapping, which includes `bg`, `hoverBg`, and `text` color classes. * [`src/components/ChatInputButton/ToolsToggle.tsx`](diffhunk://#diff-5e81be1e28b3637aa2337dde6d10a306e31c56a504ee3c59747f301d1f3fc2e1L74-R74): Updated the `ToolsToggle` component to use the new `colors` property from the tool icon mappings for background and text colors. [[1]](diffhunk://#diff-5e81be1e28b3637aa2337dde6d10a306e31c56a504ee3c59747f301d1f3fc2e1L74-R74) [[2]](diffhunk://#diff-5e81be1e28b3637aa2337dde6d10a306e31c56a504ee3c59747f301d1f3fc2e1L91-R92)
1 parent a45a875 commit 7c6f5da

File tree

2 files changed

+56
-16
lines changed

2 files changed

+56
-16
lines changed

src/components/ChatInputButton/ToolsToggle.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ export const ToolsToggle: React.FC<ToolsToggleButtonProps> = ({
7171
/>
7272

7373
{/* Quick access tool icons */}
74-
{toolIconMappings.map(({ pattern, icon: Icon, title }) => {
74+
{toolIconMappings.map(({ pattern, icon: Icon, title, colors }) => {
7575
// Check if there are any available tools matching this pattern
7676
const hasMatchingTools = availableTools.some(tool =>
7777
tool.toLowerCase().includes(pattern.toLowerCase())
@@ -88,8 +88,8 @@ export const ToolsToggle: React.FC<ToolsToggleButtonProps> = ({
8888
selectedTools.some(tool =>
8989
tool.toLowerCase().includes(pattern.toLowerCase())
9090
)
91-
? 'bg-gray-800 text-white hover:bg-gray-700'
92-
: 'bg-gray-200 text-gray-700 hover:bg-gray-300'
91+
? `${colors.bg} ${colors.text} ${colors.hoverBg}`
92+
: `bg-gray-400 ${colors.text} ${colors.hoverBg}`
9393
}`}
9494
>
9595
<Icon className="h-4 w-4" />
Lines changed: 53 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,96 @@
1-
import { IconType } from 'react-icons';
2-
import { SiGmail } from 'react-icons/si';
3-
import {FaDatabase, FaDocker, FaGithub, FaGitSquare, FaRegFolderOpen} from 'react-icons/fa';
1+
import {SiGmail} from "react-icons/si";
42
import {MdOutlineHttp} from "react-icons/md";
3+
import {IconType} from "react-icons";
4+
import {FaDatabase, FaDocker, FaGithub, FaGitSquare, FaRegFolderOpen} from "react-icons/fa";
55

66
interface ToolIconMapping {
77
pattern: string;
88
icon: IconType;
99
title: string;
10-
regex: RegExp; // Make regex required since we're using it for all
10+
regex: RegExp;
11+
colors: {
12+
bg: string;
13+
hoverBg: string;
14+
text: string;
15+
};
1116
}
1217

1318
export const toolIconMappings: ToolIconMapping[] = [
1419
{
1520
pattern: 'gmail',
1621
icon: SiGmail,
1722
title: 'Access Gmail',
18-
regex: /^gmail\w*/
23+
regex: /^gmail\w*/,
24+
colors: {
25+
bg: 'bg-red-600',
26+
hoverBg: 'hover:bg-red-700',
27+
text: 'text-white'
28+
}
1929
},
2030
{
2131
pattern: 'curl',
2232
icon: MdOutlineHttp,
2333
title: 'HTTP Tools using cURL',
24-
regex: /^curl\w*/
34+
regex: /^curl\w*/,
35+
colors: {
36+
bg: 'bg-purple-600',
37+
hoverBg: 'hover:bg-purple-700',
38+
text: 'text-white'
39+
}
2540
},
2641
{
27-
pattern: 'sql',
42+
pattern: 'postgresql',
2843
icon: FaDatabase,
29-
title: 'Database Tools',
30-
regex: /^sql\w*/
44+
title: 'PostgreSQL Tools',
45+
regex: /^postgresql\w*/,
46+
colors: {
47+
bg: 'bg-blue-600',
48+
hoverBg: 'hover:bg-blue-700',
49+
text: 'text-white'
50+
}
3151
},
3252
{
3353
pattern: 'git',
3454
icon: FaGitSquare,
3555
title: 'Git Tools',
36-
regex: /^git(?!hub)\w*/
56+
regex: /^git(?!hub)\w*/,
57+
colors: {
58+
bg: 'bg-orange-600',
59+
hoverBg: 'hover:bg-orange-700',
60+
text: 'text-white'
61+
}
3762
},
3863
{
3964
pattern: 'github',
4065
icon: FaGithub,
4166
title: 'GitHub Tools',
42-
regex: /^github\w*/
67+
regex: /^github\w*/,
68+
colors: {
69+
bg: 'bg-gray-800',
70+
hoverBg: 'hover:bg-gray-900',
71+
text: 'text-white'
72+
}
4373
},
4474
{
4575
pattern: 'docker',
4676
icon: FaDocker,
4777
title: 'Docker Tools',
48-
regex: /^docker\w*/
78+
regex: /^docker\w*/,
79+
colors: {
80+
bg: 'bg-sky-600',
81+
hoverBg: 'hover:bg-sky-700',
82+
text: 'text-white'
83+
}
4984
},
5085
{
5186
pattern: 'filesystem',
5287
icon: FaRegFolderOpen,
5388
title: 'Manage Filesystem',
54-
regex: /^filesystem\w*/
89+
regex: /^filesystem\w*/,
90+
colors: {
91+
bg: 'bg-amber-500',
92+
hoverBg: 'hover:bg-amber-600',
93+
text: 'text-white'
94+
}
5595
}
5696
];

0 commit comments

Comments
 (0)