Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

General: Animate content sidebar on toggle #9412

Merged
merged 5 commits into from
Oct 5, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
[ngbTooltip]="(isCollapsed ? 'Expand' : 'Collapse') + ' Menu (Ctrl + M)'"
(click)="toggleCollapseState()"
>
<div [attr.aria-expanded]="!isCollapsed" aria-controls="collapseBasic">
<div class="double-arrow-icon" [attr.aria-expanded]="!isCollapsed" aria-controls="collapseBasic">
<fa-icon class="me-negative fa-xs" [icon]="faChevronRight" />
<fa-icon class="fa-xs" [icon]="faChevronRight" />
</div>
PaRangger marked this conversation as resolved.
Show resolved Hide resolved
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,19 +107,29 @@ $exam-test-run-offset: 38px;
}

.double-arrow.menu-closed {
transform: translate(24px) rotate(0deg);
transform: translate(24px);
}

.double-arrow {
transform: translate(187px) rotate(180deg);
transition: all ease 0.2s;
transform: translate(187px);
transition: transform ease 0.3s;
cursor: pointer;
width: 30px;
align-items: center;
justify-content: center;
display: flex;
}

.menu-closed .double-arrow-icon {
transform: rotate(0deg);
}

.double-arrow-icon {
transform: rotate(180deg);

transition: transform ease 0.3s 0.3s;
}
PaRangger marked this conversation as resolved.
Show resolved Hide resolved

