Shared:Components:ArticleItem: add link

This commit is contained in:
Timofey Boyko 2024-08-27 09:59:13 +03:00
parent 826a4fae00
commit 6709883fe4
2 changed files with 77 additions and 53 deletions

View File

@ -26,6 +26,7 @@
import React from "react";
import { ReactSVG } from "react-svg";
import { Link } from "react-router-dom";
import { Text } from "../text";
@ -69,6 +70,7 @@ export const ArticleItemPure = (props: ArticleItemProps) => {
badgeTitle,
$currentColorScheme,
title,
linkData,
} = props;
const onClickAction = (e: React.MouseEvent) => {
@ -105,6 +107,11 @@ export const ArticleItemPure = (props: ArticleItemProps) => {
const renderItem = () => {
return (
<Link
style={{ textDecoration: "none" }}
to={linkData?.path}
state={linkData?.state}
>
<StyledArticleItemTheme
className={className}
style={style}
@ -161,6 +168,7 @@ export const ArticleItemPure = (props: ArticleItemProps) => {
</StyledArticleItemBadgeWrapper>
)}
</StyledArticleItemTheme>
</Link>
);
};

View File

@ -26,6 +26,21 @@
import { TColorScheme } from "../../themes";
export type TArticleLinkDataState =
| {
title: string;
isRoot: boolean;
isPublicRoomType: boolean;
rootFolderType: number;
canCreate: boolean;
}
| {};
export type TArticleLinkData = {
path: string;
state: TArticleLinkDataState;
};
export interface ArticleItemProps {
/** Accepts className */
className?: string;
@ -70,4 +85,5 @@ export interface ArticleItemProps {
badgeTitle?: string;
$currentColorScheme?: TColorScheme;
title?: string;
linkData: TArticleLinkData;
}