fix(ui): inconsistent pill sizes across admin panel (#12788)

### What?
Fixes inconsistent `pill` sizes across the Admin Panel.

### How?
Pills without a specified size default to **medium**. In the folders
[PR](https://github.com/payloadcms/payload/pull/10030), additional
padding was to the medium size. As a result, any pills without an
explicit size now appear larger than intended.

This PR fixes that by updating any pills that should be small to
explicitly set `size="small"`.

Fixes #12752
This commit is contained in:
Jessica Rynkar
2025-06-12 15:43:00 +01:00
committed by GitHub
parent b556fe3daf
commit 9364d51f4b
12 changed files with 17 additions and 10 deletions

View File

@@ -143,7 +143,7 @@ export const SelectComparison: React.FC<Props> = (props) => {
const formattedLabel = locale?.label?.[i18n?.language] || locale?.label const formattedLabel = locale?.label?.[i18n?.language] || locale?.label
if (formattedLabel) { if (formattedLabel) {
publishedLocalePill = <Pill>{formattedLabel}</Pill> publishedLocalePill = <Pill size="small">{formattedLabel}</Pill>
} }
} }

View File

@@ -71,13 +71,13 @@ export const AutosaveCell: React.FC<AutosaveCellProps> = ({
const formattedLabel = locale?.label?.[i18n?.language] || locale?.label const formattedLabel = locale?.label?.[i18n?.language] || locale?.label
if (formattedLabel) { if (formattedLabel) {
publishedLocalePill = <Pill>{formattedLabel}</Pill> publishedLocalePill = <Pill size="small">{formattedLabel}</Pill>
} }
} }
return ( return (
<div className={`${baseClass}__items`}> <div className={`${baseClass}__items`}>
{rowData?.autosave && <Pill>{t('version:autosave')}</Pill>} {rowData?.autosave && <Pill size="small">{t('version:autosave')}</Pill>}
{status && renderPill(rowData, latestVersion, currentLabel, previousLabel, pillStyle)} {status && renderPill(rowData, latestVersion, currentLabel, previousLabel, pillStyle)}
{publishedLocalePill} {publishedLocalePill}
</div> </div>

View File

@@ -5,7 +5,7 @@ export const ReindexButtonLabel = () => {
i18n: { t }, i18n: { t },
} = useTranslation() } = useTranslation()
return ( return (
<Pill className="pill--has-action" icon={<ChevronIcon />} pillStyle="light"> <Pill className="pill--has-action" icon={<ChevronIcon />} pillStyle="light" size="small">
{t('general:reindex')} {t('general:reindex')}
</Pill> </Pill>
) )

View File

@@ -92,6 +92,7 @@ export function FileSidebar() {
<Pill <Pill
className={`${baseClass}__header__addFile`} className={`${baseClass}__header__addFile`}
onClick={() => openModal(addMoreFilesDrawerSlug)} onClick={() => openModal(addMoreFilesDrawerSlug)}
size="small"
> >
{t('upload:addFile')} {t('upload:addFile')}
</Pill> </Pill>

View File

@@ -25,7 +25,7 @@ export function ListDrawerCreateNewDocButton({
className={`${baseClass}__create-new-button`} className={`${baseClass}__create-new-button`}
key="create-new-button-toggler" key="create-new-button-toggler"
> >
<Pill>{t('general:createNew')}</Pill> <Pill size="small">{t('general:createNew')}</Pill>
</DocumentDrawerToggler> </DocumentDrawerToggler>
) )
} }

View File

@@ -41,7 +41,7 @@ export const buildUpcomingColumns = ({
const type = doc.input?.type const type = doc.input?.type
return ( return (
<Pill key={doc.id} pillStyle={type === 'publish' ? 'success' : 'warning'}> <Pill key={doc.id} pillStyle={type === 'publish' ? 'success' : 'warning'} size="small">
{type === 'publish' && t('version:publish')} {type === 'publish' && t('version:publish')}
{type === 'unpublish' && t('version:unpublish')} {type === 'unpublish' && t('version:unpublish')}
</Pill> </Pill>

View File

@@ -21,7 +21,7 @@ export const QueryPresetsColumnsCell: React.FC<DefaultCellComponentProps> = ({ c
} }
return ( return (
<Pill key={i} pillStyle={isColumnActive ? 'always-white' : 'light'}> <Pill key={i} pillStyle={isColumnActive ? 'always-white' : 'light'} size="small">
{toWords(column)} {toWords(column)}
</Pill> </Pill>
) )

View File

@@ -23,7 +23,11 @@ export const QueryPresetsColumnField: JSONFieldClientComponent = ({
const isColumnActive = !column.startsWith('-') const isColumnActive = !column.startsWith('-')
return ( return (
<Pill key={i} pillStyle={isColumnActive ? 'always-white' : 'light-gray'}> <Pill
key={i}
pillStyle={isColumnActive ? 'always-white' : 'light-gray'}
size="small"
>
{toWords(column)} {toWords(column)}
</Pill> </Pill>
) )

View File

@@ -44,7 +44,7 @@ const transformWhereToNaturalLanguage = (
} }
return ( return (
<Pill pillStyle="always-white"> <Pill pillStyle="always-white" size="small">
<b>{toWords(key)}</b> {operator} <b>{toWords(value)}</b> <b>{toWords(key)}</b> {operator} <b>{toWords(value)}</b>
</Pill> </Pill>
) )

View File

@@ -300,6 +300,7 @@ export const RelationshipTable: React.FC<RelationshipTableComponentProps> = (pro
icon={<ChevronIcon direction={openColumnSelector ? 'up' : 'down'} />} icon={<ChevronIcon direction={openColumnSelector ? 'up' : 'down'} />}
onClick={() => setOpenColumnSelector(!openColumnSelector)} onClick={() => setOpenColumnSelector(!openColumnSelector)}
pillStyle="light" pillStyle="light"
size="small"
> >
{t('general:columns')} {t('general:columns')}
</Pill> </Pill>

View File

@@ -25,6 +25,7 @@ export const SelectMany: React.FC<{
} }
}} }}
pillStyle="white" pillStyle="white"
size="small"
> >
{`Select ${count}`} {`Select ${count}`}
</Pill> </Pill>

View File

@@ -205,7 +205,7 @@ export const renderTable = ({
}, },
Heading: i18n.t('version:type'), Heading: i18n.t('version:type'),
renderedCells: docs.map((doc, i) => ( renderedCells: docs.map((doc, i) => (
<Pill key={i}> <Pill key={i} size="small">
{getTranslation( {getTranslation(
collections collections
? payload.collections[doc.relationTo].config.labels.singular ? payload.collections[doc.relationTo].config.labels.singular