This file contains 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 { withSize } from "react-sizeme" | |
import { take } from "lodash/fp" | |
import styled from "styled-components" | |
const CONTAINER_SIDE_PADDING = 20 | |
const CONTAINER_TOTAL_PADDING = CONTAINER_SIDE_PADDING * 2 | |
const ListContainer = styled.div` | |
display: flex; | |
flex-wrap: ${({ isMultiLine }) => (isMultiLine ? "wrap" : "nowrap")}; |
This file contains 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, { Component, createContext } from "react" | |
import { differenceBy } from "lodash/fp" | |
const { Provider, Consumer: MultiSelectConsumer } = createContext({}) | |
export function toggleItemUpdater(item) { | |
return ({ items: currentStateItems }) => { | |
const hasItem = currentStateItems.some(it => it.id === item.id) | |
if (hasItem) { | |
return { items: currentStateItems.filter(it => it.id !== item.id) } |
This file contains 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 flatten(input) { | |
return input.reduce((acc, current) => { | |
return acc.concat(Array.isArray(current) ? flatten(current) : current) | |
}, []) | |
} | |
/** | |
* Tests |
This file contains 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 function createAsyncAction({ | |
key, | |
methodName, | |
handler, | |
initialState = null, | |
stateUpdater = ({ currentData }) => currentData | |
}) { | |
let [setLoading, setError, setData] = [ | |
`${key}SetLoading`, | |
`${key}SetError`, |
This file contains 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 Vue from 'vue' | |
export function createWatchersForDependentFields({ | |
dependentFields, | |
form, | |
vm | |
}) { | |
return dependentFields.map(it => { | |
console.log('watcher for', `form.${it.field}`) | |
return vm.$watch( |
This file contains 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 { | |
useDialogState, | |
Dialog, | |
DialogDisclosure, | |
DialogBackdrop, | |
} from "reakit/Dialog" | |
import styles from "./Layout.module.css" | |
function Layout({ children }) { | |
const dialog = useDialogState({ animated: true }) |
This file contains 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
// Available variables: | |
// - Machine | |
// - interpret | |
// - assign | |
// - send | |
// - sendParent | |
// - spawn | |
// - raise | |
// - actions |
This file contains 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 clsx from 'clsx'; | |
import { useEffect, useState } from 'react'; | |
import { Input } from 'reakit'; | |
import { BehaviorSubject } from 'rxjs'; | |
import { | |
debounceTime, | |
map, | |
filter, | |
distinctUntilChanged, | |
} from 'rxjs/operators'; |
This file contains 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
//Configuration object that can be used to build the table: | |
const trackRowSchema = [ | |
{ | |
field: 'expand-column', | |
renderValue: (value) => <Button aria-label="expand-icon"><icon /></Button>, | |
}, | |
{ | |
field: 'name', | |
renderValue: (value) => <FancyLabel>{value.name}</FancyLabel>, | |
}, |
This file contains 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 DefaultRenderAnimationOutput = ({name, count}) => { | |
return ( | |
<> | |
<span className="RenderAnimation-name">{name} </span> | |
<span className="RenderAnimation-count">{count}</span> | |
</> | |
); | |
}; | |
function useRenderAnimation( |