Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 46 additions & 1 deletion resources/css/components/publish.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/* GROUP PUBLISH COMPONENT
=================================================== */

.publish-fields,
.field-grid {
display: grid;
Expand Down Expand Up @@ -144,3 +143,49 @@ Here flexbox is much better suited to create a layout that grows to fill space.
top: 0;
z-index: var(--z-index-portal);
}

/* GROUP COLLAPSIBLE PUBLISH SECTIONS
=================================================== */
.publish-section-collapsible {
--timing: ease;
/* No animation on load; enable once the user has toggled this section. */
--speed: 0ms;

/* Only setting the animation speed when the section is interacted with. Prevents the animation triggering on page load. */
&.publish-section-collapsible--interacted {
--speed: 250ms;
}

@media (prefers-reduced-motion: reduce) {
--speed: 0ms;
}
}

.publish-section-collapsible--expanded {
/* We can animate collapse/expand using grid rows */
animation: expand-rows var(--speed) var(--timing) forwards;

.publish-section-collapsible__inner {
animation: calc(var(--speed) * 2) var(--timing) section-fade-in both;
overflow: clip;
/* We need to increase the clip margin here vs regular collapsible sections because we have things appearing outside the section such as the logic indicator icon. */
overflow-clip-margin: 2.5rem;
}
}

.publish-section-collapsible--collapsed {
animation: collapse-rows var(--speed) var(--timing) forwards;

.publish-section-collapsible__inner {
animation:
clip-overflow 0ms var(--speed) forwards,
make-invisible 0ms var(--speed) forwards;
overflow: clip;
}
}

@keyframes section-fade-in { from { opacity: 0%; } to { opacity: 100%; } }
@keyframes make-invisible { from { visibility: visible; } to { visibility: hidden; } }
@keyframes collapse-rows { from { grid-template-rows: 1fr; } to { grid-template-rows: 0fr; } }
@keyframes expand-rows { from { grid-template-rows: 0fr; } to { grid-template-rows: 1fr; } }
@keyframes clip-overflow { to { overflow: clip; } }
41 changes: 24 additions & 17 deletions resources/js/components/ui/Publish/Sections.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ function renderInstructions(instructions) {

function toggleSection(section) {
if (section.collapsible) {
section.collapsibleInteracted = true;
section.collapsed = !section.collapsed;
}
}
Expand Down Expand Up @@ -75,7 +76,10 @@ function toggleSection(section) {
</PanelHeader>
<div
class="publish-section-collapsible grid"
:class="section.collapsed ? 'publish-section-collapsible--collapsed' : 'publish-section-collapsible--expanded'"
:class="[
section.collapsed ? 'publish-section-collapsible--collapsed' : 'publish-section-collapsible--expanded',
{ 'publish-section-collapsible--interacted': section.collapsibleInteracted },
]"
>
<div class="publish-section-collapsible__inner min-h-0">
<Card :class="{ 'p-0!': asConfig }">
Expand All @@ -92,13 +96,15 @@ function toggleSection(section) {
</template>

<style scoped>
[class*="publish-section-collapsible"] {
.publish-section-collapsible {
--timing: ease;
/* No animation on load; enable once the user has toggled this section. */
--speed: 0ms;
/* Only setting the animation speed when the panel is hovered prevents the animation triggering on page load. */
[data-ui-panel]:hover & {

/* Only setting the animation speed when the section is interacted with. Prevents the animation triggering on page load. */
&.publish-section-collapsible--interacted {
--speed: 250ms;
}
--timing: ease;

@media (prefers-reduced-motion: reduce) {
--speed: 0ms;
Expand All @@ -108,23 +114,24 @@ function toggleSection(section) {
.publish-section-collapsible--expanded {
/* We can animate collapse/expand using grid rows */
animation: expand-rows var(--speed) var(--timing) forwards;

.publish-section-collapsible__inner {
animation: calc(var(--speed) * 2) var(--timing) section-fade-in both;
overflow: clip;
/* We need to increase the clip margin here vs regular collapsible sections because we have things appearing outside the section such as the logic indicator icon. */
overflow-clip-margin: 2.5rem;
}
}

.publish-section-collapsible--collapsed {
animation: collapse-rows var(--speed) var(--timing) forwards;
}

.publish-section-collapsible--expanded .publish-section-collapsible__inner {
animation: calc(var(--speed) * 2) var(--timing) section-fade-in both;
overflow: clip;
overflow-clip-margin: 4px;
}

.publish-section-collapsible--collapsed .publish-section-collapsible__inner {
animation:
clip-overflow 0ms var(--speed) forwards,
make-invisible 0ms var(--speed) forwards;
overflow: clip;
.publish-section-collapsible__inner {
animation:
clip-overflow 0ms var(--speed) forwards,
make-invisible 0ms var(--speed) forwards;
overflow: clip;
}
}

@keyframes section-fade-in { from { opacity: 0%; } to { opacity: 100%; } }
Expand Down
Loading