Skip to content

Commit

Permalink
fix(internet-header): fix lint error by fixing some typescript errors…
Browse files Browse the repository at this point in the history
… within the DrodpwnElement type
  • Loading branch information
oliverschuerch committed May 15, 2024
1 parent 81190a9 commit c8ce4a6
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,7 @@ import {
import { SvgSprite } from '../../utils/svg-sprite.component';
import { SvgIcon } from '../../utils/svg-icon.component';
import { state } from '../../data/store';
import {
DropdownElement,
DropdownEvent,
HasDropdown,
NavLangEntity,
} from '../../models/header.model';
import { DropdownEvent, HasDropdown, NavLangEntity } from '../../models/header.model';
import { elementHasTransition, userPrefersReducedMotion } from '../../services/ui.service';
import { translate } from '../../services/language.service';
import { PostLanguageSwitchList } from './components/post-language-switch-list';
Expand All @@ -35,7 +30,7 @@ export class PostLanguageSwitch implements HasDropdown {
*/
@Prop() mode: 'dropdown' | 'list';
@State() langSwitchOpen = false;
@Element() host: DropdownElement;
@Element() host: HTMLPostLanguageSwitchElement;
/**
* Fires when the dropdown has been toggled.
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
import { Component, Element, Event, EventEmitter, h, Host, Method, State } from '@stencil/core';
import { throttle } from 'throttle-debounce';
import { state } from '../../data/store';
import {
DropdownElement,
DropdownEvent,
HasDropdown,
IsFocusable,
NavMainEntity,
} from '../../models/header.model';
import { DropdownEvent, HasDropdown, IsFocusable, NavMainEntity } from '../../models/header.model';
import { userPrefersReducedMotion } from '../../services/ui.service';
import { translate } from '../../services/language.service';
import { SvgSprite } from '../../utils/svg-sprite.component';
Expand All @@ -30,7 +24,7 @@ export class PostMainNavigation implements HasDropdown, IsFocusable {
* Fires when the flyout has been toggled.
*/
@Event() flyoutToggled: EventEmitter<string | null>;
@Element() host: DropdownElement;
@Element() host: HTMLPostMainNavigationElement;
private throttledResize: throttle<() => void>;
private resizeTimer: number | null = null;
private mouseLeaveTimer: number | null = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { CoveoCompletion } from '../../models/coveo.model';
import { GeocodeLocation } from '../../models/geocode.model';
import { TagManagerDataLayer } from '../../models/general.model';
import {
DropdownElement,
DropdownEvent,
HasDropdown,
ISearchRecommendation,
Expand Down Expand Up @@ -42,7 +41,7 @@ export class PostSearch implements HasDropdown, IsFocusable {
* Fires when the dropdown has been toggled.
*/
@Event() dropdownToggled: EventEmitter<DropdownEvent>;
@Element() host: DropdownElement;
@Element() host: HTMLPostSearchElement;
private searchBox?: HTMLInputElement;
private searchFlyout: HTMLElement | undefined;
private throttledResize: throttle<() => void>;
Expand Down
7 changes: 5 additions & 2 deletions packages/internet-header/src/models/header.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,12 +158,15 @@ export interface IsFocusable {

export type FocusableElement = HTMLElement & IsFocusable;

export interface HasDropdown {
export interface IDropdownElement {
toggleDropdown: (force?: boolean) => Promise<boolean>;
}

export interface HasDropdown extends IDropdownElement {
dropdownToggled: EventEmitter<DropdownEvent>;
}

export type DropdownElement = HTMLElement & HasDropdown;
export type DropdownElement = HTMLElement & IDropdownElement;

export type DropdownEvent = { open: boolean; element: DropdownElement };

Expand Down

0 comments on commit c8ce4a6

Please sign in to comment.