import React, { useState, useRef } from 'react'; import PropTypes from 'prop-types'; import { useI18nContext } from '../../../hooks/useI18nContext'; import { AlignItems, DISPLAY, BorderColor, BLOCK_SIZES, FLEX_DIRECTION, } from '../../../helpers/constants/design-system'; import { Text } from '../../component-library'; import JwtDropdown from '../jwt-dropdown'; import Button from '../../ui/button'; import Box from '../../ui/box'; const JwtUrlForm = (props) => { const t = useI18nContext(); const inputRef = useRef(); const [addNewTokenClicked, setAddNewTokenClicked] = useState(false); const [fileTooBigError, setFileTooBigError] = useState(); const renderJWTInput = () => { const showAddNewToken = addNewTokenClicked; const showJwtDropdown = props.jwtList.length >= 1; return ( {showJwtDropdown && ( { props.onJwtChange(value); setFileTooBigError(false); }} /> )} {showJwtDropdown && !showAddNewToken && ( {t('or')} )} {(!showJwtDropdown || showAddNewToken) && ( {props.jwtInputText} {fileTooBigError && ( {t('fileTooBig')} )}