import Image from 'next/image' import { CSSProperties } from 'react' export default (props: { image: string, imageprop?: { zoom?: number, x?: number, y?: number, portion?: number, refw?: any }, width?: number, w?: number, style?: CSSProperties, on?:()=>void, }) => { let image = props.image || global.cdn("/files/user.svg") let imageprop = props.imageprop let wi = parseFloat(props.width?.toString?.() || props.w?.toString?.() || "100") if (props.image) { if (!props.imageprop) { return avatar props.on?.()} /> } } else { imageprop = {} } let zoom = imageprop?.zoom; let x = imageprop?.x let y = imageprop?.y let portion = imageprop?.portion let refw = imageprop?.refw if (typeof imageprop == "undefined") { return props.on?.()} src={image} style={{ width: wi, height: wi, borderRadius: wi / 2 }} /> } if (!zoom || (image == global.cdn("/files/user.svg"))) { return props.on?.()} src={image} style={{ width: wi, height: wi, borderRadius: wi / 2 }} /> } if (portion > 1) { wi *= portion return <> props.on?.()}> avatar } return <> props.on?.()}> avatar }