Skip to content

Commit

Permalink
Move the action button into the page header
Browse files Browse the repository at this point in the history
Resolves #14913
  • Loading branch information
brandonkelly committed May 25, 2024
1 parent 5f18e00 commit dbef744
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 7 deletions.
6 changes: 3 additions & 3 deletions src/templates/_layouts/cp.twig
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,6 @@ history.replaceState(undefined, undefined, window.location.href.match(/^[^#]*/)[
{{ contextMenu|raw }}
</div>
{% endif %}
{{ actionMenu|raw }}
</div>
<button
type="button"
Expand Down Expand Up @@ -225,12 +224,13 @@ history.replaceState(undefined, undefined, window.location.href.match(/^[^#]*/)[
{{ toolbar|raw }}
</div>
{% endif %}
{% if actionButton or additionalButtons %}
{% if actionButton or additionalButtons or actionMenu or details %}
<div id="action-buttons" class="flex">
{{ additionalButtons|raw }}
{{ actionButton|raw }}
{{ actionMenu|raw }}

{% if details is not empty %}
{% if details %}
{% set content %}
<span aria-hidden="true" class="cp-icon">{{ iconSvg('sidebar-end') }}</span>
<span class="visually-hidden">{{ 'Toggle details sidebar'|t('app') }}</span>
Expand Down
2 changes: 1 addition & 1 deletion src/web/CpScreenResponseFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ private function _formatTemplate(YiiResponse $response, CpScreenResponseBehavior
'hiddenLabel' => Craft::t('app', 'Actions'),
'buttonAttributes' => [
'id' => 'action-btn',
'class' => ['action-btn'],
'class' => ['action-btn', 'hairline-dark'],
'title' => Craft::t('app', 'Actions'),
],
]),
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.

5 changes: 5 additions & 0 deletions src/web/assets/cp/src/css/_cp.scss
Original file line number Diff line number Diff line change
Expand Up @@ -960,6 +960,11 @@ li.breadcrumb-toggle-wrapper {
}

#action-buttons {
.action-btn {
width: var(--ui-control-height);
height: var(--ui-control-height);
}

@media only screen and (max-width: 400px) {
.btngroup .btn:first-child {
flex-basis: 100%;
Expand Down
11 changes: 10 additions & 1 deletion src/web/assets/cp/src/css/_main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -1639,6 +1639,14 @@ ul.icons {
}
}

&.hairline-dark {
border: 1px solid var(--dark-hairline-color);

&:not(:hover):not(:active):not([aria-expanded='true']) {
background-color: transparent;
}
}

&.link-btn {
color: var(--link-color);

Expand Down Expand Up @@ -3514,7 +3522,8 @@ table {

& > .action-btn,
& > .move {
@include touch-target;
height: var(--touch-target-size);
width: var(--touch-target-size);
margin: 0 -4px;
&:before {
color: var(--custom-text-color, var(--ui-control-color));
Expand Down

0 comments on commit dbef744

Please sign in to comment.