mirror of
https://github.com/plankanban/planka.git
synced 2025-08-09 23:45:31 +02:00
copy-button-added
This commit is contained in:
parent
9108dc5b3e
commit
f06a99e581
1 changed files with 11 additions and 7 deletions
|
@ -3,17 +3,14 @@ import PropTypes from 'prop-types';
|
|||
import classNames from 'classnames';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import TextareaAutosize from 'react-textarea-autosize';
|
||||
import { Button, Form, TextArea } from 'semantic-ui-react';
|
||||
import { Button, Form, TextArea, Icon } from 'semantic-ui-react';
|
||||
import { useDidUpdate, useToggle } from '../../lib/hooks';
|
||||
|
||||
import { useClosableForm, useForm } from '../../hooks';
|
||||
|
||||
import styles from './CardAdd.module.scss';
|
||||
|
||||
const DEFAULT_DATA = {
|
||||
name: '',
|
||||
};
|
||||
|
||||
const CardAdd = React.memo(({ isOpened, onCreate, onClose }) => {
|
||||
const [t] = useTranslation();
|
||||
const [data, handleFieldChange, setData] = useForm(DEFAULT_DATA);
|
||||
|
@ -62,17 +59,17 @@ const CardAdd = React.memo(({ isOpened, onCreate, onClose }) => {
|
|||
const handleSubmit = useCallback(() => {
|
||||
submit();
|
||||
}, [submit]);
|
||||
|
||||
useEffect(() => {
|
||||
if (isOpened) {
|
||||
nameField.current.ref.current.focus();
|
||||
}
|
||||
}, [isOpened]);
|
||||
|
||||
useDidUpdate(() => {
|
||||
nameField.current.ref.current.focus();
|
||||
}, [focusNameFieldState]);
|
||||
|
||||
const copyfun = () => {
|
||||
navigator.clipboard.writeText(data.name);
|
||||
};
|
||||
return (
|
||||
<Form
|
||||
className={classNames(styles.wrapper, !isOpened && styles.wrapperClosed)}
|
||||
|
@ -94,6 +91,13 @@ const CardAdd = React.memo(({ isOpened, onCreate, onClose }) => {
|
|||
/>
|
||||
</div>
|
||||
<div className={styles.controls}>
|
||||
<Button
|
||||
onClick={copyfun}
|
||||
onMouseOver={handleControlMouseOver}
|
||||
onMouseOut={handleControlMouseOut}
|
||||
>
|
||||
<Icon fitted name="copy" size="small" />
|
||||
</Button>
|
||||
{/* eslint-disable-next-line jsx-a11y/mouse-events-have-key-events */}
|
||||
<Button
|
||||
positive
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue