1
0
Fork 0
mirror of https://github.com/plankanban/planka.git synced 2025-08-09 07:25:24 +02:00

copy-button-added

This commit is contained in:
Riya123-code 2022-11-30 16:14:34 +05:30
parent 9108dc5b3e
commit f06a99e581

View file

@ -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