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: + +
+
+ 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() + : + } + )}