Skip to content

Commit

Permalink
fix(Chip): correctly display disabled state
Browse files Browse the repository at this point in the history
  • Loading branch information
benjamincharity committed Dec 16, 2019
1 parent c1d51ea commit 1c588d0
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 4 deletions.
5 changes: 5 additions & 0 deletions demo/app/components/chip/chip.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ <h3 tsCardTitle tsVerticalSpacing>Chip</h3>
Allow selection:
<input type="checkbox" [(ngModel)]="selectable">
</label>
<br>
<label>
Disable:
<input type="checkbox" [(ngModel)]="disabled">
</label>
</div>


Expand Down
25 changes: 21 additions & 4 deletions terminus-ui/chip/src/chip.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@


.ts-chip {
--chip-fontSize: 14px;
--chip-height: #{spacing(large)};
--chip-padding: #{spacing(small, 2)} #{spacing(small, 1)};
--chip-backgroundColor: #{color(utility, light)};
--chip-backgroundColor-hover: #{color(utility)};
--chip-backgroundColor: #{color(utility, light)};
--chip-borderRadius: 16px;
--chip-color: #{color(pure, dark)};
--chip-fontSize: 14px;
--chip-height: #{spacing(large)};
--chip-padding: #{spacing(small, 2)} #{spacing(small, 1)};
--chip-remove-size: #{spacing(large)};

&:focus,
Expand All @@ -23,6 +23,13 @@
transition: opacity 200ms cubic-bezier(.35, 0, .25, 1);
}
}

.c-chip {
&:not(.c-chip--disabled) {
--chip-backgroundColor: var(--chip-backgroundColor-hover);
transition: opacity 200ms cubic-bezier(.35, 0, .25, 1);
}
}
}

&.ts-chip--selected,
Expand Down Expand Up @@ -75,6 +82,16 @@
}
}

&.c-chip--disabled {
--chip-color: #{color(utility, dark)};
padding: var(--chip-padding);
pointer-events: none;

.c-chip__remove {
display: none;
}
}

.c-chip__remove {
cursor: cursor(pointer);
display: none;
Expand Down

0 comments on commit 1c588d0

Please sign in to comment.