|
|
@@ -1,23 +1,22 @@ |
|
|
|
import Task from "../types/Task"; |
|
|
|
import React from 'react'; |
|
|
|
type KBColumnProps = { |
|
|
|
color?: string; |
|
|
|
title?: string; |
|
|
|
color: string; |
|
|
|
title: string; |
|
|
|
tasks: Task[]; |
|
|
|
id: number; |
|
|
|
onDelete?: (id: number) => void; |
|
|
|
}; |
|
|
|
const defaultProps: KBColumnProps = { |
|
|
|
color: "#404552", |
|
|
|
title: "waah", |
|
|
|
tasks: [], |
|
|
|
id: -1, |
|
|
|
onDelete: (id: number) => {}, |
|
|
|
}; |
|
|
|
let bgc = "#666"; |
|
|
|
const KBColumn = (props: KBColumnProps) => { |
|
|
|
const { color, title, tasks, onDelete, id } = { ...defaultProps, ...props }; |
|
|
|
|
|
|
|
let colTasks = tasks.map((task) => { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let bgc = "hotpink"; |
|
|
|
class KBColumn extends React.Component<KBColumnProps> { |
|
|
|
|
|
|
|
|
|
|
|
getTaskRender = () =>{ |
|
|
|
return this.props.tasks.map((task) => { |
|
|
|
if (task.priority === "urgent") { |
|
|
|
bgc = "red"; |
|
|
|
} else if (task.priority === "important") { |
|
|
@@ -25,7 +24,8 @@ const KBColumn = (props: KBColumnProps) => { |
|
|
|
} else if (task.priority === "normal") { |
|
|
|
bgc = "blue"; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
<div |
|
|
|
style={{ |
|
|
@@ -49,19 +49,23 @@ const KBColumn = (props: KBColumnProps) => { |
|
|
|
</div> |
|
|
|
); |
|
|
|
}); |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
render() { |
|
|
|
return ( |
|
|
|
<div className="KBColumn" style={{ backgroundColor: color }}> |
|
|
|
<h3>{title}</h3> |
|
|
|
{colTasks} |
|
|
|
<div className="KBColumn" style={{ backgroundColor: this.props.color }}> |
|
|
|
<h3>{this.props.title} </h3> |
|
|
|
{this.getTaskRender()} |
|
|
|
<button |
|
|
|
onClick={() => { |
|
|
|
onDelete && onDelete(id); |
|
|
|
this.props.onDelete && this.props.onDelete(this.props.id); |
|
|
|
}} |
|
|
|
> |
|
|
|
Deleete |
|
|
|
Delete |
|
|
|
</button> |
|
|
|
</div> |
|
|
|
); |
|
|
|
}; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
export default KBColumn; |