Skip to content

Commit

Permalink
fix(NcModal): Adjust modal header name and actions
Browse files Browse the repository at this point in the history
- Fix size and margin of header name to work with new server styles on Nextcloud 30+
- Fix focus-visible, hover and open color of header actions on bright color theme

Signed-off-by: Ferdinand Thiessen <[email protected]>
  • Loading branch information
susnux authored and backportbot[bot] committed Jun 14, 2024
1 parent 27dbb98 commit acad4c6
Showing 1 changed file with 30 additions and 13 deletions.
43 changes: 30 additions & 13 deletions src/components/NcModal/NcModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ depending on whether you require the Modal to stay within the DOM or not. Do not
:outTransition="true"
:hasNext="true"
:hasPrevious="true">
<template #actions>
<NcActionCaption name="Some action" />
</template>
<div class="modal__content">Hello world</div>
</NcModal>
</div>
Expand Down Expand Up @@ -200,7 +203,7 @@ export default {
<div class="modal-header">
<h2 v-if="name.trim() !== ''"
:id="'modal-name-' + randId"
class="modal-name">
class="modal-header__name">
{{ name }}
</h2>
<div class="icons-menu">
Expand Down Expand Up @@ -239,7 +242,7 @@ export default {

<!-- Actions menu -->
<NcActions class="header-actions" :inline="inlineActions">
<!-- @slot List of actions to show -->
<!-- @slot Actions to show (one or more NcAction* components) -->
<slot name="actions" />
</NcActions>

Expand Down Expand Up @@ -823,22 +826,22 @@ export default {
overflow: hidden;
transition: opacity 250ms, visibility 250ms;
.modal-name {
&__name {
overflow-x: hidden;
box-sizing: border-box;
width: 100%;
padding: 0 #{$clickable-area * 3} 0 12px; // maximum actions is 3
transition: padding ease 100ms;
white-space: nowrap;
text-overflow: ellipsis;
color: #fff;
font-size: $icon-margin;
margin-bottom: 0;
color: #fff; // Always rendered on dark background
font-size: $icon-size;
margin-block: 0;
}
// On wider screens the name can be centered
@media only screen and (min-width: $breakpoint-mobile) {
.modal-name {
&__name {
padding-left: #{$clickable-area * 3}; // maximum actions is 3
text-align: center;
}
Expand Down Expand Up @@ -889,10 +892,6 @@ export default {
}
}
.header-actions {
color: white;
}
&:deep() .action-item {
margin: math.div($header-height - $clickable-area, 2);
Expand All @@ -906,9 +905,27 @@ export default {
}
}
:deep(button) {
// force white instead of default main text
// The modal ignores the color theme and adds a black backdrop
// so we need to add custom color of the actions toggle
.header-actions {
--open-background-color: #3e3e3e;
color: #fff;
:deep(button) {
// force white instead of default main text
color: #fff;
&:hover, &:active {
// Also fix the hover color
background-color: var(--open-background-color) !important;
}
// Fix the focus visible color
&:focus-visible {
box-shadow: none !important;
outline: 2px solid #fff !important;
}
}
}
// Force the Actions menu icon to be the same size as other icons
Expand Down

0 comments on commit acad4c6

Please sign in to comment.