npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

effector-mui-snacks

v1.0.0

Published

Implementation snacks stack using effector and MUI

Downloads

26

Readme

Implementation snacks stack using effector and MUI

Introduction

This's a simple implementation of notistack recommended by MUI docs for stack of snacks. It usings react context and hooks for work and this is very bad integrated with effector logic. This library is a solve of the problem. It provides integration effector logic and MUI snacks stack.

Installation

npm install effector-mui-snacks

The package need react, react-dom, effector, effector-react and @mui/material to be installed

Using

  1. Create snacks model

You can pass config into fabric

import { create } from 'effector-mui-snacks';

export const snacks = createSnackbarStackModel(); // You may pass [config](#fabric-config), but It'll work and without it
  1. Add SnackbarList component into the component tree and pass into it model
import { SnackbarList } from 'effector-mui-snacks';
import { snacks } from '/path/to/model';

export const SomeComponent: FC = () => {
	return (
		<>
			...
			<SnackbarList model={snacks} />
		</>
	);
};
  1. Import styles into the root of the project
...
import 'effector-mui-snacks/dist/style.css'
...
  1. Create snack called create event with snack data

Simple variant

...
import { snacks } from '/path/to/model'

...
sample({
  clock: someUnit,
  fn: () => ({ message: 'some message' }),
  target: snacks.create
})

Or more complex one

...
import { snacks } from '/path/to/model'

...
sample({
  clock: someUnit,
  fn: () => ({ message: 'some message', color: 'success', title: 'Some title', timeout: 2400 }) as const, // Need 'cause some properties have strict types
  target: snacks.create
})

Types

Fabric config

Every property can be static(written in table types) or reactive(stores with written types). If value is reactive and It's changed the config changes too.

| property name | type | required | default value | description | | ------------- | ------------------------------------ | -------- | ---------------------------------------------- | ---------------------------------------- | | duration | number | false | 250 | duration of snack animation | | variant | 'standard' | 'outlined' | 'filled' | false | 'standard' | MUI snack filling variant | | closable | boolean | false | true | can snack be closed manual | | timeout | number | false | 3000 | how long(ms) snack will be shown | | maxCount | number | false | 3 | how many snacks max can be in this stack | | position | Position | false | { 'vertical': 'bottom', 'horizontal': 'left' } | where stack will be |

Position

Type describe the position

type Vertical = 'top' | 'bottom';
type Horizontal = 'left' | 'right' | 'center';

interface Position {
	readonly vertical: Vertical;
	readonly horizontal: Horizontal;
}