• This repository has been archived on 10/Jul/2024
  • Stars
    star
    422
  • Rank 102,753 (Top 3 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created over 7 years ago
  • Updated over 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

React component for MindNode maps

React Mindmap [UNMAINTAINED]

React component for MindNode maps (or other mindmaps)

This project is no longer maintained. The component is still usable, but if you find any problem or if you want to improve it, please fork it.

Install

npm install react-mindmap --save

Usage

import { Component } from "react";
import { render } from "react-dom";
import MindMap from "react-mindmap";
import { nodes, connections } from "./my-map.json";

class Example extends Component {
  render() {
    return (
      <MindMap nodes={this.props.nodes} connections={this.props.connections} />
    );
  }
}

render(
  <Example nodes={nodes} connections={connections} />,
  document.getElementById("target")
);

img

Testing

To test this repository run these commands

git clone https://github.com/learn-anything/react-mindmap
cd react-mindmap
npm install && npm run test

and connect to http://localhost:3000/

Parser

This repo also has a parser that automates the conversion of JSON maps from MindNode to the format used by this component. To use it run:

npm run parse path/to/mindnode/maps path/to/converted/maps

Props

Prop Type Default Description
nodes Array [] Array of objects used to render nodes.
connections Array [] Array of objects used to render connections.
subnodes Array [] Array of objects used to render subnodes.
editable Boolean false Enable editor mode, which allows to move around nodes.

nodes

Array of objects used to render nodes. Below an example of the node structure.

{
  "text": "python",
  "url": "http://www.wikiwand.com/en/Python_(programming_language)",
  "fx": -13.916222252976013,
  "fy": -659.1641376795345,
  "category": "wiki",
  "note": ""
}

The possible attributes are:

  • text: title of the node
  • url: url contained in the node
  • fx and fy: coordinates (if not present they'll be generated)
  • category: category used to generate an emoji
  • note: note that will be visible on hover

connections

Array of objects used to render connections. Below an example of the connection structure.

{
  "source": "python",
  "target": "basics",
  "curve": {
    "x": -43.5535,
    "y": 299.545
  }
}

The possible attributes are:

  • source: title of the node where the connection starts
  • target: title of the node where the connection ends
  • curve.x and curve.y: coordinates of the control point of a quadratic bezier curve (if not specified the connection will be straight)

subnodes

Array of objects used to render subnodes. The structure is the same as for nodes with two additional attributes:

  • parent: title of the parent node
  • color: used for the margin color, needs to be a valid CSS color

Styling

Here's a list of all CSS classes for styling:

  • .mindmap-svg: main svg element containing the map;
  • .mindmap-node: foreignObject element representing a node;
  • .mindmap-node--editable: foreignObject element representing a node in editor mode;
  • .mindmap-subnode-group-text: foreignObject element containing all subnodes of a given node;
  • .mindmap-subnode-text: div element containing a subnode;
  • .mindmap-connection: path element for each connection;
  • .mindmap-emoji: img tag for emoji

More Repositories

1

learn-anything.xyz

Organize world's knowledge, explore connections and curate learning paths
TypeScript
15,963
star
2

books

Awesome Books
5,801
star
3

alfred-workflows

Amazing Alfred Workflows
2,663
star
4

courses

Awesome Courses
1,079
star
5

curated-lists

Curated lists on various topics
867
star
6

macos-apps

Awesome macOS apps
779
star
7

blogs

Awesome Blogs
515
star
8

chrome-extensions

Awesome Chrome Extensions
417
star
9

command-line-tools

Awesome Command Line Utilities
410
star
10

safari-extensions

Awesome Safari extensions
348
star
11

research-papers

Awesome Research Papers
293
star
12

programming-languages

Awesome Programming Languages
282
star
13

websites

Awesome Websites
205
star
14

reddit

Awesome Reddit subreddits
164
star
15

youtube

Awesome YouTube channels
151
star
16

ios-apps

Awesome iOS apps
101
star
17

podcasts

Awesome Podcasts
82
star
18

newsletters

Awesome Newsletters
73
star
19

documentaries

Awesome Documentaries
65
star
20

humans

Awesome Humans
57
star
21

telegram-groups

Awesome Telegram Groups
55
star
22

cheat-sheets

Awesome Cheat Sheets
52
star
23

firefox-extensions

Awesome Firefox Extensions
51
star
24

quotes

Awesome Quotes
45
star
25

slack-groups

Awesome Slack Groups
38
star
26

movies

Awesome Movies
37
star
27

tv-series

Awesome TV Series
36
star
28

forums

Awesome Forums
33
star
29

quora

Awesome Quora Topics
31
star
30

talks

Awesome Talks
29
star
31

tasks

Tasks as HTTP endpoints
Jupyter Notebook
27
star
32

stack-exchange

Awesome Stack Exchange Communities
26
star
33

2017-release

Old version of Learn Anything
JavaScript
23
star
34

games

Awesome Games
22
star
35

events

Awesome events
16
star
36

docs

TypeScript
10
star
37

la-editor

TypeScript
8
star
38

spectrum

Awesome Spectrum Communities
7
star
39

rust

Rust crates for learn-anything
Rust
7
star
40

explore

Trying things
TypeScript
7
star
41

mobile-expo

Mobile app using Expo
TypeScript
6
star
42

old-learn-anything.xyz

TypeScript
4
star
43

solid

Using Solid code
TypeScript
2
star
44

solana

Solana Programs
TypeScript
2
star
45

buy-in-next

TypeScript
2
star
46

trieve-flake

Nix flake for https://trieve.ai/
Nix
1
star