* feat: add extesion settings Signed-off-by: James <james@jan.ai> --------- Signed-off-by: James <james@jan.ai> Co-authored-by: James <james@jan.ai> Co-authored-by: Louis <louis@jan.ai>
46 lines
1.0 KiB
TypeScript
46 lines
1.0 KiB
TypeScript
import { SettingComponentProps } from '@janhq/core'
|
|
|
|
import SettingDetailTextInputItem from './SettingDetailTextInputItem'
|
|
|
|
type Props = {
|
|
componentProps: SettingComponentProps[]
|
|
onValueUpdated: (key: string, value: string | number | boolean) => void
|
|
}
|
|
|
|
const SettingDetailItem: React.FC<Props> = ({
|
|
componentProps,
|
|
onValueUpdated,
|
|
}) => {
|
|
const components = componentProps.map((data) => {
|
|
switch (data.controllerType) {
|
|
case 'input': {
|
|
return (
|
|
<SettingDetailTextInputItem
|
|
key={data.key}
|
|
settingProps={data}
|
|
onValueChanged={(value) => onValueUpdated(data.key, value)}
|
|
/>
|
|
)
|
|
}
|
|
|
|
default:
|
|
return null
|
|
}
|
|
})
|
|
|
|
return (
|
|
<div className="flex w-full flex-col">
|
|
{components.map((component, index) => (
|
|
<div
|
|
className={`mx-6 ${index === components.length - 1 ? '' : 'border-b border-border'}`}
|
|
key={index}
|
|
>
|
|
{component}
|
|
</div>
|
|
))}
|
|
</div>
|
|
)
|
|
}
|
|
|
|
export default SettingDetailItem
|