• Stars
    star
    168
  • Rank 217,614 (Top 5 %)
  • Language
    TypeScript
  • License
    MIT License
  • Created about 4 years ago
  • Updated over 2 years ago

Reviews

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

Repository Details

A react lib for building circular menus in a very easy and handy way.

react-planet

Version Downloads

A react lib for building circular menus in a very easy and handy way.

Live-Demo: STORYBOOK

Read the full story @ Medium or innFactory-Blog

install

npm install --save react-planet

Concept

Basic Example

import { Planet } from 'react-planet';

export function MyPlanet() {
	return (
		<Planet
			centerContent={
				<div
					style={{
						height: 100,
						width: 100,
						borderRadius: '50%',
						backgroundColor: '#1da8a4',
					}}
				/>
			}
			open
			autoClose
		>
			<div
				style={{
					height: 70,
					width: 70,
					borderRadius: '50%',
					backgroundColor: '#9257ad',
				}}
			/>
			<div
				style={{
					height: 70,
					width: 70,
					borderRadius: '50%',
					backgroundColor: '#9257ad',
				}}
			/>
		</Planet>
	);
}

Change the orbit

<Planet centerContent={div style={...yourStlye}/>}
        open
        orbitRadius={120}
        rotation={30}
        ...
>

Orbit Style

<Planet
	orbitStyle={(defaultStyle) => ({
		...defaultStyle,
		borderWidth: 4,
		borderStyle: 'dashed',
		borderColor: '#6f03fc',
	})}
	centerContent={<div className={classes.planetSmall} />}
	open
>
	<div className={classes.satellite1} />
	<div className={classes.satellite2} />
	<div className={classes.satellite3} />
</Planet>

Weird satellites and their orientation

<Planet
    // set one of the orientations
    satelliteOrientation="INSIDE"

Bring it to life

<Planet
    dragablePlanet
    dragRadiusPlanet={20}
    bounce

Planetception

Nested planets

Code: /src/stories/Planetception.stories.tsx

Fake the space

<Planet
	centerContent={<YourButton0 />}
	hideOrbit
	autoClose
	orbitRadius={60}
	bounceOnClose
	rotation={105}
	// the bounce direction is minimal visible
	// but on close it seems the button wobbling a bit to the bottom
	bounceDirection="BOTTOM"
>
	<YourButton1 />
	<YourButton2 />
	<YourButton3 />
	<div />
	<div />
	<div />
	<div />
</Planet>

Alter the physics

<Planet
      mass={4}
      tension={500}
      friction={19}

Props

name type example /default description
centerContent React.Node?
The planet component
orbitRadius number? 120 How far the satellites are away from the planet
open boolean? false Set the open/close state from outside
autoClose boolean? false If true the planet handles the open/close state by itself
hideOrbit boolean? false If true the orbit is hidden / not rendered
rotation number? 0 The angle for the rotation of all satellites around the planet
satelliteOrientation DEFAULT INSIDE OUTSIDE READABLE undefined / DEFAULT The angle for the rotation of one satellite itself
dragableSatellites boolean? false If true you can click and drag a satellite
dragRadiusSatellites number? 12 Defines how much you can drag the satellites
dragablePlanet boolean? false If true you can click and drag the planet
dragRadiusPlanet number? 12 Defines how much you can drag the planet
bounce boolean? false If true the planet bounces on open and close
bounceOnOpen boolean? false If true the planet bounces only on open
bounceOnClose boolean? false If true the planet bounces only on close
bounceRadius number? 3 Defines how much the planet bounces
bounceDirection TOP BOTTOM LEFT RIGHT undefined On hight bounceRadius you can see a direction
tension number? 500 a react-spring animation physic value
friction number? 17 a react-spring animation physic value
mass number? 1 a react-spring animation physic value
orbitStyle (default: CSSProperties)=>CSSProperties () => ({borderWidth: 4}) You can override or set a new style for the orbit
onClick (e: MouseEvent)=>void ()=>{} The function is triggered if you click on the centerComponent
onClose (e: MouseEvent)=>void ()=>{} The function is triggered if the planet wants to close

Start Storybook local

npm install
npm start

Made by:


https://innFactory.de/

More Repositories

1

create-react-app-material-typescript-redux

A ready to use boilerplate for starting big react projects
TypeScript
288
star
2

react-native-dialogflow

