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

Preprints branding update #1922

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
1 change: 0 additions & 1 deletion app/preprints/template.hbs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{{page-title this.theme.provider.providerTitle replace=true}}
<div {{with-branding (get-model this.theme.provider.brand)}}>
<ThemeStyles />
<BrandedNavbar
@translateKey='collections.general.brand'
@brandRoute='preprints.discover'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,14 @@ export default class BrandedNavbar extends Component {
@alias('theme.provider.id') providerId!: string;
@alias('theme.provider.brand.primaryColor') brandPrimaryColor!: BrandModel;

get useWhiteBackground(): boolean {
const { provider } = this.theme;
if (provider) {
return this.theme.providerType === 'preprint' && ['biohackrxiv', 'nutrixiv'].includes(provider.id);
}
return false;
}

@computed('intl.locale', 'theme.{providerType,provider.providerTitle}', 'translateKey')
get brandTitle(): string {
if (this.theme.providerType === 'collection') {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@
background-position-y: center;
background-size: contain;
background-repeat: no-repeat;
// This is overwritten by theme-styles component,
// but if there is no provider.asset.square_color_transparent, we fallback to use the logo off the brand
// Preprints uses the brand's navbar logo
// Collections uses the theme-styles component and will overwrite this
background-image: var(--navbar-logo-img-url);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be written more succinctly with:

// Preprints uses the brand logo
// Collections uses the theme-styles component

}

Expand Down Expand Up @@ -133,7 +133,7 @@
}
}

.biohackrxiv-branded-navbar.biohackrxiv-branded-navbar.biohackrxiv-branded-navbar {
.white-background-branded-navbar.white-background-branded-navbar.white-background-branded-navbar {
background-color: #fff;

a,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
local-class='branded-nav
{{if (eq this.theme.providerType 'preprint') 'preprint-branded-navbar'}}
{{if (sufficient-contrast this.brandPrimaryColor '#fff') 'light-text' 'dark-text'}}
{{if (eq this.theme.id 'biohackrxiv') 'biohackrxiv-branded-navbar'}}'
{{if this.useWhiteBackground 'white-background-branded-navbar'}}'
class='navbar navbar-inverse navbar-fixed-top'
id='navbarScope'
>
Expand Down
6 changes: 6 additions & 0 deletions mirage/fixtures/preprint-providers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,12 @@ const preprintProviders: Array<Partial<PreprintProvider>> = [
preprintWord: 'preprint',
assets: randomAssets(),
},
{
id: 'nutrixiv',
name: 'NutriXiv',
preprintWord: 'preprint',
assets: randomAssets(),
},
];

export default preprintProviders;
13 changes: 12 additions & 1 deletion mirage/scenarios/preprints.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,21 @@ export function preprintsScenario(
description: '<p style="color: black">This is the description for agrixiv!</p>',
});

const nutrixiv = server.schema.preprintProviders.find('nutrixiv') as ModelInstance<PreprintProvider>;
const nutrixivBrand = server.create('brand', {
primaryColor: '#000000',
secondaryColor: '#888888',
heroBackgroundImage: 'https://singlecolorimage.com/get/4a4a4a/1000x1000',
});
nutrixiv.update({
brand: nutrixivBrand,
description: '<p style="color: green">This is the description for nutrixiv!</p>',
});

const biohackrxiv = server.schema.preprintProviders.find('biohackrxiv') as ModelInstance<PreprintProvider>;
const biohackrxivBrand = server.create('brand', {
primaryColor: '#000000',
secondaryColor: '#888888',
secondaryColor: '#ccc',
heroBackgroundImage: 'https://singlecolorimage.com/get/ffffff/1000x1000',
});
biohackrxiv.update({
Expand Down
Loading