start(systemName | extension, ...extensions)
stop(actorRef)
query(actor,msg, timeoutInMs)
dispatch(actor, msg, sender)
spawn(parent, f, name, properties)
spawnStateless(parent, f, name, properties)
spawnPersistent(parent, f, persistentKey, name, properties)
persistentQuery(parent, f, key, properties) : Promise<Result>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Storybook embed example</title> | |
<script> | |
window.addEventListener("message", (message) => { | |
try { | |
const data = JSON.parse(message.data) | |
if (!data || data.context !== "iframe.resize") return | |
const url = new URL(data.src) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.addEventListener("message", (message) => { | |
try { | |
const data = JSON.parse(message.data) | |
if (!data || data.context !== "iframe.resize") return | |
const url = new URL(data.src) | |
for (const key of [...url.searchParams.keys()]) { | |
if (!["path", "id", "args"].includes(key)) url.searchParams.delete(key) | |
} | |
for (const el of document.querySelectorAll(`iframe[src^="${url.href}"]`)) { | |
el.style.height = `${data.height}px` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default { | |
title: 'Basics/Button', | |
loaders: [() => import('./Button')], | |
}; | |
const Template = (args, { loaded }) => { | |
const { default: Button } = loaded; | |
return <Button {...args} />; | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function shallowEqual(objA, objB): boolean { | |
if (Object.is(objA, objB)) { | |
return true; | |
} | |
if (typeof objA !== 'object' || objA === null || typeof objB !== 'object' || objB === null) { | |
console.log('not object'); | |
return false; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const storage = type => ({ | |
/** | |
* Asserts that sessionStorage or localStorage is available. | |
* | |
* Returns true even on quota exceeded error, so we won't silently ignore when we're using too much | |
* space, unless we haven't stored anything yet which will happen when the browser has set a very | |
* strict size limit (i.e. Safari Private Browsing sets quota to 0). | |
* | |
* @see https://developer.mozilla.org/en-US/docs/Web/API/Web_Storage_API/Using_the_Web_Storage_API | |
*/ |
Thanks to Chromatic for providing the visual testing platform that helps us catch unexpected changes on time.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from "react" | |
import { render, unmountComponentAtNode } from "react-dom" | |
import { act } from "react-dom/test-utils" | |
let container = null | |
beforeEach(() => { | |
// setup a DOM element as a render target | |
container = document.createElement("div") | |
document.body.appendChild(container) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const mockWaiting = (): AsyncInitial<any> => ({ | |
data: undefined, | |
error: undefined, | |
initialValue: undefined, | |
startedAt: undefined, | |
finishedAt: undefined, | |
status: "initial", | |
isInitial: true, | |
isPending: false, | |
isLoading: false, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import styled, { keyframes } from "styled-components" | |
const slide = keyframes` | |
0% { left: -35%; right: 100%; } | |
60% { left: 100%; right: -90%; } | |
100% { left: 100%; right: -90%; } | |
` | |
const chase = keyframes` | |
0% { left: -200%; right: 100%; } |
NewerOlder