A React-Native Bridge for the Google Dialogflow (API.AI) SDK
JavaScript
196
star
3

JFXC

Jonato JavaFX Controls - More Power for your JavaFX Gui
Java
43
star
4

react-native-quick-sample

A small and simple example app with navigation, data persistence, listview and animation!
JavaScript
34
star
5

bootstrap-akka-http.g8

bootstrap template for akka-http, slick, swagger, aws service
Scala
20
star
6

akka-persistence-gcp-datastore

akka-persistence-gcp-datastore is a journal and snapshot store plugin for akka-persistence using google cloud firestore in datastore mode.
Scala
19
star
7

bootstrap-akka-graphql.g8

g8 bootstrap template for akka microservices with an graphql endpoint
Scala
18
star
8

akka-microservice-example

Kubernetes Deployment of two separate akka microservices which communicate via gRPC
Scala
17
star
9

react-native-aws-mobile-analytics

A react-native module for using Amazon's AWS Mobile Analytics with the aws-sdk
JavaScript
16
star
10

akka-jwt

Library for jwt authentication with akka
Scala
16
star
11

bootstrap-play2

A scala bootstrap template for the play 2 framework to build real world applications.
Scala
14
star
12

akka-lift-ml

akka http service for serving spark machine learning models
Scala
14
star
13

smithy4play

smithy4s Routing for Play Framework.
Scala
14
star
14

bootstrap-akka-http

bootstrap template for akka-http services
Scala
14
star
15

react-native-aws-mobile-analytics-demo

Demo React-Native app which uses react-native-aws-mobile-analytics
Objective-C
13
star
16

react-typesafe-routes

The last routing library you will ever need in your React projects. (At least if you're using react-router–dom but also why wouldn't you?)
TypeScript
13
star
17

material-ui-recoil-template

A ready to use boilerplate for starting [experimental] react projects
TypeScript
11
star
18

bootstrap-akka-graphql

bootstrap template for akka microservices with an graphql endpoint
Scala
11
star
19

aws-codepipeline-dashboard

A simple dashboard for monitoring your aws codepipelines.
TypeScript
10
star
20

aws-session-token-gui

Get a Amazon Web Service Token via desktop GUI
JavaScript
10
star
21

flutter-factory

CLI tool for creating a new Flutter project and other useful features.
TypeScript
9
star
22

akka-cluster-k8s

Deployment of an akka cluster on AWS/Google Kubernetes [EXAMPLE]
Scala
8
star
23

corsign-core

Scala
8
star
24

react-factory

TypeScript
7
star
25

react-starting-guide

This is an instruction to react and related technics. Please go through it and prepare yourself for programming react! Have fun!
7
star
26

scalafx-yaml-editor

This is a ScalaFX demo that contains an simple YAML editor with syntax highlighting and a search function.
Scala
7
star
27

docker

Usefull docker templates for our software projects
Dockerfile
6
star
28

bootstrap-aws-serverless

TypeScript
6
star
29

flutter-starting-guide

5
star
30

flutter_bloc_demo

A small app for demonstrating the usage of the BloC Pattern.
Dart
5
star
31

flutter-factory-templates

Dart
4
star
32

react-template

A ready to use boilerplate for starting big react projects
TypeScript
4
star
33

react-firebase-auth-example

A demo which shows how to implement the firebase authentication mechanism in react
TypeScript
3
star
34

scala-utils

Reusable scala utils for awesome innFactory projects.
Scala
2
star
35

react-mui-table-container

Enhancement of mui-virtualized-table with search and actions
TypeScript
2
star
36

plantuml-ifstyle

innFactory PlantUML Styling
2
star
37

react-mui-cookie-dialog

A cookie dialog in react based on material-ui.
TypeScript
2
star
38

flutter_lint_factory

Dart
2
star
39

flutter-todo-starter

Flutter Template for starting new projects. It includes a Flutter app with offline sync and a Scala backend.
Dart
1
star
40

akka-persistence-gcp-datastore-example

Datastore Tests for akka-persistence-gcp-datastore
Scala
1
star
41

smithy4play-example

Smithy Example based on Play2 with smithy4play
Scala
1
star
42

react-chuck-norris

Starting point for employee onboarding as well as new production projects
TypeScript
1
star
43

akka-typed-event-sourcing-example

Akka Typed Event Sourcing Example Applikation
Scala
1
star