krusche marked this conversation as resolved.
Show resolved Hide resolved
.me-negative {
margin-right: -5px;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
}
@if (isCodeOfConductAccepted && isServiceSetUp && course) {
<div class="d-flex justify-content-between">
<div class="me-3" [ngClass]="{ 'sidebar-collapsed': isCollapsed }">
<div [ngClass]="{ 'sidebar-collapsed': isCollapsed }">
<jhi-sidebar
(onSelectConversation)="onConversationSelected($event)"
(onUpdateSidebar)="prepareSidebarData()"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div class="d-flex justify-content-between gap-3">
<div class="d-flex justify-content-between">
@if (course) {
PaRangger marked this conversation as resolved.
Show resolved Hide resolved
<div id="exam-sidebar-test" [ngClass]="{ 'sidebar-collapsed': isCollapsed }" [hidden]="isExamStarted">
<jhi-sidebar [itemSelected]="examSelected" [courseId]="courseId" [sidebarData]="sidebarData" [collapseState]="DEFAULT_COLLAPSE_STATE" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div class="d-flex justify-content-between gap-3 horizontal-scroll">
<div class="d-flex justify-content-between horizontal-scroll">
@if (course) {
<div [ngClass]="{ 'sidebar-collapsed': isCollapsed }">
<jhi-sidebar [itemSelected]="exerciseSelected" [courseId]="courseId" [sidebarData]="sidebarData" [collapseState]="DEFAULT_COLLAPSE_STATE" [showFilter]="true" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div class="d-flex justify-content-between gap-3">
<div class="d-flex justify-content-between">
@if (course) {
<div [ngClass]="{ 'sidebar-collapsed': isCollapsed }">
<jhi-sidebar [itemSelected]="lectureSelected" [courseId]="courseId" [sidebarData]="sidebarData" [collapseState]="DEFAULT_COLLAPSE_STATE" />
Expand Down
4 changes: 2 additions & 2 deletions src/main/webapp/app/overview/course-overview.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
<fa-icon [fixedWidth]="true" [icon]="faEllipsis" class="ms-2 me-3" />
<span
class="more"
[ngClass]="{ 'auto-collapse': !isNavbarCollapsed, 'sidebar-collapsed': isNavbarCollapsed }"
[ngClass]="{ 'auto-collapse': !isNavbarCollapsed, 'sidebar-collapsed-course-overview': isNavbarCollapsed }"
PaRangger marked this conversation as resolved.
Show resolved Hide resolved
[jhiTranslate]="'artemisApp.courseOverview.menu.more'"
></span>
</div>
Expand Down Expand Up @@ -121,7 +121,7 @@
[ngbTooltip]="(isNavbarCollapsed ? 'Expand' : 'Collapse') + ' Menu (Ctrl + M)'"
(click)="toggleCollapseState()"
>
<div [attr.aria-expanded]="!isNavbarCollapsed" aria-controls="collapseBasic">
<div class="double-arrow-icon" [attr.aria-expanded]="!isNavbarCollapsed" aria-controls="collapseBasic">
<fa-icon class="me-negative fa-xs" [icon]="faChevronRight" />
<fa-icon class="fa-xs" [icon]="faChevronRight" />
</div>
Expand Down
31 changes: 26 additions & 5 deletions src/main/webapp/app/overview/course-overview.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ $menu-width-open: 220px;
$breadcrumb-height: 45px; // needed to make the exam fullscreen

// Sidebar Button Transition Variables
$transition-delay: 0.1s;
$transition-delay: 0.3s;
$transition-in-between-delay: 0.2s;
$transition-chevron-rotate-length: 0.2s;
$transition-chevron-max-width-length: 0.2s;
Expand Down Expand Up @@ -196,19 +196,29 @@ jhi-secured-image {
}

.double-arrow.menu-closed {
transform: translate(16px) rotate(0deg);
transform: translate(16px);
krusche marked this conversation as resolved.
Show resolved Hide resolved
}

.double-arrow {
transform: translate(180px) rotate(180deg);
transition: all ease 0.3s;
transform: translate(180px);
transition: transform ease 0.3s;
cursor: pointer;
width: 30px;
align-items: center;
justify-content: center;
display: flex;
}

.menu-closed .double-arrow-icon {
transform: rotate(0deg);
}

.double-arrow-icon {
transform: rotate(180deg);

transition: transform ease 0.3s 0.3s;
}
krusche marked this conversation as resolved.
Show resolved Hide resolved

.me-negative {
margin-right: -5px;
}
Expand Down Expand Up @@ -290,8 +300,19 @@ jhi-secured-image {
transition: opacity $transition-color-length $transition-delay + $transition-chevron-rotate-length * 2 ease-in-out;
}

.btn-sidebar-collapse:hover::after,
.btn-sidebar-collapse:hover::after {
background-color: var(--sidebar-card-selected-bg);
}

.btn-sidebar-collapse:hover::before {
background-color: var(--link-item-bg);
}

.btn-sidebar-collapse:active::after {
background-color: var(--link-item-bg);
}

.btn-sidebar-collapse:active::before {
background-color: var(--sidebar-card-selected-bg);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div class="d-flex justify-content-between gap-3">
<div class="d-flex justify-content-between">
@if (course) {
<div [ngClass]="{ 'sidebar-collapsed': isCollapsed }">
<jhi-sidebar [itemSelected]="tutorialGroupSelected" [courseId]="courseId" [sidebarData]="sidebarData" [collapseState]="DEFAULT_COLLAPSE_STATE" />
Expand Down
140 changes: 71 additions & 69 deletions src/main/webapp/app/shared/sidebar/sidebar.component.html
Original file line number Diff line number Diff line change
@@ -1,74 +1,76 @@
<div class="d-flex sidebar rounded-3 px-3 sidebar-width hide-on_print" [ngClass]="{ 'sidebar-height-dev': !isProduction || isTestServer, collapsed: isCollapsed }">
<div class="w-100 bg-module">
<div class="sidebar-content" [ngClass]="{ collapsed: isCollapsed }">
@if (searchFieldEnabled) {
<div class="mt-2 mb-2">
<jhi-search-filter (newSearchEvent)="setSearchValue($event)" class="mb-2" />
@if (showFilter) {
<div class="ms-2 mt-1 text-primary">
<a (click)="openFilterExercisesDialog()">
@if (isFilterActive) {
<fa-icon [icon]="faFilterCurrentlyApplied" />
} @else {
<fa-icon [icon]="faFilter" />
}
<span jhiTranslate="artemisApp.courseOverview.exerciseFilter.filter"></span>
</a>
</div>
}
</div>
}
@if (!sidebarData?.ungroupedData || !(sidebarData?.ungroupedData | searchFilter: ['title', 'type'] : searchValue)?.length) {
<div
[ngClass]="{ 'content-height-dev': !isProduction || isTestServer }"
[jhiTranslate]="
(sidebarDataBeforeFiltering?.ungroupedData?.length ?? 0) > 0 && sidebarData.ungroupedData?.length === 0
? 'artemisApp.courseOverview.general.noElementFoundWithAppliedFilter'
: 'artemisApp.courseOverview.general.noDataFound'
"
class="mt-2 text-center scrollable-item-content"
></div>
} @else {
<div
class="scrollable-item-content my-2"
[ngClass]="{
'content-height-dev': !isProduction || isTestServer,
'search-height-conversations': sidebarData?.sidebarType === 'conversation',
'search-height-normal': sidebarData?.sidebarType !== 'conversation',
}"
>
@if (sidebarData?.groupByCategory && sidebarData.groupedData) {
<jhi-sidebar-accordion
[searchValue]="searchValue"
[groupedData]="sidebarData.groupedData"
[sidebarType]="sidebarData.sidebarType"
[storageId]="sidebarData.storageId"
[routeParams]="routeParams"
[courseId]="courseId"
[itemSelected]="itemSelected"
[showAddOptions]="sidebarData.showAccordionAddOption ?? false"
[showLeadingIcon]="sidebarData.showAccordionLeadingIcon ?? false"
[showAddOption]="showAddOption"
[channelTypeIcon]="channelTypeIcon"
[collapseState]="collapseState"
(onUpdateSidebar)="onUpdateSidebar.emit()"
[isFilterActive]="isFilterActive"
/>
} @else {
@for (sidebarItem of sidebarData?.ungroupedData | searchFilter: ['title', 'type'] : searchValue; track sidebarItem; let last = $last) {
<div [ngClass]="{ 'mb-2': !last }">
<div
jhiSidebarCard
[size]="sidebarItem.size"
[itemSelected]="itemSelected"
[sidebarType]="sidebarData.sidebarType"
[sidebarItem]="sidebarItem"
></div>
<div class="sidebar-wrap">
<div class="d-flex sidebar rounded-3 px-3 sidebar-width hide-on_print" [ngClass]="{ 'sidebar-height-dev': !isProduction || isTestServer, collapsed: isCollapsed }">
<div class="w-100 bg-module">
PaRangger marked this conversation as resolved.
Show resolved Hide resolved
<div class="sidebar-content" [ngClass]="{ collapsed: isCollapsed }">
@if (searchFieldEnabled) {
<div class="mt-2 mb-2">
<jhi-search-filter (newSearchEvent)="setSearchValue($event)" class="mb-2" />
@if (showFilter) {
<div class="ms-2 mt-1 text-primary">
<a (click)="openFilterExercisesDialog()">
@if (isFilterActive) {
<fa-icon [icon]="faFilterCurrentlyApplied" />
} @else {
<fa-icon [icon]="faFilter" />
}
<span jhiTranslate="artemisApp.courseOverview.exerciseFilter.filter"></span>
</a>
</div>
}
}
</div>
}
</div>
}
@if (!sidebarData?.ungroupedData || !(sidebarData?.ungroupedData | searchFilter: ['title', 'type'] : searchValue)?.length) {
<div
[ngClass]="{ 'content-height-dev': !isProduction || isTestServer }"
[jhiTranslate]="
(sidebarDataBeforeFiltering?.ungroupedData?.length ?? 0) > 0 && sidebarData.ungroupedData?.length === 0
? 'artemisApp.courseOverview.general.noElementFoundWithAppliedFilter'
: 'artemisApp.courseOverview.general.noDataFound'
"
class="mt-2 text-center scrollable-item-content"
></div>
} @else {
<div
class="scrollable-item-content my-2"
[ngClass]="{
'content-height-dev': !isProduction || isTestServer,
'search-height-conversations': sidebarData?.sidebarType === 'conversation',
'search-height-normal': sidebarData?.sidebarType !== 'conversation',
}"
>
@if (sidebarData?.groupByCategory && sidebarData.groupedData) {
<jhi-sidebar-accordion
[searchValue]="searchValue"
[groupedData]="sidebarData.groupedData"
[sidebarType]="sidebarData.sidebarType"
[storageId]="sidebarData.storageId"
[routeParams]="routeParams"
[courseId]="courseId"
[itemSelected]="itemSelected"
[showAddOptions]="sidebarData.showAccordionAddOption ?? false"
[showLeadingIcon]="sidebarData.showAccordionLeadingIcon ?? false"
[showAddOption]="showAddOption"
[channelTypeIcon]="channelTypeIcon"
[collapseState]="collapseState"
(onUpdateSidebar)="onUpdateSidebar.emit()"
[isFilterActive]="isFilterActive"
/>
} @else {
@for (sidebarItem of sidebarData?.ungroupedData | searchFilter: ['title', 'type'] : searchValue; track sidebarItem; let last = $last) {
<div [ngClass]="{ 'mb-2': !last }">
<div
jhiSidebarCard
[size]="sidebarItem.size"
[itemSelected]="itemSelected"
[sidebarType]="sidebarData.sidebarType"
[sidebarItem]="sidebarItem"
></div>
</div>
}
}
</div>
}
</div>
</div>
PaRangger marked this conversation as resolved.
Show resolved Hide resolved
</div>
</div>
4 changes: 0 additions & 4 deletions src/main/webapp/app/shared/sidebar/sidebar.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@
background-color: var(--module-bg);
}

.sidebar-width {
width: 275px !important;
}

@media print {
.hide-on_print {
display: none !important;
Expand Down
41 changes: 40 additions & 1 deletion src/main/webapp/content/scss/global.scss
Original file line number Diff line number Diff line change
Expand Up @@ -1089,10 +1089,49 @@ body.transparent-background {
}
}

.sidebar-collapsed {
.sidebar-collapsed-course-overview {
display: none;
}
PaRangger marked this conversation as resolved.
Show resolved Hide resolved

$transition-sidebar-content-opacity-length: 0.1s;
$transition-sidebar-width-length: 0.1s;
$transition-in-between-delay: 0.05s;

.sidebar-content {
opacity: 1;

transition: opacity $transition-sidebar-content-opacity-length 0s ease-in-out;
}

.sidebar-collapsed .sidebar-content {
opacity: 0;

transition: opacity $transition-sidebar-content-opacity-length 0s ease-in-out;
}
PaRangger marked this conversation as resolved.
Show resolved Hide resolved

.sidebar-wrap {
overflow: hidden;
max-width: $sidebar-width;
margin-right: $spacer;

transition:
max-width $transition-sidebar-width-length 0s ease-in-out,
margin-right $transition-sidebar-width-length 0s ease-in-out;
}
PaRangger marked this conversation as resolved.
Show resolved Hide resolved

.sidebar-collapsed .sidebar-wrap {
max-width: 0;
margin-right: 0;

transition:
max-width $transition-sidebar-width-length 0s ease-in-out,
margin-right $transition-sidebar-width-length 0s ease-in-out;
}

.sidebar-width {
width: $sidebar-width !important;
}
PaRangger marked this conversation as resolved.
Show resolved Hide resolved

.fs-xx-small {
font-size: 0.625rem;
}
Expand Down
3 changes: 3 additions & 0 deletions src/main/webapp/content/scss/themes/_dark-variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,9 @@ $neutral-dark-l-20: lighten($neutral-dark, 20%);
$footer-bg: $neutral-dark;
$footer-height-dev: 3rem;
$footer-height-prod: 2rem;

// Sidebar
$sidebar-width: 275px;
$sidebar-footer-height-dev: 134px;
$sidebar-footer-height-prod: 118px;

Expand Down
3 changes: 3 additions & 0 deletions src/main/webapp/content/scss/themes/_default-variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,11 @@ $border-color: #dee2e6;
$footer-bg: $white;
$footer-height-dev: 3rem;
$footer-height-prod: 2rem;

// Sidebar
$sidebar-footer-height-dev: 134px;
$sidebar-footer-height-prod: 118px;
$sidebar-width: 275px;
PaRangger marked this conversation as resolved.
Show resolved Hide resolved

//Module and Navigationbar
$module-bg: $white;
Expand Down
Loading