Skip to content

Commit

Permalink
fix: hide chipped content selectors when JS disabled (#305)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidlj95 authored Mar 15, 2024
1 parent cdc98d8 commit 6552ec6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div class="chips" [ngClass]="DISPLAY_BLOCK_IF_NO_SCRIPT_CLASS">
<div class="chips" [ngClass]="DISPLAY_NONE_IF_NO_SCRIPT_CLASS">
<app-chip
*ngFor="let content of contents"
[selected]="selectedContentId === content.id"
Expand Down
10 changes: 6 additions & 4 deletions src/app/resume-page/chipped-content/chipped-content.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ import { ChippedContent } from './chipped-content'
import { ChipComponent } from '../chip/chip.component'
import { isPlatformBrowser, NgClass, NgFor } from '@angular/common'
import { TestIdDirective } from '../../common/test-id.directive'
import { DISPLAY_BLOCK_IF_NO_SCRIPT_CLASS } from '../../common/no-script'
import {
DISPLAY_BLOCK_IF_NO_SCRIPT_CLASS,
DISPLAY_NONE_IF_NO_SCRIPT_CLASS,
} from '../../common/no-script'

@Component({
selector: 'app-chipped-content',
Expand All @@ -37,6 +40,8 @@ export class ChippedContentComponent implements OnInit {
private selectedContentComponent?: Type<unknown>
private readonly isRenderingOnBrowser: boolean
@Output() contentDisplayedChange = new EventEmitter<boolean>()
protected readonly DISPLAY_NONE_IF_NO_SCRIPT_CLASS =
DISPLAY_NONE_IF_NO_SCRIPT_CLASS

constructor(@Inject(PLATFORM_ID) platformId: object) {
this.isRenderingOnBrowser = isPlatformBrowser(platformId)
Expand Down Expand Up @@ -99,7 +104,4 @@ export class ChippedContentComponent implements OnInit {
contentComponentRef.instance as Type<unknown>
return contentComponentRef
}

protected readonly DISPLAY_BLOCK_IF_NO_SCRIPT_CLASS =
DISPLAY_BLOCK_IF_NO_SCRIPT_CLASS
}

0 comments on commit 6552ec6

Please sign in to comment.