const getGroup = ({ name = 'My group', projects = ['First', 'Second', 'Third'], collapsed = false } = {}) => ({ group: { name: text('Name', name), projects: array('Project list', projects, ',').map(name => ({ name, type: PROJECT_TAGS.REACT_NATIVE, customTags: times(random(0, 7), t => faker.hacker.adjective()), startScriptName: sample([true, false]) })) }, collapsed: boolean('Collapsed', collapsed) })
function getJoke (id) { id = parseInt(id, 10) if (id) { return jokes.find((joke)=> id === joke.id) } return sample(jokes) }
function App() { return ( <> <div className='navbar navbar-expand-lg navbar-light bg-light'> <Filter /> </div> <div style={{ padding: "20px" }} className='container'> <div className='row'> {colors.map((color, index) => ( <Card key={index} color={sample(colors)} /> ))} </div> </div> </> ) }
function Card({ bgColor }) { const dispatchRedux = useDispatch() const [id] = React.useState(shortid.generate()) const content = useSelector(appState => appState.card.contentById[id]) const [spinnerName] = React.useState(sample(Object.keys(Spinners))) const Spinner = React.useRef(Spinners[spinnerName]) const onClickHandler = () => { dispatchRedux({ type: "CARD_SELECTED", payload: id }) if (!content) dispatchRedux(fetchAndSetCard({ id })) } return ( <div className={classnames("col-lg-4 col-md-6 col-12 animated fadeIn")}> <div className={`card mb-3 ${bgColor}`} onClick={onClickHandler}> <div className='card-header text-center'>{id}</div> <div className='card-body text-center'> {!content && ( <div style={{ maxWidth: "60px", margin: "0 auto", minHeight: "50px" }}> <Spinner.current color={"#fff"} /> </div> )} {content && <img className={"animated fadeIn"} src={content} />} </div> </div> </div> ) }
async getRandomId () { const query = `SELECT id FROM couriers;` const ids = await this.db.all(query) return sample(ids).id }
<meta itemProp="image" content={(images && images.google) || seoImageURL(sample(seoImages.google))} /> <meta name="twitter:image:src" content={(images && images.twitter) || seoImageURL(sample(seoImages.twitter))} /> <meta property="og:image" content={(images && images.facebook) || seoImageURL(sample(seoImages.facebook))} /> <meta property="og:description" content={description} />
function Panel({ link, image, text, title, expandAll }) { const [color] = React.useState(sample(colors)) const [expand, setExpand] = React.useState(false)
function getJoke (id) { id = parseInt(id, 10) if (id) { return jokes.find((joke)=> id === joke.id) } return sample(jokes) }
function App() { return ( <> <div className='navbar navbar-expand-lg navbar-light bg-light'> <Filter /> </div> <div style={{ padding: "20px" }} className='container'> <div className='row'> {colors.map((color, index) => ( <Card key={index} color={sample(colors)} /> ))} </div> </div> </> ) }
function Card({ bgColor }) { const dispatchRedux = useDispatch() const [id] = React.useState(shortid.generate()) const content = useSelector(appState => appState.card.contentById[id]) const [spinnerName] = React.useState(sample(Object.keys(Spinners))) const Spinner = React.useRef(Spinners[spinnerName]) const onClickHandler = () => { dispatchRedux({ type: "CARD_SELECTED", payload: id }) if (!content) dispatchRedux(fetchAndSetCard({ id })) } return ( <div className={classnames("col-lg-4 col-md-6 col-12 animated fadeIn")}> <div className={`card mb-3 ${bgColor}`} onClick={onClickHandler}> <div className='card-header text-center'>{id}</div> <div className='card-body text-center'> {!content && ( <div style={{ maxWidth: "60px", margin: "0 auto", minHeight: "50px" }}> <Spinner.current color={"#fff"} /> </div> )} {content && <img className={"animated fadeIn"} src={content} />} </div> </div> </div> ) }