All Projects → albinotonnina → React Magic Hat

albinotonnina / React Magic Hat

Licence: apache-2.0
🎩✨Library to implement the Magic Hat technique, blazingly fast 🚀

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to React Magic Hat

React Native Blurhash
🖼️ A library to show colorful blurry placeholders while your content loads.
Stars: ✭ 430 (+44.78%)
Mutual labels:  library, ux
Imageviewer.swift
An easy to use Image Viewer that is inspired by Facebook
Stars: ✭ 1,071 (+260.61%)
Mutual labels:  library, ux
Shiny
Shiny uses your gyroscope to simulate lighting and motion effects on colors. Works on almost every SwiftUI View.
Stars: ✭ 226 (-23.91%)
Mutual labels:  ux, motion
Use Web Animations
😎 🍿 React hook for highly-performant and manipulable animations using Web Animations API.
Stars: ✭ 802 (+170.03%)
Mutual labels:  ux, motion
React Messenger
Chat UX components built with React, inspired by Facebook Messenger
Stars: ✭ 167 (-43.77%)
Mutual labels:  library, ux
Mojs
The motion graphics toolbelt for the web
Stars: ✭ 17,189 (+5687.54%)
Mutual labels:  library, motion
Inkline
Inkline is the customizable Vue.js UI/UX Library designed for creating flawless responsive websites.
Stars: ✭ 606 (+104.04%)
Mutual labels:  library, ux
Jtop
SVG virtual desktop library that lets you build beautiful desktop like user interfaces.
Stars: ✭ 108 (-63.64%)
Mutual labels:  library, ux
Fos
Web Components to turn your web app into a fake operating system
Stars: ✭ 151 (-49.16%)
Mutual labels:  library, ux
Overrideit Sketchplugin
Overrideit is sketch plugin that allow designers to search in overridelist and overrides dropdowns, and with many other features.
Stars: ✭ 113 (-61.95%)
Mutual labels:  library, ux
Permissionsswiftui
A SwiftUI package to beautifully display and handle permissions.
Stars: ✭ 220 (-25.93%)
Mutual labels:  library, ux
Move To Library Sketchplugin
You can now move symbol from your project to any library and re-attach all the symbol instances to this library. also it keep the overrides without any problems and it work with abstract that have libraries not in your local machine
Stars: ✭ 174 (-41.41%)
Mutual labels:  library, ux
ReactZooApp
ReactZooApp
Stars: ✭ 33 (-88.89%)
Mutual labels:  ux, motion
Length.js
📏 JavaScript library for length units conversion.
Stars: ✭ 292 (-1.68%)
Mutual labels:  library
Cppfs
Cross-platform C++ file system library supporting multiple backends
Stars: ✭ 279 (-6.06%)
Mutual labels:  library
Framework7
Full featured HTML framework for building iOS & Android apps
Stars: ✭ 16,560 (+5475.76%)
Mutual labels:  library
Motionia
Motionia is a lightweight simplified on demand animation library!
Stars: ✭ 294 (-1.01%)
Mutual labels:  library
Rapidtables
Super fast list of dicts to pre-formatted tables conversion library for Python 2/3
Stars: ✭ 292 (-1.68%)
Mutual labels:  library
Tooltip Sequence
A simple step by step tooltip helper for any site
Stars: ✭ 287 (-3.37%)
Mutual labels:  ux
React Modern Library Boilerplate
Boilerplate for publishing modern React modules with Rollup
Stars: ✭ 285 (-4.04%)
Mutual labels:  library

Dependency Up-to-dateness Codacy Badge Build Status

React Magic Hat 🎩✨

A kind of UI technique

React implementation of what I call the Magic Hat UI technique [DEMO].

Features

🚀 Blazing fast. 60+ FPS hardware-accelerated CSS transforms, using the FLIP technique. Fluid and performant. Thanks to react-flip-move for that.

🎈Extra light, only 6.5kb and no dependencies.

🧘‍Flexible, stateful or stateless (you get both components) it’s UI-less, you do the layouting and styling.

🎛 Highly configurable, check the API

Table of Contents

Background

The Magic Hat is a technique with the purpose of reducing the the total amount of mental effort that is required to complete a task involving processing of information, in short cognitive load, by limiting the amount of UI on the screen in favour of a runtime like linked list of sequential self sufficient UIs called MUVs (Minimum Usable Views) It's called like this because in a view the user can pick the next thing to put on screen. It’s pretty much it.

Read the article on medium.com

Install

yarn add react-magic-hat

Usage

import YourMagicContainer from 'react-magic-hat'
import ComponentA, {id as CompA} from 'components'
import ComponentB from 'components'

const renderFrame = pageObject => {
  // Please check the renderFrame(pageObject) documentation for all the properties passed to the pageObject.
  const {id, actions, state} = pageObject

  // We get the Component that is going to be rendered, the following is probably the most naive way.
  const Muv = id === CompA ? ComponentA : ComponentB

  // Another way to do it in the demo, using import-glob
  // https://github.com/albinotonnina/demo-magic-hat/blob/master/src/Demo.js#L5-L21

  return <Muv {...actions} {...state} />
}

const Layout = () => (
  <div>
    <YourMagicContainer renderFrame={renderFrame} />
  </div>
)

API

Prop Types

Property Type Required? Arguments Description
renderFrame Function Documentation Callback invoked when rendering the visible pages.
onStartAnimation Function childElements, domElements, pageProps
onEndAnimation Function childElements, domElements, pageProps
flipMoveOptions Function {pagesLength, visiblePagesLength, singleFrame} Override react-flip-move configuration.
singleFrame Boolean By default show two views. Set this to true to show only one.
moveSeed String Change this to force animations, it will be appended to the view keys read when we need this

renderFrame(pageObject)

import getComponentById from './your-components'

const renderFrame = pageObject => {
  const {
    id, // 'my-component-id'
    page, // 4
    activePage, // 5
    state, // { roses: 'blue', violets: 'red', pass:'whetever', pleases: 'you' }
    actions // see next paragraph for the actions methods
  } = pageObject

  const Muv = getComponentById(id) // return a Component

  return <Muv {...state} {...actions} />
}

{actions} API

Method Description
setCurrentFrame(props:object) Merge props on the current page
getCurrentFrame():object Get props of the current page
closeCurrentFrame() Close the current page
setNextFrame(id:string, props:object ) Merge the next page and optionally pass props
getNextFrame() Get props of the next page
closeNextFrame() Close the next page
setFrame(page:number, id:string, props:object) Merge the next page
getFrame(page:number):props Get props of a page
closeFrame(page:number) Close a page

Demos

Basic demo on codesandbox

https://codesandbox.io/s/r4v7onrpop

React-create-app Demo

https://albinotonnina.github.io/demo-magic-hat

https://github.com/albinotonnina/demo-magic-hat

Maintainers

@albinotonnina

Contribute

PRs accepted.

License

MIT © 2018 Albino Tonnina

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].