New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

kanban-board-react

Package Overview
Dependencies
Maintainers
1
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

kanban-board-react

A simple kanban board for React with zero dependencies

  • 1.0.26
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

Kanban Board React

A simple package for creating columns and items. Items can be dragged and dropped into columns. The package uses zero dependencies.

Usage


const tasksData: any[] = [
  { t: "test", navn: "navn", dataKey: "todo", id: 1 },
  { t: "test", navn: "navn", dataKey: "todo", id: 2 },
  { t: "test", navn: "navn", dataKey: "todo", id: 3 },
  { t: "test", navn: "navn", dataKey: "todo", id: 4 },
];

const columnsData: any[] = [
  { name: "Todo", dataKey: "todo" },
  { name: "Doing", dataKey: "doing" },
  { name: "QA", dataKey: "qa" },
  { name: "Completed", dataKey: "complete" },
];

function App() {
  const [items, setItems] = useState<any[]>(tasksData);

  const updateTask = (collisionResult: any) => {
    const index = items.findIndex((item) => item.id === collisionResult.task.id);
    items[index].dataKey = collisionResult.columnDataKey;
    const newArray = [...items];
    setItems(newArray);
  };

  return (
    <div>
      <div className="App">
        <Kanban
          updateTask={updateTask}
          tasks={items}
          columns={columnsData}
          onTopOfColumnStyle={collisionStyle}
          laneStyle={defaultLaneStyle}
          taskRender={(task: any) => {
            return <Item task={task} />;
          }}
        />
      </div>
    </div>
  );
}

const collisionStyle: React.CSSProperties = {
  backgroundColor: "rgba(0, 0, 0, 0.1)",
  transition: "background-color 300ms ease",
};

const defaultLaneStyle: React.CSSProperties = {
  backgroundColor: "red",
  display: "flex",
  flexDirection: "column",
  alignItems: "center",
  height: "100vh",
  width: "100%",
  overflowX: "hidden",
};

const Item = ({ task }: { task: any }) => {
  return (
    <div className="item" style={{ width: "250px" }}>
      <span style={{ color: "red" }}>HEI</span>
      <div className="id">#{task.id}</div>
      <div className="test">
        <div className="taskTitle">{task.id}</div>
        <div>{task.navn}</div>
      </div>
    </div>
  );
};

export default App;

Props:

tasks

An array of objects. Each object must contain a key kalled dataKey (this key must also be present in the column dataset)

columns

An array of objects. Must contain a name key for the column name and a dataKey (this dataKey matches the task dataKey)

onTopOfColumnStyle

A style object for styles when a task is dragged over a column.

laneStyle

A style object for the lane styles.

updateTask

A function that will be run when a task is dropped on top of a lane. The fuction is run with a parameter containing the task and the columnDataKey. result.task result.columnDataKey

taskRender

A function that retuns a jsx element. The function gets passed the task.

Keywords

FAQs

Package last updated on 12 Oct 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc