umijs / dumi

📖 Static Site Generator for component library development
https://d.umijs.org
MIT License
3.6k stars 1.18k forks source link

Question: 怎么快速简单的全局禁用demo的 codesandbox 、stackblitz等按钮 #1388

Closed JaylanChen closed 1 year ago

JaylanChen commented 1 year ago

Question

image

代码位置

如题,如何快速简单禁用demo的打开 codesandbox 、stackblitz 等按钮

moecasts commented 1 year ago

用 css 隐藏一下就好了吧?

PeachScript commented 1 year ago

推荐方案:创建 .dumi/theme/slots/PreviewerActions.tsx,包裹默认的组件并传递需要的 disabledActions 参数,相当于做一次柯里化

doupo commented 1 year ago

`import DumiPreviewerActions from 'dumi/theme-default/slots/PreviewerActions'; import React from 'react';

const PreviewerActions = (props) => { const config = { ...props, disabledActions: ['CSB', 'CODEPEN', 'STACKBLITZ'], }; return <DumiPreviewerActions {...config} />; };

export default PreviewerActions; `

今天遇到这个问题,贴一下代码

ChestnutYYY commented 1 year ago

`import DumiPreviewerActions from 'dumi/theme-default/slots/PreviewerActions'; import React from 'react';

const PreviewerActions = (props) => { const config = { ...props, disabledActions: ['CSB', 'CODEPEN', 'STACKBLITZ'], }; return <DumiPreviewerActions {...config} />; };

export default PreviewerActions; `

今天遇到这个问题,贴一下代码 image

求帮助: 在theme -> slots -> PreviewActions 做覆盖并未生效, 不是很理解为什么没有生效 是还需要什么配置吗?