1/*
2 * Copyright (C) 2024 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17import {Component, EventEmitter, Input, Output} from '@angular/core';
18
19@Component({
20  selector: 'collapsible-section-title',
21  template: `
22      <button
23        mat-icon-button
24        matTooltip="Collapse"
25        (click)="onCollapseButtonClick()">
26        <mat-icon class="material-symbols-outlined"> left_panel_close </mat-icon>
27      </button>
28      <h2 class="mat-title">{{title.toUpperCase()}}</h2>
29    `,
30  styles: [
31    `
32      :host {
33        display: flex;
34        flex-direction: row;
35      }
36      :host button {
37        padding-top: 4px;
38        margin-right: 4px;
39        width: 24px;
40      }
41      .mat-title {
42        padding-top: 8px;
43      }
44    `,
45  ],
46})
47export class CollapsibleSectionTitleComponent {
48  @Input() title: string | undefined;
49
50  @Output() collapseButtonClicked = new EventEmitter();
51
52  onCollapseButtonClick() {
53    this.collapseButtonClicked.emit();
54  }
55}
56