import { h } from "preact" ; import { prehook , useProps } from "../lib/prehook/prehook" ; import { useWindowSize } from "./useWindowSize" ; interface IProps { color : number | string ; } export default prehook < IProps > ( function CustomHookComponent2 ( ) { const windowSize = useWindowSize ( ) ; const props = useProps < IProps > ( { color : 'black' } ) ; return ( ) => { const { width , height } = windowSize . value ; const ratio = .2 ; return < div > < h3 > Custom hook usage 2 < /h3> < div style = { { margin : '0 auto' , width : width * ratio , height : height * ratio , border : '2px solid grey' , backgroundColor : props . value . color , borderRadius : 2 } } /> < /div>; } ; } ) ;