Skip to content

Commit f71c106

Browse files
Merge branch 'master' of github.com:lobehub/lobe-ui
2 parents 7a6a7ff + 0a4982c commit f71c106

4 files changed

Lines changed: 30 additions & 211 deletions

File tree

packages/dumi-theme-lobehub/package.json

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,32 +12,26 @@
1212
"prepare": "npm run build"
1313
},
1414
"dependencies": {
15+
"@ant-design/icons": "^5",
1516
"@floating-ui/react": "^0.17",
1617
"@lobehub/ui": "latest",
17-
"animated-scroll-to": "^2",
1818
"chalk": "^4",
1919
"fast-deep-equal": "^3",
20-
"rc-footer": "^0.6",
21-
"react-syntax-highlighter": "^15",
22-
"shiki-es": "^0.2"
20+
"rc-footer": "^0.6"
2321
},
2422
"devDependencies": {
25-
"@ant-design/icons": "^5",
2623
"@emotion/babel-plugin": "^11",
2724
"@emotion/react": "^11",
2825
"@testing-library/react": "^13",
29-
"@types/react-syntax-highlighter": "^15",
3026
"@umijs/lint": "^4",
3127
"@vitest/coverage-c8": "latest",
3228
"concurrently": "^7",
3329
"cross-env": "^7",
3430
"father-plugin-dumi-theme": "^1.0.0-rc.1",
3531
"history": "^5",
36-
"jsdom": "^21",
37-
"tilg": "^0.1"
32+
"jsdom": "^21"
3833
},
3934
"peerDependencies": {
40-
"@ant-design/icons": ">=4",
4135
"dumi": "^2.0.0",
4236
"react": ">=16.8",
4337
"react-dom": ">=16.8"

packages/dumi-theme-lobehub/src/builtins/Previewer/index.tsx

Lines changed: 27 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,39 @@
1-
import { IntersectionLoad } from '@/components/LazyLoad';
21
import { createStyles } from 'antd-style';
32
import { IPreviewerProps } from 'dumi/dist/client/theme-api/types';
43
import Previewer from 'dumi/theme-default/builtins/Previewer';
54
import { rgba } from 'polished';
6-
import { useMemo } from 'react';
75

8-
const useStyles = createStyles(({ css, token, prefixCls }, { center, nopadding }: any) => {
6+
const useStyles = createStyles(({ css, token, prefixCls }) => {
97
return {
8+
center: css`
9+
.dumi-default-previewer-demo {
10+
display: flex;
11+
align-items: center;
12+
justify-content: center;
13+
}
14+
`,
15+
nopadding: css`
16+
.dumi-default-previewer-demo {
17+
padding: 0;
18+
}
19+
`,
1020
container: css`
1121
.dumi-default-previewer {
12-
border-color: ${token.colorBorderSecondary};
22+
overflow: hidden;
1323
display: flex;
1424
flex-direction: column;
15-
overflow: hidden;
25+
border-color: ${token.colorBorderSecondary};
1626
&-demo {
1727
flex: 1;
18-
${nopadding &&
19-
css`
20-
padding: 0;
21-
`}
22-
${center &&
23-
css`
24-
display: flex;
25-
align-items: center;
26-
justify-content: center;
27-
`}
2828
2929
&[data-iframe]::before {
3030
background: ${token.colorFillContent};
3131
}
3232
}
3333
3434
&-meta {
35-
border-color: ${token.colorBorderSecondary};
3635
flex: 1;
36+
border-color: ${token.colorBorderSecondary};
3737
3838
.${prefixCls}-highlighter {
3939
pre {
@@ -134,24 +134,19 @@ export interface PreviewerProps extends IPreviewerProps {
134134
nopadding?: boolean;
135135
}
136136

137-
export default (props: IPreviewerProps) => {
138-
const { styles, cx } = useStyles(props);
139-
140-
const height = useMemo(() => {
141-
if (typeof props.iframe === 'number') {
142-
return props.iframe;
143-
}
144-
if (props.height) {
145-
return props.height;
146-
}
147-
return 300;
148-
}, [props.iframe, props.height]);
137+
export default ({ center, codePlacement, nopadding, ...props }: PreviewerProps) => {
138+
const { styles, cx } = useStyles();
149139

150140
return (
151-
<div className={cx(styles.container, styles[props.codePlacement as 'left' | 'right' | 'top'])}>
152-
<IntersectionLoad height={height} elementType="section">
153-
<Previewer {...props} />
154-
</IntersectionLoad>
141+
<div
142+
className={cx(
143+
styles.container,
144+
center && styles.center,
145+
nopadding && styles.nopadding,
146+
styles[codePlacement as 'left' | 'right' | 'top'],
147+
)}
148+
>
149+
<Previewer {...props} />
155150
</div>
156151
);
157152
};

packages/dumi-theme-lobehub/src/components/LazyLoad/index.tsx

Lines changed: 0 additions & 137 deletions
This file was deleted.

packages/dumi-theme-lobehub/src/components/LazyLoad/utils.ts

Lines changed: 0 additions & 33 deletions
This file was deleted.

0 commit comments

Comments
 (0)