mirror of
https://github.com/fleetdm/fleet
synced 2026-05-21 16:08:47 +00:00
* Allow sort by more than one key * created custom tooltip component * remove unused code * fixed style for more layouts * added tooltip to query side panel * tooltips added to setting form * finished settings form * added tooltip for perf impact table headers * tooltip for pack table and user form * tooltip on manage policies page * tooltip for manage schedules * tooltip for automations; spacing for form input * tooltip for automations modal * user form; fixed input with icon component * more user form tooltips * tooltip for homepage; style fixes * replaced many more tooltips with new version * added story for tooltip * added position prop * fixed tests * re-work how we click react-select dropdowns * forcing the update button click * trying a blur * fixed typo * trying blur on another element * temp check-in * replaced tooltip from host details software * more consolidation of tooltip use for software * fixed settings flow test Co-authored-by: Tomas Touceda <chiiph@gmail.com>
62 lines
1.3 KiB
TypeScript
62 lines
1.3 KiB
TypeScript
import React from "react";
|
|
import classnames from "classnames";
|
|
|
|
import TooltipWrapper from "components/TooltipWrapper";
|
|
|
|
const baseClass = "radio";
|
|
|
|
export interface IRadioProps {
|
|
label: string;
|
|
value: string;
|
|
id: string;
|
|
onChange: (value: string) => void;
|
|
checked?: boolean;
|
|
name?: string;
|
|
className?: string;
|
|
disabled?: boolean;
|
|
tooltip?: string;
|
|
}
|
|
|
|
const Radio = ({
|
|
className,
|
|
id,
|
|
name,
|
|
value,
|
|
checked,
|
|
disabled,
|
|
label,
|
|
tooltip,
|
|
onChange,
|
|
}: IRadioProps): JSX.Element => {
|
|
const wrapperClasses = classnames(baseClass, className);
|
|
|
|
const radioControlClass = classnames({
|
|
[`disabled`]: disabled,
|
|
});
|
|
|
|
return (
|
|
<label htmlFor={id} className={`${wrapperClasses} ${radioControlClass}`}>
|
|
<span className={`${baseClass}__input`}>
|
|
<input
|
|
type="radio"
|
|
id={id}
|
|
disabled={disabled}
|
|
name={name}
|
|
value={value}
|
|
checked={checked}
|
|
onChange={(event) => onChange(event.target.value)}
|
|
/>
|
|
<span className={`${baseClass}__control`} />
|
|
</span>
|
|
<span className={`${baseClass}__label`}>
|
|
{tooltip ? (
|
|
<TooltipWrapper tipContent={tooltip}>{label}</TooltipWrapper>
|
|
) : (
|
|
<>{label}</>
|
|
)}
|
|
</span>
|
|
</label>
|
|
);
|
|
};
|
|
|
|
export default Radio;
|