diff --git a/packages/theme-default/src/builtins/Previewer.less b/packages/theme-default/src/builtins/Previewer.less index 7ae424f8c5..52b404dce2 100644 --- a/packages/theme-default/src/builtins/Previewer.less +++ b/packages/theme-default/src/builtins/Previewer.less @@ -14,7 +14,8 @@ } &-target { - border-color: #3d62d2; + border-color: fade(@c-primary, 50%); + box-shadow: 0 0 0 5px fade(@c-primary, 5%); } &-desc { @@ -32,19 +33,18 @@ margin-bottom: 0; } - &[title] { + &[data-title] { position: relative; padding-top: 1.2em; - pointer-events: none; - &::before { - content: attr(title); + > a:first-child { position: absolute; top: 0; left: 1em; margin-left: -4px; padding: 0 4px; color: @c-heading; + font-size: inherit; font-weight: 500; background-color: #fff; transform: translateY(-50%); diff --git a/packages/theme-default/src/builtins/Previewer.tsx b/packages/theme-default/src/builtins/Previewer.tsx index 8c0120152d..6ebd7e7533 100644 --- a/packages/theme-default/src/builtins/Previewer.tsx +++ b/packages/theme-default/src/builtins/Previewer.tsx @@ -9,6 +9,7 @@ import { useCopy, useLocaleProps, Link, + AnchorLink, IPreviewerComponentProps, } from 'dumi/theme'; import SourceCode from './SourceCode'; @@ -79,15 +80,15 @@ const Previewer: React.FC = oProps => { > {props.children} -
{ - history.push(`#${props.identifier}`); - }} - title={props.title} - // eslint-disable-next-line - dangerouslySetInnerHTML={{ __html: props.description }} - /> +
+ {props.title && {props.title}} + {props.description && ( +
+ )} +
{openCSB && (