preact#ComponentType TypeScript Examples
The following examples show how to use
preact#ComponentType.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: getTransformHoc.tsx From LogicFlow with Apache License 2.0 | 6 votes |
export default function getTransform<P>(WrappedComponent: ComponentType<P>) {
return class extends Component<IProps & P> {
getMatrixString(): GraphTransform {
const { graphModel } = this.props;
const {
transformModel: {
SCALE_X,
SKEW_Y,
SKEW_X,
SCALE_Y,
TRANSLATE_X,
TRANSLATE_Y,
},
} = graphModel;
const matrixString = [SCALE_X, SKEW_Y, SKEW_X, SCALE_Y, TRANSLATE_X, TRANSLATE_Y].join(',');
return {
transform: `matrix(${matrixString})`,
transformOrigin: 'left top',
};
}
render() {
return <WrappedComponent {...this.props as P} transformStyle={this.getMatrixString()} />;
}
};
}
Example #2
Source File: Router.tsx From help-widget with MIT License | 5 votes |
RouteComponent = (props: { component: ComponentType<null> }) =>
createElement(props.component, null)