From 1499c0126d1a7a2377b0267b761479100c636ee9 Mon Sep 17 00:00:00 2001 From: eug-vs Date: Tue, 30 Jun 2020 00:41:09 +0300 Subject: feat!: create useNavigate hook --- src/components/UserStrip/UserStrip.tsx | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) (limited to 'src/components/UserStrip') diff --git a/src/components/UserStrip/UserStrip.tsx b/src/components/UserStrip/UserStrip.tsx index f02adc3..bbd595e 100644 --- a/src/components/UserStrip/UserStrip.tsx +++ b/src/components/UserStrip/UserStrip.tsx @@ -1,16 +1,13 @@ import React from 'react'; import { makeStyles } from '@material-ui/core/styles'; import VerifiedIcon from '@material-ui/icons/CheckCircleOutline'; -import { - Avatar, - CardHeader -} from '@material-ui/core/'; +import { Avatar, CardHeader } from '@material-ui/core/'; import { User } from 'which-types'; +import { useNavigate } from '../../hooks/useNavigate'; interface PropTypes { user: User; - navigate: (prefix: string, id: string) => void; info?: string | JSX.Element } @@ -31,13 +28,10 @@ const useStyles = makeStyles(theme => ({ })); -const UserStrip: React.FC = ({ user, info, navigate }) => { +const UserStrip: React.FC = ({ user, info }) => { const classes = useStyles(); - const { - username, - avatarUrl, - verified - } = user; + const { navigate } = useNavigate(); + const { username, avatarUrl, verified } = user; const handleNavigate = () => { navigate('profile', user._id); -- cgit v1.2.3