Skip to content

Hello10/kitchen

Repository files navigation

API

Shared

Web

classes

import { classes } from '@hello10/kitchen/web'

if (something) {
  classes({
    Funk: true,
    Dirk: 0 === 0,
    No: null,
    Nope: undefined,
    Narp: ()=> {
      return false;
    },
    'Derp?!': ()=> {
      return true;
    }
  });
}

Assert.equal(`${classes}`, 'Honk Donk! Funk Dirk Derp?!');

SCRAPS

Find right way to generalize this

import React, {Children, cloneElement, isValidElement} from 'react'

function withProps({props, children}) {
  return Children.map(children, (child) => {
    const valid = isValidElement(child)
    return valid ? cloneElement(child, {data, ...props}) : child
  })
}