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

Commit 7f9ad2e

Browse files
committed
✨ feat: 新增全局控制 padding props
1 parent 20629c2 commit 7f9ad2e

File tree

6 files changed

+14
-9
lines changed

6 files changed

+14
-9
lines changed

packages/asset-gallery/demos/Demo.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ const Demo = () => {
1515
}}
1616
data={images}
1717
darkBackground={'black'}
18+
coverPadding={24}
1819
/>
1920
);
2021
};

packages/asset-gallery/demos/YAMLDemo.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,15 @@ import { yml } from './yml';
88

99
const YAMLDemo = () => {
1010
return (
11-
<div
11+
<AssetGallery
12+
data={yml}
13+
darkBackground={'black'}
14+
coverPadding={24}
1215
style={{
1316
background: '#fafafa',
1417
padding: 24,
1518
}}
16-
>
17-
<AssetGallery data={yml} darkBackground={'black'} />
18-
</div>
19+
/>
1920
);
2021
};
2122

packages/asset-gallery/src/AssetGallery.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ const AssetGallery: FC<AssetGalleryProps> = ({
2323
defaultColumns,
2424
onColumnsChange,
2525
style,
26+
coverPadding,
2627
}) => {
2728
const [columns, setColumn] = useMergeValue(4, {
2829
value: columnsProps,
@@ -56,7 +57,7 @@ const AssetGallery: FC<AssetGalleryProps> = ({
5657
return (
5758
<AssetCard
5859
key={index}
59-
padding={padding}
60+
padding={padding || coverPadding}
6061
url={url}
6162
dark={dark}
6263
darkBackground={backgroundColor}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import type { Asset } from '../types';
1818
import { copySketch } from '../utils/sketch';
1919

2020
const AssetCard: FC<Asset> = ({
21-
padding,
21+
padding = 12,
2222
url,
2323
title,
2424
darkBackground,

packages/asset-gallery/src/style.less

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131

3232
&-ctn {
3333
position: relative;
34-
padding: 24px;
3534
}
3635

3736
&-type {

packages/asset-gallery/src/types.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,12 @@ export interface AssetGalleryProps {
112112
* @enumOptions [{ label: '显示', value: true }, { label: '隐藏', value: false }]
113113
*/
114114
showSlider?: boolean;
115-
116115
/**
117-
* 样式
116+
* @title 全局图片的内边距
117+
*/
118+
coverPadding?: number | string;
119+
/**
120+
* @title 样式
118121
*/
119122
style?: CSSProperties;
120123
}

0 commit comments

Comments
 (0)