feat(StyledInput): reexport the <input> component with styled
This commit is contained in:
parent
d9ba36794a
commit
aacde5a7a5
2 changed files with 23 additions and 12 deletions
|
|
@ -1,6 +1,7 @@
|
||||||
import { Dialog, Transition } from '@headlessui/react';
|
import { Dialog, Transition } from '@headlessui/react';
|
||||||
import { CloudUpload, RefreshCcw, RefreshCw } from 'lucide-react';
|
import { CloudUpload, RefreshCcw, RefreshCw } from 'lucide-react';
|
||||||
import React, { Fragment, useEffect, useState } from 'react';
|
import React, { Fragment, useEffect, useState } from 'react';
|
||||||
|
import { StyledInput } from './common/StyledInput';
|
||||||
|
|
||||||
interface SettingsType {
|
interface SettingsType {
|
||||||
chatModelProviders: {
|
chatModelProviders: {
|
||||||
|
|
@ -232,42 +233,39 @@ const SettingsDialog = ({
|
||||||
<>
|
<>
|
||||||
<div className="flex flex-col space-y-1">
|
<div className="flex flex-col space-y-1">
|
||||||
<p className="text-white/70 text-sm">Model name</p>
|
<p className="text-white/70 text-sm">Model name</p>
|
||||||
<input
|
<StyledInput
|
||||||
type="text"
|
type="text"
|
||||||
placeholder="Model name"
|
placeholder="Model name"
|
||||||
defaultValue={selectedChatModel!}
|
defaultValue={selectedChatModel!}
|
||||||
onChange={(e) =>
|
onChange={(e) =>
|
||||||
setSelectedChatModel(e.target.value)
|
setSelectedChatModel(e.target.value)
|
||||||
}
|
}
|
||||||
className="bg-[#111111] px-3 py-2 flex items-center overflow-hidden border border-[#1C1C1C] text-white rounded-lg text-sm"
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex flex-col space-y-1">
|
<div className="flex flex-col space-y-1">
|
||||||
<p className="text-white/70 text-sm">
|
<p className="text-white/70 text-sm">
|
||||||
Custom OpenAI API Key
|
Custom OpenAI API Key
|
||||||
</p>
|
</p>
|
||||||
<input
|
<StyledInput
|
||||||
type="text"
|
type="text"
|
||||||
placeholder="Custom OpenAI API Key"
|
placeholder="Custom OpenAI API Key"
|
||||||
defaultValue={customOpenAIApiKey!}
|
defaultValue={customOpenAIApiKey!}
|
||||||
onChange={(e) =>
|
onChange={(e) =>
|
||||||
setCustomOpenAIApiKey(e.target.value)
|
setCustomOpenAIApiKey(e.target.value)
|
||||||
}
|
}
|
||||||
className="bg-[#111111] px-3 py-2 flex items-center overflow-hidden border border-[#1C1C1C] text-white rounded-lg text-sm"
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex flex-col space-y-1">
|
<div className="flex flex-col space-y-1">
|
||||||
<p className="text-white/70 text-sm">
|
<p className="text-white/70 text-sm">
|
||||||
Custom OpenAI Base URL
|
Custom OpenAI Base URL
|
||||||
</p>
|
</p>
|
||||||
<input
|
<StyledInput
|
||||||
type="text"
|
type="text"
|
||||||
placeholder="Custom OpenAI Base URL"
|
placeholder="Custom OpenAI Base URL"
|
||||||
defaultValue={customOpenAIBaseURL!}
|
defaultValue={customOpenAIBaseURL!}
|
||||||
onChange={(e) =>
|
onChange={(e) =>
|
||||||
setCustomOpenAIBaseURL(e.target.value)
|
setCustomOpenAIBaseURL(e.target.value)
|
||||||
}
|
}
|
||||||
className="bg-[#111111] px-3 py-2 flex items-center overflow-hidden border border-[#1C1C1C] text-white rounded-lg text-sm"
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
|
|
@ -337,7 +335,7 @@ const SettingsDialog = ({
|
||||||
)}
|
)}
|
||||||
<div className="flex flex-col space-y-1">
|
<div className="flex flex-col space-y-1">
|
||||||
<p className="text-white/70 text-sm">OpenAI API Key</p>
|
<p className="text-white/70 text-sm">OpenAI API Key</p>
|
||||||
<input
|
<StyledInput
|
||||||
type="text"
|
type="text"
|
||||||
placeholder="OpenAI API Key"
|
placeholder="OpenAI API Key"
|
||||||
defaultValue={config.openaiApiKey}
|
defaultValue={config.openaiApiKey}
|
||||||
|
|
@ -347,12 +345,11 @@ const SettingsDialog = ({
|
||||||
openaiApiKey: e.target.value,
|
openaiApiKey: e.target.value,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
className="bg-[#111111] px-3 py-2 flex items-center overflow-hidden border border-[#1C1C1C] text-white rounded-lg text-sm"
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex flex-col space-y-1">
|
<div className="flex flex-col space-y-1">
|
||||||
<p className="text-white/70 text-sm">Ollama API URL</p>
|
<p className="text-white/70 text-sm">Ollama API URL</p>
|
||||||
<input
|
<StyledInput
|
||||||
type="text"
|
type="text"
|
||||||
placeholder="Ollama API URL"
|
placeholder="Ollama API URL"
|
||||||
defaultValue={config.ollamaApiUrl}
|
defaultValue={config.ollamaApiUrl}
|
||||||
|
|
@ -362,12 +359,11 @@ const SettingsDialog = ({
|
||||||
ollamaApiUrl: e.target.value,
|
ollamaApiUrl: e.target.value,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
className="bg-[#111111] px-3 py-2 flex items-center overflow-hidden border border-[#1C1C1C] text-white rounded-lg text-sm"
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex flex-col space-y-1">
|
<div className="flex flex-col space-y-1">
|
||||||
<p className="text-white/70 text-sm">GROQ API Key</p>
|
<p className="text-white/70 text-sm">GROQ API Key</p>
|
||||||
<input
|
<StyledInput
|
||||||
type="text"
|
type="text"
|
||||||
placeholder="GROQ API Key"
|
placeholder="GROQ API Key"
|
||||||
defaultValue={config.groqApiKey}
|
defaultValue={config.groqApiKey}
|
||||||
|
|
@ -377,7 +373,6 @@ const SettingsDialog = ({
|
||||||
groqApiKey: e.target.value,
|
groqApiKey: e.target.value,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
className="bg-[#111111] px-3 py-2 flex items-center overflow-hidden border border-[#1C1C1C] text-white rounded-lg text-sm"
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
16
ui/components/common/StyledInput.tsx
Normal file
16
ui/components/common/StyledInput.tsx
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
import { cn } from '@/lib/utils';
|
||||||
|
import type { InputHTMLAttributes } from 'react';
|
||||||
|
|
||||||
|
export interface InputProps extends InputHTMLAttributes<HTMLInputElement> {}
|
||||||
|
|
||||||
|
export const StyledInput = function StyledInput({
|
||||||
|
className,
|
||||||
|
...restProps
|
||||||
|
}: InputProps) {
|
||||||
|
return (
|
||||||
|
<input
|
||||||
|
className={cn("bg-[#111111] px-3 py-2 flex items-center overflow-hidden border border-[#1C1C1C] text-white rounded-lg text-sm", className)}
|
||||||
|
{...restProps}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
};
|
||||||
Loading…
Add table
Add a link
Reference in a new issue