Storybook addons need a matching @storybook/addons version. Here's how to ensure it gets it. Addons Need a Channel In Storybook, you preview the components you're writing with some nice surround UI to navigate and manipulate them. For this UI to communicate with the preview pane, there is a channel construct for pub/sub communication. Addons to Storybook utilize this channel. This channel is accessible in this way: import addons from '@storybook/addons' const channel = addons.getChannel() Non-existent Channel When you're writing a Storybook addon, things will feel just fine. It's easy. It's…
jsstorybookexcerpt only · body stays at the source
CSS Modules are das bombe, but you're still stuck in a land where the traditional CSS stylesheet exists, you may have to load both. Here's a pattern that could potentially work for you. Importing CSS Webpack is a tool for loading many different kinds of assets as modules into JavaScript. This means, for instance, that you can import CSS into your JavaScript. If you import a CSS module in this way, it'll allow you to use that module on a UI component that is built using JavaScript (eg, React): import css from './my-component.css' import React from 'react' const MyComponent = _ => <div…
Ember Views are used for event handling and creating reusable web components. To make them useful and interesting, model data needs to make it into and out of the view. Here is an example of how this works. Define Your View In our example, I'm making a simple dice rolling game. I want to use a view to represent the die on the screen and to handle the roll event. Your custom view must simply extend Ember.View in die-view.coffee: App.DieView = Ember.View.extend templateName: 'die' This is about the simplest view definition we could make. We'll make it a bit cooler later. For now, the view just…
Pinterest currently does not have an official webservice API. It seems kind of crazy in this day and age. They really should have one. I can't think what the business reasons might be for not having one. They've not had one for long enough that it's high time we write our own. It'll be surprisingly easy with a few choice tools Webservice API on NodeJs NodeJs is just a fun platform to write IO-heavy applications for the web. We're going to write a quick RESTful endpoint using the Express library that allows us to consume real Pinterest content that's not available via a pre-existing service.…
In JavaScript, functions can be defined and used in the same statement. This makes creation quick, and the functions are considered anonymous because of their inline use and lack of assignment to a local variable. But, there are a couple reasons you might want to label them. Readability A great thing about functions in general is that they will tell you what they're used for. If I call a function called calculatePi(), I expect it to do just that. It's a great abstraction. We can look at the name of the function without having to learn exactly how it does its stated task. The performance of…
Optional Google Analytics helps us understand visits. Microsoft Clarity records masked interactions to improve the site. Optional tools stay off unless you choose them. Privacy details.