mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-25 12:56:41 +07:00
made transitional Anchor component for next/cra
This commit is contained in:
parent
7658068caa
commit
14b93d5dbb
7 changed files with 44 additions and 18 deletions
|
@ -10,6 +10,7 @@ import { Grid } from '~/components/containers/Grid';
|
|||
import { useHistory } from 'react-router';
|
||||
import { URLS } from '~/constants/urls';
|
||||
import { Placeholder } from '~/components/placeholders/Placeholder';
|
||||
import { useNavigation } from '~/hooks/navigation/useNavigation';
|
||||
|
||||
type Props = {
|
||||
node: INode;
|
||||
|
@ -19,8 +20,8 @@ type Props = {
|
|||
};
|
||||
|
||||
const LabBottomPanel: FC<Props> = ({ node, hasNewComments, commentCount, isLoading }) => {
|
||||
const history = useHistory();
|
||||
const onClick = useCallback(() => history.push(URLS.NODE_URL(node.id)), [history, node.id]);
|
||||
const { push } = useNavigation();
|
||||
const onClick = useCallback(() => push(URLS.NODE_URL(node.id)), [push, node.id]);
|
||||
|
||||
return (
|
||||
<Group horizontal className={styles.wrap} onClick={onClick}>
|
||||
|
|
|
@ -7,6 +7,7 @@ import { INode } from '~/types';
|
|||
import { getPrettyDate } from '~/utils/dom';
|
||||
import { URLS } from '~/constants/urls';
|
||||
import { useHistory } from 'react-router-dom';
|
||||
import { useNavigation } from '~/hooks/navigation/useNavigation';
|
||||
|
||||
interface IProps {
|
||||
node?: Partial<INode>;
|
||||
|
@ -14,10 +15,10 @@ interface IProps {
|
|||
}
|
||||
|
||||
const LabHero: FC<IProps> = ({ node, isLoading }) => {
|
||||
const history = useHistory();
|
||||
const { push } = useNavigation();
|
||||
const onClick = useCallback(() => {
|
||||
history.push(URLS.NODE_URL(node?.id));
|
||||
}, [history, node]);
|
||||
push(URLS.NODE_URL(node?.id));
|
||||
}, [push, node]);
|
||||
|
||||
if (!node || isLoading) {
|
||||
return (
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue