Skip to content

Commit

Permalink
add additional element to hide text during opacity transition
Browse files Browse the repository at this point in the history
  • Loading branch information
ZakaryH committed Feb 26, 2025
1 parent 2507013 commit 42ceb9a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
13 changes: 11 additions & 2 deletions packages/components/src/Chip/Chip.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,15 @@
height: 100%;
}

.truncateGradient > span {
position: absolute;
top: 0;
right: 0;
bottom: 0;
width: 10%;
background-color: var(--chip-base-bg-color);
}

.truncateGradient::before,
.truncateGradient::after {
content: "";
Expand All @@ -196,7 +205,7 @@
.truncateGradient::before {
background: linear-gradient(
to left,
var(--chip-base-bg-color) 5%,
var(--chip-base-bg-color) 10%,
rgba(255, 255, 255, 0)
);
opacity: 1;
Expand All @@ -205,7 +214,7 @@
.truncateGradient::after {
background: linear-gradient(
to left,
var(--chip-base-hover-bg-color) 5%,
var(--chip-base-hover-bg-color) 10%,
rgba(255, 255, 255, 0)
);
opacity: 0;
Expand Down
4 changes: 3 additions & 1 deletion packages/components/src/Chip/Chip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,9 @@ export const Chip = ({
<div
className={styles.truncateGradient}
data-testid="ATL-Chip-Truncation-Gradient"
/>
>
<span />
</div>
)}
</div>
{suffix}
Expand Down

0 comments on commit 42ceb9a

Please sign in to comment.