Skip to content

Commit

Permalink
Improve chip styling within tables
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonkelly committed Mar 6, 2025
1 parent d1f1939 commit 51b07b3
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 24 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Release Notes for Craft CMS 5

## Unreleased

- Improved chip styling within tables. ([#16771](https://github.com/craftcms/cms/issues/16771))

## 5.6.11 - 2025-03-04

- Added `craft\base\conditions\BaseTextConditionRule::isEmpty()`.
Expand Down
6 changes: 5 additions & 1 deletion src/elements/Entry.php
Original file line number Diff line number Diff line change
Expand Up @@ -2066,7 +2066,11 @@ protected function attributeHtml(string $attribute): string
return $section ? Html::encode(Craft::t('site', $section->name)) : '';
case 'type':
try {
$config = [];
$config = [
'attributes' => [
'class' => 'chromeless',
],
];
if ($this->viewMode === 'cards') {
$config['showThumb'] = false;
}
Expand Down
6 changes: 1 addition & 5 deletions src/fields/BaseRelationField.php
Original file line number Diff line number Diff line change
Expand Up @@ -945,11 +945,7 @@ public function previewPlaceholderHtml(mixed $value, ?ElementInterface $element)
$mockup = new (static::elementType());
$mockup->title = Craft::t('app', 'Related {type} Title', ['type' => $mockup->displayName()]);

return Cp::chipHtml($mockup, [
'attributes' => [
'class' => ['chromeless'],
],
]);
return Cp::chipHtml($mockup);
}

/**
Expand Down
6 changes: 1 addition & 5 deletions src/fields/Entries.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,10 +160,6 @@ public function previewPlaceholderHtml(mixed $value, ?ElementInterface $element)

$mockup->sectionId = $section->id;

return Cp::chipHtml($mockup, [
'attributes' => [
'class' => ['chromeless'],
],
]);
return Cp::chipHtml($mockup);
}
}
6 changes: 0 additions & 6 deletions src/helpers/Cp.php
Original file line number Diff line number Diff line change
Expand Up @@ -1153,9 +1153,6 @@ public static function elementPreviewHtml(
'showStatus' => $showStatus,
'showThumb' => $showThumb,
'size' => $size,
'attributes' => [
'class' => ['chromeless'],
],
]);

if (!empty($elements)) {
Expand All @@ -1167,9 +1164,6 @@ public static function elementPreviewHtml(
'showStatus' => $showStatus,
'showThumb' => $showThumb,
'size' => $size,
'attributes' => [
'class' => ['chromeless'],
],
]);
}
$html .= Html::tag('span', '+' . Craft::$app->getFormatter()->asInteger(count($elements)), [
Expand Down
2 changes: 1 addition & 1 deletion src/web/assets/cp/dist/css/cp.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/web/assets/cp/dist/css/cp.css.map

Large diffs are not rendered by default.

14 changes: 9 additions & 5 deletions src/web/assets/cp/src/css/_main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3233,6 +3233,10 @@ table {
th,
td {
background-color: var(--hover-bg-color);

.chip:not(.chromeless) {
background-color: var(--gray-100);
}
}
}

Expand Down Expand Up @@ -3261,6 +3265,10 @@ table {
td {
color: var(--white);
background-color: var(--selected-bg-color);

.chip:not(.chromeless) {
background-color: var(--gray-600);
}
}

.icon,
Expand Down Expand Up @@ -3677,7 +3685,7 @@ table {
display: flex;
flex-flow: row wrap;
align-items: center;
gap: var(--s);
gap: var(--xs);

.chip {
margin: 0 !important;
Expand Down Expand Up @@ -4240,10 +4248,6 @@ table {
}
}

.chip {
background-color: transparent;
}

tr.disabled {
opacity: 1;

Expand Down

0 comments on commit 51b07b3

Please sign in to comment.