import React, { useState } from 'react'; import classNames from 'classnames'; import Slider from 'rc-slider'; import { SessionToggle } from '../SessionToggle'; import { SessionButton } from '../SessionButton'; import { SessionSettingType } from './SessionSettings'; import { SessionRadioGroup } from '../SessionRadioGroup'; import { SessionConfirmDialogProps } from '../SessionConfirm'; type Props = { title?: string; description?: string; type: SessionSettingType | undefined; value: any; options?: Array; onClick?: any; onSliderChange?: any; content: any; confirmationDialogParams?: SessionConfirmDialogProps; }; export const SessionSettingListItem = (props: Props) => { const handleSlider = (valueToForward: any) => { if (props.onSliderChange) { props.onSliderChange(valueToForward); } setSliderValue(valueToForward); }; const [sliderValue, setSliderValue] = useState(null); const { title, description, type, value, content } = props; const inline = !!type && ![SessionSettingType.Options, SessionSettingType.Slider].includes(type); const currentSliderValue = type === SessionSettingType.Slider && (sliderValue || value); return (
{title}
{description &&
{description}
}
{type === SessionSettingType.Toggle && (
props.onClick?.()} confirmationDialogParams={props.confirmationDialogParams} />
)} {type === SessionSettingType.Button && ( props.onClick?.()} /> )} {type === SessionSettingType.Options && ( { props.onClick(selectedRadioValue); }} /> )} {type === SessionSettingType.Slider && (

{content.info(currentSliderValue)}

)}
); };