Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[UI Framework] Add and Remove state for kui table rows #11020

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions ui_framework/components/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,18 @@ $titleFontSize: 18px;
// Button
$buttonBorderRadius: 4px;

// Animation
$globalAnimLinear: linear;
$globalAnimEase: ease-in-out;
$globalAnimSlightBounce: cubic-bezier(0.34,1.61,0.7,1);
$globalAnimSlightResistance: cubic-bezier(0.694, 0.0482, 0.335, 1);

$globalAnimSpeedVeryFast: 90ms;
$globalAnimSpeedFast: 150ms;
$globalAnimSpeedNormal: 250ms;
$globalAnimSpeedSlow: 350ms;
$globalAnimSpeedVerySlow: 500ms;

// Colors
$infoColor: #3fa8c7;
$inactiveColor: #c3c3c3;
Expand Down
9 changes: 9 additions & 0 deletions ui_framework/components/table/_table.scss
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,22 @@ $tableCellPadding: 7px 8px 8px;
}

.kuiTableRow {
transition: background $globalAnimSlightResistance $globalAnimSpeedSlow;
&:hover {
.kuiTableRowHoverReveal {
display: inline-block;
}
}
}

.kuiTableRow-isDeleted {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Chatted with @snide off-PR. This class name will be changed to kuiTableRow-isBeingDeleted to reflect more accurately what this style will convey.

background: lighten($errorColor, 35%);
}

.kuiTableRow-isNew {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've been nesting these state classes inside of the root component alongside the pseudo-classes, since they're both used to communicate states. E.g. https://github.com/elastic/kibana/blob/master/ui_framework/components/tabs/_tabs.scss#L54

What do you think? Do you have a preference?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cjcenizal This is why I'd rather use mixins for the css classes, so no preference is allowed :)

I generally don't mind nested classes, but I didn't see much in your code so I kept it out. I'll switch it around if that's the norm.

background: lighten($successColor, 70%);
}

.kuiTableRowHoverReveal {
display: none;
}
Expand Down
13 changes: 11 additions & 2 deletions ui_framework/dist/ui_framework.css
Original file line number Diff line number Diff line change
Expand Up @@ -1888,8 +1888,17 @@ body {
.kuiTableSortIcon {
pointer-events: none; }

.kuiTableRow:hover .kuiTableRowHoverReveal {
display: inline-block; }
.kuiTableRow {
-webkit-transition: background cubic-bezier(0.694, 0.0482, 0.335, 1) 350ms;
transition: background cubic-bezier(0.694, 0.0482, 0.335, 1) 350ms; }
.kuiTableRow:hover .kuiTableRowHoverReveal {
display: inline-block; }

.kuiTableRow-isDeleted {
background: #f9e5e3; }

.kuiTableRow-isNew {
background: #f1fee1; }

.kuiTableRowHoverReveal {
display: none; }
Expand Down
14 changes: 7 additions & 7 deletions ui_framework/doc_site/src/views/table/table.html
Original file line number Diff line number Diff line change
Expand Up @@ -97,20 +97,20 @@ <h3 class="kuiSubTitle">
</td>
</tr>

<tr class="kuiTableRow">
<tr class="kuiTableRow kuiTableRow-isNew">
<td class="kuiTableRowCell kuiTableRowCell--checkBox">
<div class="kuiTableRowCell__liner">
<input type="checkbox" class="kuiCheckBox">
</div>
</td>
<td class="kuiTableRowCell">
<div class="kuiTableRowCell__liner">
<a class="kuiLink" href="#">Celebration of some very long content that will affect cell width and should eventually become truncated</a>
<a class="kuiLink" href="#">This is newly added row</a>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small typo: This is a newly added row

</div>
</td>
<td class="kuiTableRowCell">
<div class="kuiTableRowCell__liner">
<div class="kuiIcon kuiIcon--warning fa-bolt"></div>
<div class="kuiIcon kuiIcon--error fa-warning"></div>
</div>
</td>
<td class="kuiTableRowCell">
Expand All @@ -125,20 +125,20 @@ <h3 class="kuiSubTitle">
</td>
</tr>

<tr class="kuiTableRow">
<tr class="kuiTableRow kuiTableRow-isDeleted">
<td class="kuiTableRowCell kuiTableRowCell--checkBox">
<div class="kuiTableRowCell__liner">
<input type="checkbox" class="kuiCheckBox">
<input type="checkbox" class="kuiCheckBox" disabled>
</div>
</td>
<td class="kuiTableRowCell">
<div class="kuiTableRowCell__liner">
<a class="kuiLink" href="#">Dog</a>
<p class="kuiText">This row is in the process of being deleted</p>
</div>
</td>
<td class="kuiTableRowCell">
<div class="kuiTableRowCell__liner">
<div class="kuiIcon kuiIcon--error fa-warning"></div>
<div class="kuiIcon kuiIcon--warning fa-bolt"></div>
</div>
</td>
<td class="kuiTableRowCell">
Expand Down