From 05f58d8cb7b86795eb761ae5d1342dc091a1550b Mon Sep 17 00:00:00 2001 From: lifosmin <65651883+lifosmin@users.noreply.github.com> Date: Mon, 8 Jul 2024 14:17:02 +0700 Subject: [PATCH] feat: DiffTimeline changes (#57) feat: DiffTimeline Table is modifiable Co-authored-by: Lifosmin Simon --- .../src/DiffTimeline/DiffTimeline.stories.tsx | 22 ++++++++++++++++++- .../src/DiffTimeline/DiffTimeline.tsx | 8 +++++-- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/packages/apsara-ui/src/DiffTimeline/DiffTimeline.stories.tsx b/packages/apsara-ui/src/DiffTimeline/DiffTimeline.stories.tsx index 9f192e84..2839254b 100644 --- a/packages/apsara-ui/src/DiffTimeline/DiffTimeline.stories.tsx +++ b/packages/apsara-ui/src/DiffTimeline/DiffTimeline.stories.tsx @@ -11,7 +11,7 @@ const dataArr = [ { _id: "3", diff: { - updated: ["2022-06-21T07:56:31.370Z", "2022-08-09T03:11:12.129Z"], + updated: [["2022-06-21T07:56:31.370Z", "safsd"], "2022-08-09T03:11:12.129Z"], deployment_id: ["test_id"], }, user: "test user", @@ -33,6 +33,26 @@ const dataArr = [ createdAt: "2022-08-09T03:11:12.811Z", updatedAt: "2022-08-09T03:11:12.811Z", __v: 0, + renderDiff: () => ( +
+

Custom Render Diff

+

User: test user

+

Reason: Apsara Component Migration

+

Version: 2

+
+ Updated: +
    + {["2022-06-21T07:56:31.370Z", "2022-08-09T03:11:12.129Z"].map((date, index) => ( +
  • {date}
  • + ))} +
+
+
+ Deployment ID: +

test_id

+
+
+ ), }, { _id: "1", diff --git a/packages/apsara-ui/src/DiffTimeline/DiffTimeline.tsx b/packages/apsara-ui/src/DiffTimeline/DiffTimeline.tsx index d306e7b5..4c1803b5 100644 --- a/packages/apsara-ui/src/DiffTimeline/DiffTimeline.tsx +++ b/packages/apsara-ui/src/DiffTimeline/DiffTimeline.tsx @@ -99,7 +99,7 @@ const DiffTimelineBlock = ({ timelineBlockData }: any) => { )} - {!R.isEmpty(timelineBlockData.diff) && ( + {(!R.isEmpty(timelineBlockData.diff) || timelineBlockData.renderDiff) && ( setIsActive(!isActive)}> @@ -108,7 +108,11 @@ const DiffTimelineBlock = ({ timelineBlockData }: any) => { - + {timelineBlockData.renderDiff ? + timelineBlockData.renderDiff() + : + } + )}