visuddhinanda пре 2 година
родитељ
комит
6c697b74b3

+ 12 - 3
dashboard/src/components/template/Article.tsx

@@ -2,9 +2,9 @@ import { Card, Collapse, Modal } from "antd";
 import { Typography } from "antd";
 import { useState } from "react";
 import Article, { ArticleType } from "../article/Article";
+import { Link } from "react-router-dom";
 
-const { Link } = Typography;
-export type TDisplayStyle = "modal" | "card" | "toggle";
+export type TDisplayStyle = "modal" | "card" | "toggle" | "link";
 interface IWidgetChapterCtl {
   type?: ArticleType;
   id?: string;
@@ -47,7 +47,7 @@ export const ArticleCtl = ({
     case "modal":
       output = (
         <>
-          <Link onClick={showModal}>{aTitle}</Link>
+          <Typography.Link onClick={showModal}>{aTitle}</Typography.Link>
           <Modal
             width={"80%"}
             style={{ maxWidth: 1000 }}
@@ -74,6 +74,15 @@ export const ArticleCtl = ({
         </Collapse>
       );
       break;
+    case "link":
+      let link = `/article/${type}/${id}?mode=read`;
+      link += channel ? `&channel=${channel}` : "";
+      output = (
+        <Link to={link} target="_blank">
+          {aTitle}
+        </Link>
+      );
+      break;
     default:
       break;
   }

+ 1 - 1
dashboard/src/components/template/Builder/ArticleTpl.tsx

@@ -155,7 +155,7 @@ const ArticleTplWidget = ({
               console.log(`selected ${value}`);
               setStyleText(value as TDisplayStyle);
             }}
-            options={["modal", "card", "toggle"].map((item) => {
+            options={["modal", "card", "toggle", "link"].map((item) => {
               return { value: item, label: item };
             })}
           />