Skip to content

Commit

Permalink
Themed LangSwitchComponent
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandrevryghem committed Sep 26, 2023
1 parent c7c4b28 commit 12177df
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/app/shared/lang-switch/lang-switch.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export class LangSwitchComponent implements OnInit {
this.activeLangs = environment.languages.filter((MyLangConfig) => MyLangConfig.active === true);
this.moreThanOneLanguage = (this.activeLangs.length > 1);
if (!this.moreThanOneLanguage) {
this.el.nativeElement.style.display = 'none';
this.el.nativeElement.parentElement.classList.add('d-none');
}
}

Expand Down
27 changes: 27 additions & 0 deletions src/app/shared/lang-switch/themed-lang-switch.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { Component } from '@angular/core';
import { ThemedComponent } from '../theme-support/themed.component';
import { LangSwitchComponent } from './lang-switch.component';

/**
* Themed wrapper for {@link LangSwitchComponent}
*/
@Component({
selector: 'ds-themed-lang-switch',
styleUrls: [],
templateUrl: '../theme-support/themed.component.html',
})
export class ThemedLangSwitchComponent extends ThemedComponent<LangSwitchComponent> {

protected getComponentName(): string {
return 'LangSwitchComponent';
}

protected importThemedComponent(themeName: string): Promise<any> {
return import(`../../../themes/${themeName}/app/shared/lang-switch/themed-lang-switch.component`);
}

protected importUnthemedComponent(): Promise<any> {
return import(`./lang-switch.component`);
}

}
2 changes: 2 additions & 0 deletions src/app/shared/shared.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,7 @@ import {
} from '../item-page/simple/field-components/specific-field/title/themed-item-page-field.component';
import { BitstreamListItemComponent } from './object-list/bitstream-list-item/bitstream-list-item.component';
import { NgxPaginationModule } from 'ngx-pagination';
import { ThemedLangSwitchComponent } from './lang-switch/themed-lang-switch.component';

const MODULES = [
CommonModule,
Expand Down Expand Up @@ -335,6 +336,7 @@ const COMPONENTS = [
DsSelectComponent,
ErrorComponent,
LangSwitchComponent,
ThemedLangSwitchComponent,
LoadingComponent,
ThemedLoadingComponent,
LogInComponent,
Expand Down
Empty file.
Empty file.
10 changes: 10 additions & 0 deletions src/themes/custom/app/shared/lang-switch/lang-switch.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { Component } from '@angular/core';
import { LangSwitchComponent as BaseComponent } from '../../../../../app/shared/lang-switch/lang-switch.component';

@Component({
selector: 'ds-lang-switch',
styleUrls: ['./lang-switch.component.scss'],
templateUrl: './lang-switch.component.html',
})
export class LangSwitchComponent extends BaseComponent {
}
2 changes: 2 additions & 0 deletions src/themes/custom/eager-theme.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ import {
ItemSearchResultListElementComponent
} from './app/shared/object-list/search-result-list-element/item-search-result/item-types/item/item-search-result-list-element.component';
import { TopLevelCommunityListComponent } from './app/home-page/top-level-community-list/top-level-community-list.component';
import { LangSwitchComponent } from './app/shared/lang-switch/lang-switch.component';


/**
Expand Down Expand Up @@ -91,6 +92,7 @@ const DECLARATIONS = [
EditCollectionSelectorComponent,
EditCommunitySelectorComponent,
EditItemSelectorComponent,
LangSwitchComponent,
];

@NgModule({
Expand Down

0 comments on commit 12177df

Please sign in to comment.