Closed Gavin-Gong closed 3 years ago
本地自定义 Previewer,props 加上 hideActions 再传给 dumi 默认主题的 Previewer 渲染,参考:https://d.umijs.org/zh-CN/theme/development
本地自定义 Previewer,props 加上 hideActions 再传给 dumi 默认主题的 Previewer 渲染,参考:https://d.umijs.org/zh-CN/theme/development
按照你说的方法解决了我的问题,thx。其实更加期望可以在 themeConfig 下增加一个字段方便进行控制。因为在我看来不使用codesandbox 是比较常见的场景🙂。
import Previewer from 'dumi-theme-default/src/builtins/Previewer';
export default (props) => {
return <Previewer {...props} hideActions="CSB" />;
};
其实更加期望可以在 themeConfig 下增加一个字段方便进行控制。因为在我看来不使用codesandbox 是比较常见的场景🙂。
@Gavin-Gong 有空可以来个 PR 支持下~
Previewer
应该怎么写呢 ?
我是用 code src 的
不是直接用的
import React from 'react'; import Layout from 'dumi-theme-default/es/layout';
export default ({ children, ...props }) => ( <Layout {...props}> <> {children} </> );
直接是写在这里面吗 ?
我更新下最新版本的隐藏方法:
.dumi/theme/builtins/Previewer.tsx
// @ts-nocheck
import Previewer from 'dumi-theme-mobile/dist/builtins/Previewer';
export default (props) => {
return <Previewer {...props} disabledActions={['CSB', 'STACKBLITZ']} />;
};
@BosenY 感谢补充,有两点建议:
PreviewerActions
slot 而不是覆盖 Previewer
builtin,符合最小变更
能否优雅地全局隐藏 codesandbox 按钮?因为像内部项目和 react-native 项目是不需要 codesandbox 的
workaround
display: none
样式覆盖hideActions: "CSB"