parent
0410908cd3
commit
c75e80aaee
|
@ -33,7 +33,7 @@ Customizing the header and footer of list by setting `header` and `footer` prope
|
||||||
<div>Footer</div>
|
<div>Footer</div>
|
||||||
</template>
|
</template>
|
||||||
</a-list>
|
</a-list>
|
||||||
<h3 :style="{ marginBottom: '16px' }">Default Size</h3>
|
<h3 :style="{ margin: '16px 0' }">Default Size</h3>
|
||||||
<a-list bordered :data-source="data">
|
<a-list bordered :data-source="data">
|
||||||
<template #renderItem="{ item }">
|
<template #renderItem="{ item }">
|
||||||
<a-list-item>{{ item }}</a-list-item>
|
<a-list-item>{{ item }}</a-list-item>
|
||||||
|
|
|
@ -29,6 +29,7 @@ import eagerComputed from '../_util/eagerComputed';
|
||||||
|
|
||||||
// CSSINJS
|
// CSSINJS
|
||||||
import useStyle from './style';
|
import useStyle from './style';
|
||||||
|
import useCSSVarCls from '../config-provider/hooks/useCssVarCls';
|
||||||
|
|
||||||
export type { ListItemProps } from './Item';
|
export type { ListItemProps } from './Item';
|
||||||
export type { ListItemMetaProps } from './ItemMeta';
|
export type { ListItemMetaProps } from './ItemMeta';
|
||||||
|
@ -110,7 +111,8 @@ const List = defineComponent({
|
||||||
const { prefixCls, direction, renderEmpty } = useConfigInject('list', props);
|
const { prefixCls, direction, renderEmpty } = useConfigInject('list', props);
|
||||||
|
|
||||||
// Style
|
// Style
|
||||||
const [wrapSSR, hashId] = useStyle(prefixCls);
|
const rootCls = useCSSVarCls(prefixCls);
|
||||||
|
const [wrapSSR, hashId, cssVarCls] = useStyle(prefixCls, rootCls);
|
||||||
|
|
||||||
const paginationObj = computed(() =>
|
const paginationObj = computed(() =>
|
||||||
props.pagination && typeof props.pagination === 'object' ? props.pagination : {},
|
props.pagination && typeof props.pagination === 'object' ? props.pagination : {},
|
||||||
|
@ -274,7 +276,9 @@ const List = defineComponent({
|
||||||
[`${prefixCls.value}-something-after-last-item`]: isSomethingAfterLastItem,
|
[`${prefixCls.value}-something-after-last-item`]: isSomethingAfterLastItem,
|
||||||
},
|
},
|
||||||
attrs.class,
|
attrs.class,
|
||||||
|
cssVarCls.value,
|
||||||
hashId.value,
|
hashId.value,
|
||||||
|
rootCls.value,
|
||||||
);
|
);
|
||||||
const paginationContent = props.pagination ? (
|
const paginationContent = props.pagination ? (
|
||||||
<div class={`${prefixCls.value}-pagination`}>
|
<div class={`${prefixCls.value}-pagination`}>
|
||||||
|
|
|
@ -1,18 +1,83 @@
|
||||||
import type { CSSObject } from '../../_util/cssinjs';
|
import type { CSSProperties } from 'vue';
|
||||||
import type { FullToken, GenerateStyle } from '../../theme/internal';
|
import { unit, type CSSObject } from '../../_util/cssinjs';
|
||||||
import { genComponentStyleHook, mergeToken } from '../../theme/internal';
|
|
||||||
import { resetComponent } from '../../style';
|
import { resetComponent } from '../../style';
|
||||||
|
import type { FullToken, GenerateStyle, GetDefaultToken } from '../../theme/internal';
|
||||||
|
import { genStyleHooks, mergeToken } from '../../theme/internal';
|
||||||
|
|
||||||
export interface ComponentToken {
|
export interface ComponentToken {
|
||||||
contentWidth: number;
|
/**
|
||||||
|
* @desc 内容宽度
|
||||||
|
* @descEN Width of content
|
||||||
|
*/
|
||||||
|
contentWidth: number | string;
|
||||||
|
/**
|
||||||
|
* @desc 大号列表项内间距
|
||||||
|
* @descEN Padding of large item
|
||||||
|
*/
|
||||||
|
itemPaddingLG: string;
|
||||||
|
/**
|
||||||
|
* @desc 小号列表项内间距
|
||||||
|
* @descEN Padding of small item
|
||||||
|
*/
|
||||||
|
itemPaddingSM: string;
|
||||||
|
/**
|
||||||
|
* @desc 列表项内间距
|
||||||
|
* @descEN Padding of item
|
||||||
|
*/
|
||||||
|
itemPadding: string;
|
||||||
|
/**
|
||||||
|
* @desc 头部区域背景色
|
||||||
|
* @descEN Background color of header
|
||||||
|
*/
|
||||||
|
headerBg: string;
|
||||||
|
/**
|
||||||
|
* @desc 底部区域背景色
|
||||||
|
* @descEN Background color of footer
|
||||||
|
*/
|
||||||
|
footerBg: string;
|
||||||
|
/**
|
||||||
|
* @desc 空文本内边距
|
||||||
|
* @descEN Padding of empty text
|
||||||
|
*/
|
||||||
|
emptyTextPadding: CSSProperties['padding'];
|
||||||
|
/**
|
||||||
|
* @desc Meta 下间距
|
||||||
|
* @descEN Margin bottom of meta
|
||||||
|
*/
|
||||||
|
metaMarginBottom: CSSProperties['marginBottom'];
|
||||||
|
/**
|
||||||
|
* @desc 头像右间距
|
||||||
|
* @descEN Right margin of avatar
|
||||||
|
*/
|
||||||
|
avatarMarginRight: CSSProperties['marginRight'];
|
||||||
|
/**
|
||||||
|
* @desc 标题下间距
|
||||||
|
* @descEN Margin bottom of title
|
||||||
|
*/
|
||||||
|
titleMarginBottom: CSSProperties['marginBottom'];
|
||||||
|
/**
|
||||||
|
* @desc 描述文字大小
|
||||||
|
* @descEN Font size of description
|
||||||
|
*/
|
||||||
|
descriptionFontSize: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @desc List 组件的 Token
|
||||||
|
* @descEN Token for List component
|
||||||
|
*/
|
||||||
interface ListToken extends FullToken<'List'> {
|
interface ListToken extends FullToken<'List'> {
|
||||||
|
/**
|
||||||
|
* @desc 列表项类名
|
||||||
|
* @descEN Class name of list item
|
||||||
|
*/
|
||||||
listBorderedCls: string;
|
listBorderedCls: string;
|
||||||
minHeight: number;
|
/**
|
||||||
listItemPaddingLG: string;
|
* @desc 最小高度
|
||||||
listItemPaddingSM: string;
|
* @descEN Minimum height
|
||||||
listItemPadding: string;
|
*/
|
||||||
|
minHeight: number | string;
|
||||||
}
|
}
|
||||||
|
|
||||||
const genBorderedStyle = (token: ListToken): CSSObject => {
|
const genBorderedStyle = (token: ListToken): CSSObject => {
|
||||||
|
@ -21,32 +86,32 @@ const genBorderedStyle = (token: ListToken): CSSObject => {
|
||||||
componentCls,
|
componentCls,
|
||||||
paddingLG,
|
paddingLG,
|
||||||
margin,
|
margin,
|
||||||
padding,
|
itemPaddingSM,
|
||||||
listItemPaddingSM,
|
itemPaddingLG,
|
||||||
marginLG,
|
marginLG,
|
||||||
borderRadiusLG,
|
borderRadiusLG,
|
||||||
} = token;
|
} = token;
|
||||||
return {
|
return {
|
||||||
[`${listBorderedCls}`]: {
|
[listBorderedCls]: {
|
||||||
border: `${token.lineWidth}px ${token.lineType} ${token.colorBorder}`,
|
border: `${unit(token.lineWidth)} ${token.lineType} ${token.colorBorder}`,
|
||||||
borderRadius: borderRadiusLG,
|
borderRadius: borderRadiusLG,
|
||||||
[`${componentCls}-header,${componentCls}-footer,${componentCls}-item`]: {
|
[`${componentCls}-header,${componentCls}-footer,${componentCls}-item`]: {
|
||||||
paddingInline: paddingLG,
|
paddingInline: paddingLG,
|
||||||
},
|
},
|
||||||
|
|
||||||
[`${componentCls}-pagination`]: {
|
[`${componentCls}-pagination`]: {
|
||||||
margin: `${margin}px ${marginLG}px`,
|
margin: `${unit(margin)} ${unit(marginLG)}`,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
[`${listBorderedCls}${componentCls}-sm`]: {
|
[`${listBorderedCls}${componentCls}-sm`]: {
|
||||||
[`${componentCls}-item,${componentCls}-header,${componentCls}-footer`]: {
|
[`${componentCls}-item,${componentCls}-header,${componentCls}-footer`]: {
|
||||||
padding: listItemPaddingSM,
|
padding: itemPaddingSM,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
[`${listBorderedCls}${componentCls}-lg`]: {
|
[`${listBorderedCls}${componentCls}-lg`]: {
|
||||||
[`${componentCls}-item,${componentCls}-header,${componentCls}-footer`]: {
|
[`${componentCls}-item,${componentCls}-header,${componentCls}-footer`]: {
|
||||||
padding: `${padding}px ${paddingLG}px`,
|
padding: itemPaddingLG,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -54,8 +119,8 @@ const genBorderedStyle = (token: ListToken): CSSObject => {
|
||||||
const genResponsiveStyle = (token: ListToken): CSSObject => {
|
const genResponsiveStyle = (token: ListToken): CSSObject => {
|
||||||
const { componentCls, screenSM, screenMD, marginLG, marginSM, margin } = token;
|
const { componentCls, screenSM, screenMD, marginLG, marginSM, margin } = token;
|
||||||
return {
|
return {
|
||||||
[`@media screen and (max-width:${screenMD})`]: {
|
[`@media screen and (max-width:${screenMD}px)`]: {
|
||||||
[`${componentCls}`]: {
|
[componentCls]: {
|
||||||
[`${componentCls}-item`]: {
|
[`${componentCls}-item`]: {
|
||||||
[`${componentCls}-item-action`]: {
|
[`${componentCls}-item-action`]: {
|
||||||
marginInlineStart: marginLG,
|
marginInlineStart: marginLG,
|
||||||
|
@ -72,8 +137,8 @@ const genResponsiveStyle = (token: ListToken): CSSObject => {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
[`@media screen and (max-width: ${screenSM})`]: {
|
[`@media screen and (max-width: ${screenSM}px)`]: {
|
||||||
[`${componentCls}`]: {
|
[componentCls]: {
|
||||||
[`${componentCls}-item`]: {
|
[`${componentCls}-item`]: {
|
||||||
flexWrap: 'wrap',
|
flexWrap: 'wrap',
|
||||||
|
|
||||||
|
@ -92,7 +157,7 @@ const genResponsiveStyle = (token: ListToken): CSSObject => {
|
||||||
},
|
},
|
||||||
|
|
||||||
[`${componentCls}-item-extra`]: {
|
[`${componentCls}-item-extra`]: {
|
||||||
margin: `auto auto ${margin}px`,
|
margin: `auto auto ${unit(margin)}`,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -110,32 +175,44 @@ const genBaseStyle: GenerateStyle<ListToken> = token => {
|
||||||
paddingSM,
|
paddingSM,
|
||||||
marginLG,
|
marginLG,
|
||||||
padding,
|
padding,
|
||||||
listItemPadding,
|
itemPadding,
|
||||||
colorPrimary,
|
colorPrimary,
|
||||||
listItemPaddingSM,
|
itemPaddingSM,
|
||||||
listItemPaddingLG,
|
itemPaddingLG,
|
||||||
paddingXS,
|
paddingXS,
|
||||||
margin,
|
margin,
|
||||||
colorText,
|
colorText,
|
||||||
colorTextDescription,
|
colorTextDescription,
|
||||||
motionDurationSlow,
|
motionDurationSlow,
|
||||||
lineWidth,
|
lineWidth,
|
||||||
|
headerBg,
|
||||||
|
footerBg,
|
||||||
|
emptyTextPadding,
|
||||||
|
metaMarginBottom,
|
||||||
|
avatarMarginRight,
|
||||||
|
titleMarginBottom,
|
||||||
|
descriptionFontSize,
|
||||||
} = token;
|
} = token;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
[`${componentCls}`]: {
|
[componentCls]: {
|
||||||
...resetComponent(token),
|
...resetComponent(token),
|
||||||
position: 'relative',
|
position: 'relative',
|
||||||
'*': {
|
'*': {
|
||||||
outline: 'none',
|
outline: 'none',
|
||||||
},
|
},
|
||||||
|
[`${componentCls}-header`]: {
|
||||||
|
background: headerBg,
|
||||||
|
},
|
||||||
|
[`${componentCls}-footer`]: {
|
||||||
|
background: footerBg,
|
||||||
|
},
|
||||||
[`${componentCls}-header, ${componentCls}-footer`]: {
|
[`${componentCls}-header, ${componentCls}-footer`]: {
|
||||||
background: 'transparent',
|
|
||||||
paddingBlock: paddingSM,
|
paddingBlock: paddingSM,
|
||||||
},
|
},
|
||||||
|
|
||||||
[`${componentCls}-pagination`]: {
|
[`${componentCls}-pagination`]: {
|
||||||
marginBlockStart: marginLG,
|
marginBlockStart: marginLG,
|
||||||
textAlign: 'end',
|
|
||||||
|
|
||||||
// https://github.com/ant-design/ant-design/issues/20037
|
// https://github.com/ant-design/ant-design/issues/20037
|
||||||
[`${antCls}-pagination-options`]: {
|
[`${antCls}-pagination-options`]: {
|
||||||
|
@ -158,7 +235,7 @@ const genBaseStyle: GenerateStyle<ListToken> = token => {
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
alignItems: 'center',
|
alignItems: 'center',
|
||||||
justifyContent: 'space-between',
|
justifyContent: 'space-between',
|
||||||
padding: listItemPadding,
|
padding: itemPadding,
|
||||||
color: colorText,
|
color: colorText,
|
||||||
|
|
||||||
[`${componentCls}-item-meta`]: {
|
[`${componentCls}-item-meta`]: {
|
||||||
|
@ -168,7 +245,7 @@ const genBaseStyle: GenerateStyle<ListToken> = token => {
|
||||||
maxWidth: '100%',
|
maxWidth: '100%',
|
||||||
|
|
||||||
[`${componentCls}-item-meta-avatar`]: {
|
[`${componentCls}-item-meta-avatar`]: {
|
||||||
marginInlineEnd: padding,
|
marginInlineEnd: avatarMarginRight,
|
||||||
},
|
},
|
||||||
|
|
||||||
[`${componentCls}-item-meta-content`]: {
|
[`${componentCls}-item-meta-content`]: {
|
||||||
|
@ -178,7 +255,7 @@ const genBaseStyle: GenerateStyle<ListToken> = token => {
|
||||||
},
|
},
|
||||||
|
|
||||||
[`${componentCls}-item-meta-title`]: {
|
[`${componentCls}-item-meta-title`]: {
|
||||||
marginBottom: token.marginXXS,
|
margin: `0 0 ${unit(token.marginXXS)} 0`,
|
||||||
color: colorText,
|
color: colorText,
|
||||||
fontSize: token.fontSize,
|
fontSize: token.fontSize,
|
||||||
lineHeight: token.lineHeight,
|
lineHeight: token.lineHeight,
|
||||||
|
@ -187,7 +264,7 @@ const genBaseStyle: GenerateStyle<ListToken> = token => {
|
||||||
color: colorText,
|
color: colorText,
|
||||||
transition: `all ${motionDurationSlow}`,
|
transition: `all ${motionDurationSlow}`,
|
||||||
|
|
||||||
[`&:hover`]: {
|
'&:hover': {
|
||||||
color: colorPrimary,
|
color: colorPrimary,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -195,7 +272,7 @@ const genBaseStyle: GenerateStyle<ListToken> = token => {
|
||||||
|
|
||||||
[`${componentCls}-item-meta-description`]: {
|
[`${componentCls}-item-meta-description`]: {
|
||||||
color: colorTextDescription,
|
color: colorTextDescription,
|
||||||
fontSize: token.fontSize,
|
fontSize: descriptionFontSize,
|
||||||
lineHeight: token.lineHeight,
|
lineHeight: token.lineHeight,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -207,16 +284,16 @@ const genBaseStyle: GenerateStyle<ListToken> = token => {
|
||||||
fontSize: 0,
|
fontSize: 0,
|
||||||
listStyle: 'none',
|
listStyle: 'none',
|
||||||
|
|
||||||
[`& > li`]: {
|
'& > li': {
|
||||||
position: 'relative',
|
position: 'relative',
|
||||||
display: 'inline-block',
|
display: 'inline-block',
|
||||||
padding: `0 ${paddingXS}px`,
|
padding: `0 ${unit(paddingXS)}`,
|
||||||
color: colorTextDescription,
|
color: colorTextDescription,
|
||||||
fontSize: token.fontSize,
|
fontSize: token.fontSize,
|
||||||
lineHeight: token.lineHeight,
|
lineHeight: token.lineHeight,
|
||||||
textAlign: 'center',
|
textAlign: 'center',
|
||||||
|
|
||||||
[`&:first-child`]: {
|
'&:first-child': {
|
||||||
paddingInlineStart: 0,
|
paddingInlineStart: 0,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -226,7 +303,7 @@ const genBaseStyle: GenerateStyle<ListToken> = token => {
|
||||||
insetBlockStart: '50%',
|
insetBlockStart: '50%',
|
||||||
insetInlineEnd: 0,
|
insetInlineEnd: 0,
|
||||||
width: lineWidth,
|
width: lineWidth,
|
||||||
height: Math.ceil(token.fontSize * token.lineHeight) - token.marginXXS * 2,
|
height: token.calc(token.fontHeight).sub(token.calc(token.marginXXS).mul(2)).equal(),
|
||||||
transform: 'translateY(-50%)',
|
transform: 'translateY(-50%)',
|
||||||
backgroundColor: token.colorSplit,
|
backgroundColor: token.colorSplit,
|
||||||
},
|
},
|
||||||
|
@ -234,14 +311,14 @@ const genBaseStyle: GenerateStyle<ListToken> = token => {
|
||||||
},
|
},
|
||||||
|
|
||||||
[`${componentCls}-empty`]: {
|
[`${componentCls}-empty`]: {
|
||||||
padding: `${padding}px 0`,
|
padding: `${unit(padding)} 0`,
|
||||||
color: colorTextDescription,
|
color: colorTextDescription,
|
||||||
fontSize: token.fontSizeSM,
|
fontSize: token.fontSizeSM,
|
||||||
textAlign: 'center',
|
textAlign: 'center',
|
||||||
},
|
},
|
||||||
|
|
||||||
[`${componentCls}-empty-text`]: {
|
[`${componentCls}-empty-text`]: {
|
||||||
padding,
|
padding: emptyTextPadding,
|
||||||
color: token.colorTextDisabled,
|
color: token.colorTextDisabled,
|
||||||
fontSize: token.fontSize,
|
fontSize: token.fontSize,
|
||||||
textAlign: 'center',
|
textAlign: 'center',
|
||||||
|
@ -272,10 +349,11 @@ const genBaseStyle: GenerateStyle<ListToken> = token => {
|
||||||
},
|
},
|
||||||
|
|
||||||
[`${componentCls}-item-meta`]: {
|
[`${componentCls}-item-meta`]: {
|
||||||
marginBlockEnd: padding,
|
marginBlockEnd: metaMarginBottom,
|
||||||
|
|
||||||
[`${componentCls}-item-meta-title`]: {
|
[`${componentCls}-item-meta-title`]: {
|
||||||
marginBlockEnd: paddingSM,
|
marginBlockStart: 0,
|
||||||
|
marginBlockEnd: titleMarginBottom,
|
||||||
color: colorText,
|
color: colorText,
|
||||||
fontSize: token.fontSizeLG,
|
fontSize: token.fontSizeLG,
|
||||||
lineHeight: token.lineHeightLG,
|
lineHeight: token.lineHeightLG,
|
||||||
|
@ -287,9 +365,9 @@ const genBaseStyle: GenerateStyle<ListToken> = token => {
|
||||||
marginInlineStart: 'auto',
|
marginInlineStart: 'auto',
|
||||||
|
|
||||||
'> li': {
|
'> li': {
|
||||||
padding: `0 ${padding}px`,
|
padding: `0 ${unit(padding)}`,
|
||||||
|
|
||||||
[`&:first-child`]: {
|
'&:first-child': {
|
||||||
paddingInlineStart: 0,
|
paddingInlineStart: 0,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -297,31 +375,31 @@ const genBaseStyle: GenerateStyle<ListToken> = token => {
|
||||||
},
|
},
|
||||||
|
|
||||||
[`${componentCls}-split ${componentCls}-item`]: {
|
[`${componentCls}-split ${componentCls}-item`]: {
|
||||||
borderBlockEnd: `${token.lineWidth}px ${token.lineType} ${token.colorSplit}`,
|
borderBlockEnd: `${unit(token.lineWidth)} ${token.lineType} ${token.colorSplit}`,
|
||||||
|
|
||||||
[`&:last-child`]: {
|
'&:last-child': {
|
||||||
borderBlockEnd: 'none',
|
borderBlockEnd: 'none',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
[`${componentCls}-split ${componentCls}-header`]: {
|
[`${componentCls}-split ${componentCls}-header`]: {
|
||||||
borderBlockEnd: `${token.lineWidth}px ${token.lineType} ${token.colorSplit}`,
|
borderBlockEnd: `${unit(token.lineWidth)} ${token.lineType} ${token.colorSplit}`,
|
||||||
},
|
},
|
||||||
[`${componentCls}-split${componentCls}-empty ${componentCls}-footer`]: {
|
[`${componentCls}-split${componentCls}-empty ${componentCls}-footer`]: {
|
||||||
borderTop: `${token.lineWidth}px ${token.lineType} ${token.colorSplit}`,
|
borderTop: `${unit(token.lineWidth)} ${token.lineType} ${token.colorSplit}`,
|
||||||
},
|
},
|
||||||
[`${componentCls}-loading ${componentCls}-spin-nested-loading`]: {
|
[`${componentCls}-loading ${componentCls}-spin-nested-loading`]: {
|
||||||
minHeight: controlHeight,
|
minHeight: controlHeight,
|
||||||
},
|
},
|
||||||
[`${componentCls}-split${componentCls}-something-after-last-item ${antCls}-spin-container > ${componentCls}-items > ${componentCls}-item:last-child`]:
|
[`${componentCls}-split${componentCls}-something-after-last-item ${antCls}-spin-container > ${componentCls}-items > ${componentCls}-item:last-child`]:
|
||||||
{
|
{
|
||||||
borderBlockEnd: `${token.lineWidth}px ${token.lineType} ${token.colorSplit}`,
|
borderBlockEnd: `${unit(token.lineWidth)} ${token.lineType} ${token.colorSplit}`,
|
||||||
},
|
},
|
||||||
[`${componentCls}-lg ${componentCls}-item`]: {
|
[`${componentCls}-lg ${componentCls}-item`]: {
|
||||||
padding: listItemPaddingLG,
|
padding: itemPaddingLG,
|
||||||
},
|
},
|
||||||
[`${componentCls}-sm ${componentCls}-item`]: {
|
[`${componentCls}-sm ${componentCls}-item`]: {
|
||||||
padding: listItemPaddingSM,
|
padding: itemPaddingSM,
|
||||||
},
|
},
|
||||||
// Horizontal
|
// Horizontal
|
||||||
[`${componentCls}:not(${componentCls}-vertical)`]: {
|
[`${componentCls}:not(${componentCls}-vertical)`]: {
|
||||||
|
@ -334,21 +412,32 @@ const genBaseStyle: GenerateStyle<ListToken> = token => {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const prepareComponentToken: GetDefaultToken<'List'> = token => ({
|
||||||
|
contentWidth: 220,
|
||||||
|
itemPadding: `${unit(token.paddingContentVertical)} 0`,
|
||||||
|
itemPaddingSM: `${unit(token.paddingContentVerticalSM)} ${unit(token.paddingContentHorizontal)}`,
|
||||||
|
itemPaddingLG: `${unit(token.paddingContentVerticalLG)} ${unit(
|
||||||
|
token.paddingContentHorizontalLG,
|
||||||
|
)}`,
|
||||||
|
headerBg: 'transparent',
|
||||||
|
footerBg: 'transparent',
|
||||||
|
emptyTextPadding: token.padding,
|
||||||
|
metaMarginBottom: token.padding,
|
||||||
|
avatarMarginRight: token.padding,
|
||||||
|
titleMarginBottom: token.paddingSM,
|
||||||
|
descriptionFontSize: token.fontSize,
|
||||||
|
});
|
||||||
|
|
||||||
// ============================== Export ==============================
|
// ============================== Export ==============================
|
||||||
export default genComponentStyleHook(
|
export default genStyleHooks(
|
||||||
'List',
|
'List',
|
||||||
token => {
|
token => {
|
||||||
const listToken = mergeToken<ListToken>(token, {
|
const listToken = mergeToken<ListToken>(token, {
|
||||||
listBorderedCls: `${token.componentCls}-bordered`,
|
listBorderedCls: `${token.componentCls}-bordered`,
|
||||||
minHeight: token.controlHeightLG,
|
minHeight: token.controlHeightLG,
|
||||||
listItemPadding: `${token.paddingContentVertical}px ${token.paddingContentHorizontalLG}px`,
|
|
||||||
listItemPaddingSM: `${token.paddingContentVerticalSM}px ${token.paddingContentHorizontal}px`,
|
|
||||||
listItemPaddingLG: `${token.paddingContentVerticalLG}px ${token.paddingContentHorizontalLG}px`,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return [genBaseStyle(listToken), genBorderedStyle(listToken), genResponsiveStyle(listToken)];
|
return [genBaseStyle(listToken), genBorderedStyle(listToken), genResponsiveStyle(listToken)];
|
||||||
},
|
},
|
||||||
{
|
prepareComponentToken,
|
||||||
contentWidth: 220,
|
|
||||||
},
|
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue