Skip to content

Commit

Permalink
feat(daffio): update api list item background color to animate via op…
Browse files Browse the repository at this point in the history
…acity (#2734)
  • Loading branch information
xelaint committed Jan 19, 2024
1 parent 57b30fc commit faacca5
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
outline: none;
}

&:hover {
&:after {
background: daff-theme.daff-illuminate($base, $gray, 2);
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
@use '../../../../scss/type-descriptors/mixins' as type-mixin;
@use 'utilities' as daff;

$api-list-item-border-radius: 4px;

:host {
display: flex;
flex-direction: column;
Expand Down Expand Up @@ -33,7 +35,7 @@
}

> * {
@include daff.single-line-ellipsis();
@include daff.text-truncate();

@include daff.breakpoint(mobile) {
display: inline-block;
Expand All @@ -49,7 +51,7 @@
@include daff.breakpoint(tablet) {
grid-template-columns: repeat(2, 1fr);
}

@include daff.breakpoint(small-laptop) {
grid-template-columns: repeat(3, 1fr);
}
Expand All @@ -58,15 +60,34 @@
&__item {
display: flex;
align-items: center;
border-radius: 4px;
border-radius: $api-list-item-border-radius;
justify-content: space-between;
overflow: hidden;
padding: 8px;
transition: background-color 300ms;
}
position: relative;

&:after {
content: '';
border-radius: $api-list-item-border-radius;
position: absolute;
left: 0;
top: 0;
height: 100%;
width: 100%;
opacity: 0;
transition: opacity 300ms;
z-index: 1;
}

&:hover {
&:after {
opacity: 1;
}
}
}

&__item-name {
@include daff.single-line-ellipsis();
@include daff.text-truncate();
}

&__item-label {
Expand All @@ -75,4 +96,9 @@
padding: 4px;
margin-left: 16px;
}

&__item-name,
&__item-label {
z-index: 2;
}
}
1 change: 0 additions & 1 deletion apps/daffio/src/scss/type-descriptors/_mixins.scss
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ $base-contrast: daff-theme.daff-map-deep-get(daff-theme.$theme, 'core.base-contr
font-size: 0.625rem;
box-sizing: border-box;
text-transform: uppercase;
transition: background-color 300ms;

&.class {
@include type-theming(daff-theme.daff-color($primary));
Expand Down

0 comments on commit faacca5

Please sign in to comment.