Skip to content
This repository was archived by the owner on Apr 11, 2025. It is now read-only.

Commit a80939d

Browse files
committed
🐛 fix: 修正 grid 布局问题
1 parent 8434793 commit a80939d

File tree

3 files changed

+20
-15
lines changed

3 files changed

+20
-15
lines changed

packages/asset-gallery/package.json

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,10 @@
2424
},
2525
"dependencies": {
2626
"@ant-design/icons": "^4.6.2",
27-
"@bedrock-layout/columns": "^2.1.11",
28-
"@bedrock-layout/inline": "^2.0.15",
29-
"@bedrock-layout/masonry-grid": "^2.0.14",
30-
"antd": "^4.14.0",
27+
"antd": "^4.18.5",
3128
"copy-to-clipboard": "^3.3.1",
29+
"classnames": "^2.3.1",
3230
"js-yaml": "^4.1.0",
33-
"use-merge-value": "^1.0.2",
34-
"styled-components": "^5.3.0"
31+
"use-merge-value": "^1.0.2"
3532
}
3633
}

packages/asset-gallery/src/components/Layout.tsx

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import type { FC } from 'react';
22
import React from 'react';
3-
import { Columns } from '@bedrock-layout/columns';
3+
import cls from 'classnames';
4+
45
import Header from './Header';
56

67
import type { AssetGalleryProps } from '../types';
@@ -36,18 +37,21 @@ const Layout: FC<LayoutProps> = ({
3637
onLayoutChange={onLayoutChange}
3738
showSlider={showSlider}
3839
/>
39-
{layout === 'grid' ? (
40-
<Columns gutter={''} columns={columns}>
41-
{children}
42-
</Columns>
43-
) : (
40+
{
4441
<div
45-
className={'avx-asset-gallery-container avx-asset-gallery-masonry'}
46-
style={{ columnCount: columns }}
42+
className={cls(
43+
'avx-asset-gallery-container',
44+
`avx-asset-gallery-${layout}`,
45+
)}
46+
style={{
47+
columnCount: layout === 'masonry' ? columns : undefined,
48+
gridTemplateColumns:
49+
layout === 'grid' ? `repeat(${columns}, 1fr)` : undefined,
50+
}}
4751
>
4852
{children}
4953
</div>
50-
)}
54+
}
5155
</div>
5256
);
5357
};

packages/asset-gallery/src/style.less

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
.avx-asset-gallery {
2+
&-grid {
3+
display: grid;
4+
grid-template-columns: repeat(3, 1fr);
5+
}
26
&-masonry {
37
column-count: 4;
48
column-gap: 0;

0 commit comments

Comments
 (0)