fix: follow btton add tootips

This commit is contained in:
shuai 2023-05-11 16:28:29 +08:00
parent 0aa98fb2af
commit 118dc29ae9
2 changed files with 13 additions and 9 deletions

View File

@ -1,7 +1,7 @@
import { memo, FC, useState, useEffect, useRef } from 'react';
import { Link, useSearchParams } from 'react-router-dom';
import { useTranslation } from 'react-i18next';
import { Button } from 'react-bootstrap';
import { Button, OverlayTrigger, Tooltip } from 'react-bootstrap';
import {
Tag,
@ -102,13 +102,17 @@ const Index: FC<Props> = ({ data, initPage, hasAnswer, isLogged }) => {
{t('Views')} {formatCount(data.view_count)}
</div>
)}
<Button
variant="link"
size="sm"
className="p-0 btn-no-border"
onClick={(e) => handleFollow(e)}>
{t(followed ? 'Following' : 'Follow')}
</Button>
<OverlayTrigger
placement="bottom"
overlay={<Tooltip id="followTooltip">{t('follow_tip')}</Tooltip>}>
<Button
variant="link"
size="sm"
className="p-0 btn-no-border"
onClick={(e) => handleFollow(e)}>
{t(followed ? 'Following' : 'Follow')}
</Button>
</OverlayTrigger>
</div>
<div className="m-n1">
{data?.tags?.map((item: any) => {

View File

@ -152,7 +152,7 @@ const Index = () => {
const initPage = (type: string) => {
if (type === 'delete_question') {
setTimeout(() => {
navigate(-1);
navigate('/', { replace: true });
}, 1000);
return;
}