demarches-normaliennes/app/javascript/controllers/dsfr_header_controller.ts

16 lines
479 B
TypeScript

import { ApplicationController } from './application_controller';
export class DSFRHeaderController extends ApplicationController {
static targets = ['notice'];
declare readonly noticeTarget: HTMLElement;
closeNotice() {
this.noticeTarget.parentNode?.removeChild(this.noticeTarget);
this.element.classList.remove('fr-header__with-notice-info');
const event = new CustomEvent('noticeClosed', { bubbles: true });
this.element.dispatchEvent(event);
}
}