/*
 * Copyright (C) 2019 Robert Bosch GmbH Copyright (C) 2019 Robert Bosch Manufacturing Solutions GmbH, Germany. All rights reserved.
 */

import { Component, ElementRef, Renderer2, ViewChild } from '@angular/core';
import { ResizeHandleSizeChangedEvent } from '@bci-web-core/core';

/**
 * This is a demo page that uses `bci-splitter` component, to demonstrate how should be used.
 * This component is a POC. Is subject to changes.
 */
@Component({
  selector: 'bci-splitter-demo',
  templateUrl: './splitter-demo.component.html',
  styleUrls: ['./splitter-demo.component.scss'],
})
export class SplitterDemoComponent {
  @ViewChild('sidenav', { read: ElementRef }) sidenav: ElementRef;

  constructor(private renderer: Renderer2) {}

  resizerChanged($event: ResizeHandleSizeChangedEvent) {
    this.renderer.setStyle(this.sidenav.nativeElement, 'width', `${$event.value}px`);
  }
}
