// Copyright 2017-2020 @polkadot/app-js authors & contributors // This software may be modified and distributed under the terms // of the Apache-2.0 license. See the LICENSE file for details. import { BareProps, I18nProps } from '@polkadot/react-components/types'; import React, { useState } from 'react'; import styled from 'styled-components'; import { Button as SUIB, Popup } from 'semantic-ui-react'; import { Button, Input } from '@polkadot/react-components'; import translate from './translate'; interface Props extends BareProps, I18nProps { isCustomExample: boolean; isRunning: boolean; generateLink: () => void; removeSnippet: () => void; runJs: () => void; saveSnippet: (snippetName: string) => void; snippetName?: string; stopJs: () => void; } function ActionButtons ({ className, generateLink, isCustomExample, isRunning, removeSnippet, runJs, saveSnippet, stopJs, t }: Props): React.ReactElement { const [isOpen, setIsOpen] = useState(false); const [shareText, setShareText] = useState(t('Generate link to share code example')); const [snippetName, setSnippetName] = useState(''); const _generateLink = (): void => { setShareText(t('Copied to clipboard')); generateLink(); }; const _onShareClose = (): void => { setShareText(t('Generate link to share code example')); }; const _onChangeName = (snippetName: string): void => { setSnippetName(snippetName); }; const _onPopupOpen = (): void => { setIsOpen(true); }; const _onPopupClose = (): void => { setSnippetName(''); setIsOpen(false); }; const _saveSnippet = (): void => { saveSnippet(snippetName); _onPopupClose(); }; return (
} wide='very' /> { // FIXME: The event trigger on='hover' does not work together with the ui-app' //
); } export default translate( styled(ActionButtons)`` );