Removing everything that isn't skeletonyy (#22)

* Simplifying

* Ignoring CSS defs
This commit is contained in:
Jake Archibald
2018-05-04 17:05:44 +01:00
parent 5f7f9e32a8
commit b619427237
26 changed files with 75 additions and 875 deletions

View File

@@ -1,26 +1,3 @@
import { Component, ComponentProps } from 'preact';
type WhenProps = ComponentProps<When> & {
value: boolean,
children?: (JSX.Element | (() => JSX.Element))[]
};
type WhenState = {
ready: boolean
};
export class When extends Component<WhenProps, WhenState> {
state: WhenState = {
ready: !!this.props.value
};
render({ value, children = [] }: WhenProps, { ready }: WhenState) {
let child = children[0];
if (value && !ready) this.setState({ ready: true });
return ready ? (typeof child === 'function' ? child() : child) : null;
}
}
/**
* A decorator that binds values to their class instance.
* @example