Lattice Playground 🎡
Automatically generated component playground
from react component typescript/flow/prop types and comments -
turn this into this! 🧙♀️
Example
Check out the full example.
Usage
Install the playground package
$ npm i @latticehr/playground --dev
Or yarn
$ yarn add @latticehr/playground --dev
Then you'll want to create a playground entry file. This is where we'll be rendering the playground.
import React from "react";
import { render } from "react-dom";
import Playground from "@latticehr/playground";
function importAll(r) {
return r.keys().map(r);
}
const pages = importAll(require.context("./components", true, /\.js$/));
const App = () => <Playground pages={pages} />;
render(<App />, document.getElementById("root"));
Finally, you'll want to add the loader
to your webpack config.
const PlaygroundLoader = require("@latticehr/playground/loader");
{
test: /\.m?js$/,
exclude: /(node_modules)/,
use: {
loader: PlaygroundLoader
}
}
Development
$ git clone https://github.com/latticehr/playground
$ cd playground
$ yarn install
To start up webpack-dev-server:
$ yarn demo:server
And finally rebuild when changes happen:
$ yarn demo:watch
License (MIT)
WWWWWW||WWWWWW
W W W||W W W
||
( OO )__________
/ | \
/o o| MIT \
\___/||_||__||_|| *
|| || || ||
_||_|| _||_||
(__|__|(__|__|
Copyright © 2020-present Lattice
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.