Skip to content

Commit 24f3a40

Browse files
authored
Feat(collections-branding): Collections branding (CenterForOpenScience#285)
* feat(collections-branding): added collections branding * feat(collections-branding): changed hero logo height
1 parent ffdce35 commit 24f3a40

File tree

21 files changed

+97
-21
lines changed

21 files changed

+97
-21
lines changed

src/app/core/components/header/header.component.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
<div class="header-dropdown-button ml-auto">
55
@if (currentUser()) {
66
<p-button
7-
class="custom-dark-hover"
87
icon="fas fa-chevron-down"
98
iconPos="right"
109
variant="text"

src/app/core/components/header/header.component.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
&:hover,
1717
&:active {
18-
--p-button-text-contrast-color: var(--dark-blue-2);
18+
filter: contrast(2);
1919
}
2020
}
2121
}

src/app/features/collections/components/add-to-collection/add-to-collection.component.html

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,11 @@
44
class="collections-sub-header flex justify-content-between flex-column gap-4 mb-4 sm:mb-6 sm:gap-0 sm:flex-row"
55
>
66
<div class="flex gap-3">
7-
<i class="collections-icon text-white osf-icon-collections"></i>
8-
<h1 class="flex align-items-center text-white">{{ collectionProvider()?.name }}</h1>
7+
@let provider = collectionProvider();
8+
@if (provider && provider.brand) {
9+
<img class="collections-logo" alt="Collections Logo" height="64" [src]="provider.brand.heroLogoImageUrl" />
10+
}
11+
<h1 class="collections-heading flex align-items-center">{{ collectionProvider()?.name }}</h1>
912
</div>
1013
</div>
1114

src/app/features/collections/components/add-to-collection/add-to-collection.component.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ import {
2828
CreateCollectionSubmission,
2929
} from '@osf/features/collections/store/add-to-collection';
3030
import { LoadingSpinnerComponent } from '@shared/components';
31+
import { HeaderStyleHelper } from '@shared/helpers';
3132
import { CanDeactivateComponent } from '@shared/models';
33+
import { BrandService } from '@shared/services';
3234
import { CollectionsSelectors, GetCollectionProvider } from '@shared/stores';
3335
import { ProjectsSelectors } from '@shared/stores/projects/projects.selectors';
3436

@@ -163,8 +165,20 @@ export class AddToCollectionComponent implements CanDeactivateComponent {
163165
this.destroyRef.onDestroy(() => {
164166
this.actions.clearAddToCollectionState();
165167
this.allowNavigation.set(false);
168+
169+
HeaderStyleHelper.resetToDefaults();
170+
BrandService.resetBranding();
166171
});
167172
});
173+
174+
effect(() => {
175+
const provider = this.collectionProvider();
176+
177+
if (provider && provider.brand) {
178+
BrandService.applyBranding(provider.brand);
179+
HeaderStyleHelper.applyHeaderStyles(provider.brand.secondaryColor, provider.brand.backgroundColor || '');
180+
}
181+
});
168182
}
169183

170184
@HostListener('window:beforeunload', ['$event'])

src/app/features/collections/components/collections-discover/collections-discover.component.html

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,12 @@
44
class="collections-sub-header flex justify-content-between flex-column gap-4 mb-4 sm:mb-6 sm:gap-0 sm:flex-row"
55
>
66
<div class="flex gap-3">
7-
<i class="collections-icon text-white osf-icon-collections"></i>
8-
<h1 class="flex align-items-center text-white">{{ collectionProvider()?.name }}</h1>
7+
@let provider = collectionProvider();
8+
@if (provider && provider.brand) {
9+
<img class="collections-logo" alt="Collections Logo" height="64" [src]="provider.brand.heroLogoImageUrl" />
10+
}
11+
12+
<h1 class="collections-heading flex align-items-center">{{ collectionProvider()?.name }}</h1>
913
</div>
1014

1115
<p-button
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
@use "assets/styles/mixins" as mix;
22

33
:host {
4-
--collection-bg-color: #013b5c;
54
@include mix.flex-column;
65
flex: 1;
76
}

src/app/features/collections/components/collections-discover/collections-discover.component.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ import { ActivatedRoute, Router, RouterLink } from '@angular/router';
1515
import { CollectionsHelpDialogComponent, CollectionsMainContentComponent } from '@osf/features/collections/components';
1616
import { CollectionsQuerySyncService } from '@osf/features/collections/services';
1717
import { LoadingSpinnerComponent, SearchInputComponent } from '@shared/components';
18+
import { HeaderStyleHelper } from '@shared/helpers';
1819
import { CollectionsFilters } from '@shared/models';
20+
import { BrandService } from '@shared/services';
1921
import {
2022
ClearCollections,
2123
ClearCollectionSubmissions,
@@ -114,6 +116,15 @@ export class CollectionsDiscoverComponent {
114116
}
115117
});
116118

119+
effect(() => {
120+
const provider = this.collectionProvider();
121+
122+
if (provider && provider.brand) {
123+
BrandService.applyBranding(provider.brand);
124+
HeaderStyleHelper.applyHeaderStyles(provider.brand.secondaryColor, provider.brand.backgroundColor || '');
125+
}
126+
});
127+
117128
effect(() => {
118129
const searchText = this.searchText();
119130
const sortBy = this.sortBy();
@@ -143,6 +154,8 @@ export class CollectionsDiscoverComponent {
143154
effect(() => {
144155
this.destroyRef.onDestroy(() => {
145156
this.actions.clearCollections();
157+
HeaderStyleHelper.resetToDefaults();
158+
BrandService.resetBranding();
146159
});
147160
});
148161
}

src/app/features/preprints/mappers/preprint-providers.mapper.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ export class PreprintProvidersMapper {
2828
topNavLogoImageUrl: brandRaw.attributes.topnav_logo_image,
2929
primaryColor: brandRaw.attributes.primary_color,
3030
secondaryColor: brandRaw.attributes.secondary_color,
31+
backgroundColor: brandRaw.attributes.background_color,
3132
},
3233
iri: response.links.iri,
3334
faviconUrl: response.attributes.assets.favicon,

src/app/features/project/overview/components/recent-activity/recent-activity.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ <h2 class="mb-2">{{ 'project.overview.recentActivity.title' | translate }}</h2>
44
@if (!isLoading()) {
55
@if (formattedActivityLogs().length) {
66
@for (activityLog of formattedActivityLogs(); track activityLog.id) {
7-
<div class="activities-activity flex justify-content-between gap-3 pb-2 align-items-center">
7+
<div class="activities-activity flex justify-content-between pb-2 align-items-center">
88
<div [innerHTML]="activityLog.formattedActivity"></div>
99
<p class="hidden activity-date sm:block text-right">{{ activityLog.date | date: 'MMM d, y hh:mm a' }}</p>
1010
</div>

src/app/features/project/overview/components/recent-activity/recent-activity.component.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
border-bottom: 1px solid var.$grey-2;
1111

1212
.activity-date {
13-
width: 30%;
13+
min-width: 27%;
1414
}
1515
}
1616

0 commit comments

Comments
 (0)