From 39030025457ccba7362409b3dc332990fbbad0d0 Mon Sep 17 00:00:00 2001 From: Jinbao1001 Date: Thu, 19 Dec 2024 13:58:43 +0800 Subject: [PATCH 1/3] feat: demo-render --- src/client/theme-api/DumiDemoGrid.tsx | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/client/theme-api/DumiDemoGrid.tsx b/src/client/theme-api/DumiDemoGrid.tsx index 16c67c1ca8..69477e3ec3 100644 --- a/src/client/theme-api/DumiDemoGrid.tsx +++ b/src/client/theme-api/DumiDemoGrid.tsx @@ -1,10 +1,17 @@ import { DumiDemo, useRouteMeta } from 'dumi'; -import React, { useCallback, useEffect, useState, type FC } from 'react'; +import React, { + ReactNode, + useCallback, + useEffect, + useState, + type FC, +} from 'react'; import type { IDumiDemoProps } from './DumiDemo'; import type { IRouteMeta } from './types'; export interface IDumiDemoGridProps { items: IDumiDemoProps[]; + demoRender?: (item: IDumiDemoProps) => ReactNode; } export const DumiDemoGrid: FC = (props) => { @@ -55,9 +62,12 @@ export const DumiDemoGrid: FC = (props) => {
{cols.map((col, i) => (
- {col.map((item) => ( - - ))} + {col.map((item) => { + if (props.demoRender) { + return props.demoRender(item); + } + return ; + })}
))}
From c31b0bf900ee34d4c6d975ef038f4e0781056f11 Mon Sep 17 00:00:00 2001 From: Jinbao1001 Date: Thu, 19 Dec 2024 13:59:39 +0800 Subject: [PATCH 2/3] build: release 2.4.17-rc.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 3bbb9828b2..cf21b29b62 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "dumi", - "version": "2.4.16", + "version": "2.4.17-rc.1", "description": "📖 Documentation Generator of React Component", "keywords": [ "generator", From de226647676e4f5f1594b4a65376487c38e9558e Mon Sep 17 00:00:00 2001 From: Jinbao1001 Date: Thu, 19 Dec 2024 14:14:18 +0800 Subject: [PATCH 3/3] chore: version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index cf21b29b62..3bbb9828b2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "dumi", - "version": "2.4.17-rc.1", + "version": "2.4.16", "description": "📖 Documentation Generator of React Component", "keywords": [ "generator",