coveo-search-ui
Version:
Coveo JavaScript Search Framework
28 lines (23 loc) • 620 B
text/typescript
import { $$ } from '../../../utils/Dom';
export interface IDynamicFacetValueMoreLessButtonOptions {
label: string;
ariaLabel: string;
className: string;
action: () => void;
}
export class DynamicFacetValueShowMoreLessButton {
public element: HTMLElement;
constructor(options: IDynamicFacetValueMoreLessButtonOptions) {
const btn = $$(
'button',
{
className: options.className,
ariaLabel: options.ariaLabel,
type: 'button'
},
options.label
);
this.element = $$('li', { role: 'none' }, btn).el;
btn.on('click', () => options.action());
}
}