mirror of
https://github.com/kubeshark/kubeshark.git
synced 2025-09-27 21:38:06 +00:00
Radio buttons added to selectList with single select
This commit is contained in:
17
ui/src/components/UI/Radio.tsx
Normal file
17
ui/src/components/UI/Radio.tsx
Normal file
@@ -0,0 +1,17 @@
|
||||
import React from "react";
|
||||
|
||||
export interface Props {
|
||||
checked: boolean;
|
||||
onToggle: (checked:boolean) => any;
|
||||
}
|
||||
|
||||
const Radio: React.FC<Props> = ({checked, onToggle}) => {
|
||||
|
||||
return (
|
||||
<div>
|
||||
<input style={{cursor: "pointer"}} type="radio" checked={checked} onChange={(event) => onToggle(event.target.checked)}/>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default Radio;
|
@@ -1,5 +1,6 @@
|
||||
import { useMemo, useState } from "react";
|
||||
import Checkbox from "./Checkbox"
|
||||
import Radio from "./Radio";
|
||||
|
||||
export interface Props {
|
||||
valuesListInput;
|
||||
@@ -73,10 +74,11 @@ const SelectList: React.FC<Props> = ({valuesListInput,tableName,multiSelect=true
|
||||
{filteredValues?.map(listValue => {
|
||||
return <tr key={listValue}>
|
||||
<td style={{width: 50}}>
|
||||
<Checkbox checked={valuesList[listValue]} onToggle={() => toggleValues(listValue)}/>
|
||||
{multiSelect && <Checkbox checked={valuesList[listValue]} onToggle={() => toggleValues(listValue)}/>}
|
||||
{!multiSelect && <Radio checked={valuesList[listValue]} onToggle={() => toggleValues(listValue)}/>}
|
||||
</td>
|
||||
<td>{listValue}</td>
|
||||
</tr>
|
||||
</tr>
|
||||
}
|
||||
)}
|
||||
</tbody>
|
||||
|
Reference in New Issue
Block a user