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
// Example of a component using createStateActions | |
function Component() { | |
const [opened, setState] = useState(false); | |
const actions = createStateActions(setState, { | |
set: (currentState, value: boolean) => value, | |
open: () => true, | |
close: () => false, | |
toggle: currentState => !currentState, | |
}); |
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
// If it's the first time you're using a Snippet in Google Chrome | |
// 1. Open your Dev Tools | |
// 2. Hit "Ctrl + Alt + P" | |
// 3. Run the command "Create new snippet". This will open the Sources tab where you can c/c the code of this gist | |
// 4. Hit "Ctrl + Enter" | |
// 5. Go to the "Console" tab of your Dev Tools and follow the instructions displayed in the Console | |
// | |
// This snippet is inspired by https://developers.front-commerce.com/docs/2.x/advanced/production-ready/media-middleware#a-method-to-determine-image-sizes | |
let images = []; |
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
I am attesting that this GitHub handle JulienPradet is linked to the Tezos account tz1h7mNDPuxa57f4UD5nqFX9ifnvYxPQ8qmj for tzprofiles | |
sig:edsigtknd8KTQjCttpKWQ9VbEKuruycsm8Bshq3YAmYtPdYLTjwt5MY5dx2mMUAhqZrVH2PJpSLwEjXEYuLrh96giGywUdW3Nxg |
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
<script> | |
import {trapFocus} from "./trapFocus"; | |
</script> | |
<div use:trapFocus> | |
<button>Hi!</button> | |
<button>Second button</button> | |
</div> |
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 webpack from 'webpack' | |
import {Readable} from 'stream' | |
const entryStream = new Readable() | |
entryStream.push(` | |
import { configure } from '@kadira/storybook'; | |
function loadStories() { | |
require('./story1.js'); | |
require('./story2.js'); |
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 BasicExample = () => ( | |
<Router> | |
<div> | |
<Menu /> | |
<RoutedContent /> | |
</div> | |
</Router> | |
) | |
const Menu = () => ( |