aboutsummaryrefslogtreecommitdiff
path: root/src/components/UserStrip
diff options
context:
space:
mode:
authoreug-vs <eug-vs@keemail.me>2020-06-30 00:41:09 +0300
committereug-vs <eug-vs@keemail.me>2020-06-30 00:41:09 +0300
commit1499c0126d1a7a2377b0267b761479100c636ee9 (patch)
tree5d48eea7b8dffcac324034703ebc4e30448d75c6 /src/components/UserStrip
parentaa63dea15c71ab014b4b57010574c7abf1f9628b (diff)
downloadwhich-ui-1499c0126d1a7a2377b0267b761479100c636ee9.tar.gz
feat!: create useNavigate hook
Diffstat (limited to 'src/components/UserStrip')
-rw-r--r--src/components/UserStrip/UserStrip.tsx16
1 files changed, 5 insertions, 11 deletions
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<PropTypes> = ({ user, info, navigate }) => {
+const UserStrip: React.FC<PropTypes> = ({ user, info }) => {
const classes = useStyles();
- const {
- username,
- avatarUrl,
- verified
- } = user;
+ const { navigate } = useNavigate();
+ const { username, avatarUrl, verified } = user;
const handleNavigate = () => {
navigate('profile', user._id);