- Performance / bug fixes / massive deleting of react-trello files we are not using.
Signed-off-by: Dave Richer <dave@imexsystems.ca>
This commit is contained in:
@@ -1,112 +0,0 @@
|
||||
import React, { useCallback } from "react";
|
||||
import PropTypes from "prop-types";
|
||||
|
||||
import { CardHeader, CardRightContent, CardTitle, Detail, Footer, MovableCardWrapper } from "../styles/Base";
|
||||
import InlineInput from "../widgets/InlineInput.jsx";
|
||||
import Tag from "./Card/Tag.jsx";
|
||||
import DeleteButton from "../widgets/DeleteButton.jsx";
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
const Card = ({
|
||||
showDeleteButton = true,
|
||||
onDelete = () => {},
|
||||
onClick = () => {},
|
||||
style = {},
|
||||
tagStyle = {},
|
||||
className = "",
|
||||
id,
|
||||
title = "no title",
|
||||
label = "",
|
||||
description = "",
|
||||
tags = [],
|
||||
cardDraggable,
|
||||
editable,
|
||||
onChange
|
||||
}) => {
|
||||
const { t } = useTranslation();
|
||||
|
||||
const handleDelete = useCallback(
|
||||
(e) => {
|
||||
onDelete();
|
||||
e.stopPropagation();
|
||||
},
|
||||
[onDelete]
|
||||
);
|
||||
|
||||
const updateCard = (card) => {
|
||||
onChange({ ...card, id });
|
||||
};
|
||||
|
||||
return (
|
||||
<MovableCardWrapper data-id={id} onClick={onClick} style={style} className={className}>
|
||||
<CardHeader>
|
||||
<CardTitle draggable={cardDraggable}>
|
||||
{editable ? (
|
||||
<InlineInput
|
||||
value={title}
|
||||
border
|
||||
placeholder={t("trello.labels.title")}
|
||||
resize="vertical"
|
||||
onSave={(value) => updateCard({ title: value })}
|
||||
/>
|
||||
) : (
|
||||
title
|
||||
)}
|
||||
</CardTitle>
|
||||
<CardRightContent>
|
||||
{editable ? (
|
||||
<InlineInput
|
||||
value={label}
|
||||
border
|
||||
placeholder={t("trello.labels.label")}
|
||||
resize="vertical"
|
||||
onSave={(value) => updateCard({ label: value })}
|
||||
/>
|
||||
) : (
|
||||
label
|
||||
)}
|
||||
</CardRightContent>
|
||||
{showDeleteButton && <DeleteButton onClick={handleDelete} />}
|
||||
</CardHeader>
|
||||
<Detail>
|
||||
{editable ? (
|
||||
<InlineInput
|
||||
value={description}
|
||||
border
|
||||
placeholder={t("trello.labels.description")}
|
||||
resize="vertical"
|
||||
onSave={(value) => updateCard({ description: value })}
|
||||
/>
|
||||
) : (
|
||||
description
|
||||
)}
|
||||
</Detail>
|
||||
{tags && tags.length > 0 && (
|
||||
<Footer>
|
||||
{tags.map((tag) => (
|
||||
<Tag key={tag.title} {...tag} tagStyle={tagStyle} />
|
||||
))}
|
||||
</Footer>
|
||||
)}
|
||||
</MovableCardWrapper>
|
||||
);
|
||||
};
|
||||
|
||||
Card.propTypes = {
|
||||
showDeleteButton: PropTypes.bool,
|
||||
onDelete: PropTypes.func,
|
||||
onClick: PropTypes.func,
|
||||
style: PropTypes.object,
|
||||
tagStyle: PropTypes.object,
|
||||
className: PropTypes.string,
|
||||
id: PropTypes.string.isRequired,
|
||||
title: PropTypes.string.isRequired,
|
||||
label: PropTypes.string,
|
||||
description: PropTypes.string,
|
||||
tags: PropTypes.array,
|
||||
cardDraggable: PropTypes.bool,
|
||||
editable: PropTypes.bool,
|
||||
onChange: PropTypes.func.isRequired
|
||||
};
|
||||
|
||||
export default Card;
|
||||
@@ -1,13 +0,0 @@
|
||||
import React from 'react'
|
||||
import {LoaderDiv, LoadingBar} from '../styles/Loader'
|
||||
|
||||
const Loader = () => (
|
||||
<LoaderDiv>
|
||||
<LoadingBar />
|
||||
<LoadingBar />
|
||||
<LoadingBar />
|
||||
<LoadingBar />
|
||||
</LoaderDiv>
|
||||
)
|
||||
|
||||
export default Loader
|
||||
@@ -1,6 +1,4 @@
|
||||
import LaneFooter from "./Lane/LaneFooter";
|
||||
import Card from "./Card";
|
||||
import Loader from "./Loader.jsx";
|
||||
|
||||
import { BoardWrapper, StyleHorizontal, GlobalStyle, StyleVertical, ScrollableLane, Section } from "../styles/Base";
|
||||
|
||||
@@ -9,11 +7,9 @@ const exports = {
|
||||
StyleVertical,
|
||||
GlobalStyle,
|
||||
BoardWrapper,
|
||||
Loader,
|
||||
ScrollableLane,
|
||||
LaneFooter,
|
||||
Section,
|
||||
Card
|
||||
Section
|
||||
};
|
||||
|
||||
export default exports;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { BoardContainer } from "../index";
|
||||
import { useMemo, useState } from "react";
|
||||
import { v1 } from "uuid";
|
||||
import { GlobalStyle } from "../styles/Base.js";
|
||||
|
||||
const Board = ({ id, className, components, orientation, ...additionalProps }) => {
|
||||
const [storeId] = useState(id || v1());
|
||||
@@ -13,7 +14,7 @@ const Board = ({ id, className, components, orientation, ...additionalProps }) =
|
||||
|
||||
return (
|
||||
<>
|
||||
<components.GlobalStyle />
|
||||
<GlobalStyle />
|
||||
<OrientationStyle>
|
||||
<BoardContainer
|
||||
components={components}
|
||||
|
||||
@@ -5,12 +5,10 @@ import Board from "./controllers/Board.jsx";
|
||||
import Lane from "./controllers/Lane.jsx";
|
||||
import DefaultComponents from "./components";
|
||||
|
||||
import widgets from "./widgets/index";
|
||||
|
||||
import { StyleSheetManager } from "styled-components";
|
||||
import isPropValid from "@emotion/is-prop-valid";
|
||||
|
||||
export { BoardContainer, Lane, widgets };
|
||||
export { BoardContainer, Lane };
|
||||
|
||||
export { DefaultComponents as components };
|
||||
|
||||
|
||||
Reference in New Issue
Block a user