File tree Expand file tree Collapse file tree 2 files changed +11
-10
lines changed
packages/doom/src/runtime/components Expand file tree Collapse file tree 2 files changed +11
-10
lines changed Original file line number Diff line number Diff line change 1- import MasonryLayout from 'masonry-layout'
1+ import type MasonryLayout from 'masonry-layout'
22import { useLayoutEffect , useRef , type HTMLAttributes } from 'react'
33
44export interface MasonryProps extends HTMLAttributes < HTMLDivElement > {
@@ -13,7 +13,11 @@ export const Masonry = ({ options, ...props }: MasonryProps) => {
1313 return
1414 }
1515
16- const masonry = new MasonryLayout ( ref . current , options )
16+ // eslint-disable-next-line @typescript-eslint/no-require-imports
17+ const masonry = new ( require ( 'masonry-layout' ) as typeof MasonryLayout ) (
18+ ref . current ,
19+ options ,
20+ )
1721
1822 return ( ) => {
1923 masonry . destroy ?.( )
Original file line number Diff line number Diff line change @@ -50,6 +50,11 @@ const getChildLink = (
5050 return ''
5151}
5252
53+ const masonryOptions = {
54+ itemSelector : `.${ classes . overviewGroup } ` ,
55+ gutter : 16 ,
56+ }
57+
5358// The sidebar data include two types: sidebar item and sidebar group.
5459// In overpage page, we select all the related sidebar groups and show the groups in the page.
5560// In the meantime, some sidebar items also should be shown in the page, we collect them in the group named 'Others' and show them in the page.
@@ -212,14 +217,6 @@ export function Overview(props: {
212217
213218 const groups = customGroups ?? defaultGroups
214219
215- const masonryOptions = useMemo (
216- ( ) => ( {
217- itemSelector : `.${ classes . overviewGroup } ` ,
218- gutter : 16 ,
219- } ) ,
220- [ ] ,
221- )
222-
223220 return (
224221 < div className = "overview-index doom-overview-index" >
225222 { content }
You can’t perform that action at this time.
0 commit comments