Skip to content

Instantly share code, notes, and snippets.

const definition = Layout.composition({
type: "site-composition",
props: {},
contentAreas: {
header: [
{
type: "site-header",
props: {
title: "Main title"
}
<Layout.CompositionsRenderer
services={{ featureState: { showSpecial: true } }}
compositions={[definition]}
/>
export const ContentBox = createRegisterableComponent(
"content-box",
(props: { content: string }, services) => (
<div>
<p>{props.content}</p>
{services.featureState.showSpecial && (
<div>Special content item - enabled with feature toggle service</div>
)}
</div>
)
@antonjb
antonjb / machine.js
Last active May 31, 2020 12:40
Generated by XState Viz: https://xstate.js.org/viz
// Idle
// after 30 seconds check status
// if in timezone && status promise resolves
// state => live
// live State
// after 30 seconds check status
// substate state == stop && outside timezone => state: idle
// substate state == play && fetch response reject => state: closing
// neither conditions pass => no op. check again in 30 seconds
// substates
@antonjb
antonjb / machine.js
Last active June 10, 2020 13:09
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions