import React from 'react'; import { SECRET_LINK_OPTION_HELP_TEXT } from '~/consts/secrets'; import { RadioGroupField } from '~/shared/components/formik-base'; import { CurrentComponentRef } from '~/types'; import { SecretForComponentOption } from '~/utils/secrets/secret-utils'; import HelpPopover from '../../HelpPopover'; import { ComponentSelector } from './ComponentSelector'; import './SecretLinkOptionForm.scss'; type SecretLinkOptionsProps = { secretForComponentOption: SecretForComponentOption; onOptionChange: (option: SecretForComponentOption) => void; radioLabels: { none?: string; all: string; partial: string; }; currentComponent?: null | CurrentComponentRef; }; export const SecretLinkOptions: React.FC = ({ secretForComponentOption, onOptionChange, radioLabels, currentComponent, }) => { return ( <> Link secret options } options={[ ...(radioLabels.none ? [ { value: SecretForComponentOption.none, label: radioLabels.none, }, ] : []), { value: SecretForComponentOption.all, label: radioLabels.all, }, { value: SecretForComponentOption.partial, label: radioLabels.partial, }, ]} required={false} onChange={(value) => onOptionChange(value as SecretForComponentOption)} /> {/* Secret Component Dropdown */} {secretForComponentOption === SecretForComponentOption.partial && ( )} ); };