Path: blob/develop/resources/scripts/components/dashboard/ApiKeyModal.tsx
7428 views
import { useContext } from 'react';1import tw from 'twin.macro';2import Button from '@/components/elements/Button';3import asModal from '@/hoc/asModal';4import ModalContext from '@/context/ModalContext';5import CopyOnClick from '@/components/elements/CopyOnClick';67interface Props {8apiKey: string;9}1011const ApiKeyModal = ({ apiKey }: Props) => {12const { dismiss } = useContext(ModalContext);1314return (15<>16<h3 css={tw`mb-6 text-2xl`}>Your API Key</h3>17<p css={tw`text-sm mb-6`}>18The API key you have requested is shown below. Please store this in a safe location, it will not be19shown again.20</p>21<pre css={tw`text-sm bg-neutral-900 rounded py-2 px-4 font-mono`}>22<CopyOnClick text={apiKey}>23<code css={tw`font-mono`}>{apiKey}</code>24</CopyOnClick>25</pre>26<div css={tw`flex justify-end mt-6`}>27<Button type={'button'} onClick={() => dismiss()}>28Close29</Button>30</div>31</>32);33};3435ApiKeyModal.displayName = 'ApiKeyModal';3637export default asModal<Props>({38closeOnEscape: false,39closeOnBackground: false,40})(ApiKeyModal);414243