import React, { PropsWithChildren } from 'react'; import { Profile } from '../Profile'; import './styles/index.scss'; import { useMyProfile } from './hooks'; import { TUIProfileDefault } from './TUIProfileDefault'; import { useTUIKitContext } from '../../context'; interface TUIProfileProps { className?: string, TUIProfile?: React.ComponentType, } function UnMemoizedTUIProfile( props: PropsWithChildren, ):React.ReactElement { const { className, TUIProfile: PropTUIProfile, } = props; const { myProfile, updateMyProfile } = useMyProfile(); const { setTUIProfileShow, TUIProfileShow } = useTUIKitContext('TUIProfile'); const TUIProfileUIComponent = PropTUIProfile || TUIProfileDefault; return ( <> { setTUIProfileShow(true); }} /> {TUIProfileShow && ( )} ); } export const TUIProfile = React.memo(UnMemoizedTUIProfile) as typeof UnMemoizedTUIProfile;