Enhancing my comprehension regarding the mentioned images.
If I don't select anything within the div property, the default style (css) should appear like this, at least when one div is selected. However, the issue arises when unable to select.
This is the component in question:
<div *ngFor="let item of data; let i = index;" (click)="setRow(i)"
[ngClass]="{'highlight': selectedIndex===i}" class="cycleHover"
>
{{item}}
</div>
CSS:
.cycleHover{
cursor: pointer;
padding: 5px 20px;
margin: 4px;
font-style: normal;
font-weight: 700;
font-size: 14px;
// line-height: 18px;
color: #010103;
}
.highlight{
background-color: #fff;
padding: 5px 20px;
margin: 4px;
color: #737D88;
box-shadow: 0px 4px 12px rgba(0, 0, 0, 0.05);
border-radius: 24px;
}
Typescript:
selectedIndex: any;
data: any[] = ["D", "W", "M", "Q", "Y"];
setRow(_index: number) {
this.selectedIndex = _index;
}