Prepare for collection board type, refactoring, update dependencies
This commit is contained in:
@@ -8,13 +8,13 @@ import { useDidUpdate, useToggle } from '../../lib/hooks';
|
||||
|
||||
import { useClosableForm, useForm } from '../../hooks';
|
||||
|
||||
import styles from './AddCard.module.scss';
|
||||
import styles from './CardAdd.module.scss';
|
||||
|
||||
const DEFAULT_DATA = {
|
||||
name: '',
|
||||
};
|
||||
|
||||
const AddCard = React.memo(({ isOpened, onCreate, onClose }) => {
|
||||
const CardAdd = React.memo(({ isOpened, onCreate, onClose }) => {
|
||||
const [t] = useTranslation();
|
||||
const [data, handleFieldChange, setData] = useForm(DEFAULT_DATA);
|
||||
const [selectNameFieldState, selectNameField] = useToggle();
|
||||
@@ -107,10 +107,10 @@ const AddCard = React.memo(({ isOpened, onCreate, onClose }) => {
|
||||
);
|
||||
});
|
||||
|
||||
AddCard.propTypes = {
|
||||
CardAdd.propTypes = {
|
||||
isOpened: PropTypes.bool.isRequired,
|
||||
onCreate: PropTypes.func.isRequired,
|
||||
onClose: PropTypes.func.isRequired,
|
||||
};
|
||||
|
||||
export default AddCard;
|
||||
export default CardAdd;
|
||||
@@ -7,8 +7,8 @@ import { Button, Icon } from 'semantic-ui-react';
|
||||
|
||||
import DroppableTypes from '../../constants/DroppableTypes';
|
||||
import CardContainer from '../../containers/CardContainer';
|
||||
import EditName from './EditName';
|
||||
import AddCard from './AddCard';
|
||||
import NameEdit from './NameEdit';
|
||||
import CardAdd from './CardAdd';
|
||||
import ActionsPopup from './ActionsPopup';
|
||||
import { ReactComponent as PlusMathIcon } from '../../assets/images/plus-math-icon.svg';
|
||||
|
||||
@@ -19,12 +19,12 @@ const List = React.memo(
|
||||
const [t] = useTranslation();
|
||||
const [isAddCardOpened, setIsAddCardOpened] = useState(false);
|
||||
|
||||
const editName = useRef(null);
|
||||
const nameEdit = useRef(null);
|
||||
const listWrapper = useRef(null);
|
||||
|
||||
const handleHeaderClick = useCallback(() => {
|
||||
if (isPersisted) {
|
||||
editName.current.open();
|
||||
nameEdit.current.open();
|
||||
}
|
||||
}, [isPersisted]);
|
||||
|
||||
@@ -46,7 +46,7 @@ const List = React.memo(
|
||||
}, []);
|
||||
|
||||
const handleNameEdit = useCallback(() => {
|
||||
editName.current.open();
|
||||
nameEdit.current.open();
|
||||
}, []);
|
||||
|
||||
const handleCardAdd = useCallback(() => {
|
||||
@@ -73,7 +73,7 @@ const List = React.memo(
|
||||
<CardContainer key={cardId} id={cardId} index={cardIndex} />
|
||||
))}
|
||||
{placeholder}
|
||||
<AddCard
|
||||
<CardAdd
|
||||
isOpened={isAddCardOpened}
|
||||
onCreate={onCardCreate}
|
||||
onClose={handleAddCardClose}
|
||||
@@ -96,9 +96,9 @@ const List = React.memo(
|
||||
{/* eslint-enable jsx-a11y/click-events-have-key-events,
|
||||
jsx-a11y/no-static-element-interactions,
|
||||
react/jsx-props-no-spreading */}
|
||||
<EditName ref={editName} defaultValue={name} onUpdate={handleNameUpdate}>
|
||||
<NameEdit ref={nameEdit} defaultValue={name} onUpdate={handleNameUpdate}>
|
||||
<div className={styles.headerName}>{name}</div>
|
||||
</EditName>
|
||||
</NameEdit>
|
||||
{isPersisted && (
|
||||
<ActionsPopup
|
||||
onNameEdit={handleNameEdit}
|
||||
|
||||
@@ -5,9 +5,9 @@ import { TextArea } from 'semantic-ui-react';
|
||||
|
||||
import { useField } from '../../hooks';
|
||||
|
||||
import styles from './EditName.module.scss';
|
||||
import styles from './NameEdit.module.scss';
|
||||
|
||||
const EditName = React.forwardRef(({ children, defaultValue, onUpdate }, ref) => {
|
||||
const NameEdit = React.forwardRef(({ children, defaultValue, onUpdate }, ref) => {
|
||||
const [isOpened, setIsOpened] = useState(false);
|
||||
const [value, handleFieldChange, setValue] = useField(defaultValue);
|
||||
|
||||
@@ -94,10 +94,10 @@ const EditName = React.forwardRef(({ children, defaultValue, onUpdate }, ref) =>
|
||||
);
|
||||
});
|
||||
|
||||
EditName.propTypes = {
|
||||
NameEdit.propTypes = {
|
||||
children: PropTypes.element.isRequired,
|
||||
defaultValue: PropTypes.string.isRequired,
|
||||
onUpdate: PropTypes.func.isRequired,
|
||||
};
|
||||
|
||||
export default React.memo(EditName);
|
||||
export default React.memo(NameEdit);
|
||||
Reference in New Issue
Block a user