Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@madlan145/emotion-monkey

Package Overview
Dependencies
Maintainers
23
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@madlan145/emotion-monkey

Manage emotion instances with React contexts mechanism.

  • 0.3.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
decreased by-66.67%
Maintainers
23
Weekly downloads
 
Created
Source

emotion-monkey 🐒 → 🦍

Manage emotion instances with React context mechanism.

You probably don't need to use this. Please refer to create-emotion for use-cases.

Motivation

Using single emotion instance works almost everytime. However when you need to have multiple instances of emotion, you may face issues with storing and managing them.

Monkeys will come to the rescue! 🙉

Installation

npm i @madlan145/emotion-monkey -S

Usage

In you app's entry point:

import { EmotionProvider } from '@madlan145/emotion-monkey';
import createEmotion from 'create-emotion';

const emotion = createEmotion({});


const App: React.SFC<{}> = () => (
  <EmotionProvider emotion={emotion}>
    <Component label="Label 🐒" />
  </EmotionProvider>
);

Having EmotionProvider, you can use styled as you would normally use it with react-emotion.

To use css & other stuff from emotion:

import { Emotion } from 'create-emotion';
import { injectEmotion } from '@madlan145/emotion-monkey';


const stylesheet = ({ css }: Emotion) => ({
  redButton: css`
    color: red;
  `,
  container: css`
    padding: 15px;
  `,
});


interface ComponentProps {
  styles: ReturnType<typeof stylesheet>;
  label: string;
}

const Component: React.SFC<ComponentProps> = ({ styles, label }) => (
  <div className={styles.container}>
    <button className={styles.redButton}>{label}</button>
  </div>
);

export default injectEmotion(stylesheet)(Component);

FAQs

Package last updated on 29 Aug 2018

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