// Copyright 2017-2021 @polkadot/react-components authors & contributors // SPDX-License-Identifier: Apache-2.0 import React, { useCallback } from 'react'; import styled from 'styled-components'; import { Button } from '@polkadot/react-components'; interface Props { className?: string; onChange: (index: number) => void; options: { isDisabled?: boolean, text: string, value: number }[]; value: number; } interface ToggleProps { index: number; isDisabled?: boolean; isSelected: boolean; onChange: (index: number) => void; text: string; } function ToggleIndex ({ index, isDisabled, isSelected, onChange, text }: ToggleProps): React.ReactElement { const _onClick = useCallback( (): void => { !isDisabled && onChange(index); }, [isDisabled, index, onChange] ); return (