Skip to content

Commit

Permalink
perf(CSS transitions): improved duration of transitions (#3016)
Browse files Browse the repository at this point in the history
* fix(CSS transitions): improved duration of transitions

* test(Sidebar): fix tests
  • Loading branch information
simonguo committed Jan 12, 2023
1 parent 9d6f43e commit d1829da
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 30 deletions.
1 change: 0 additions & 1 deletion src/Picker/styles/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,6 @@
display: block;
padding: @picker-item-content-padding-vertical @picker-item-content-padding-horizontal
@picker-item-content-padding-vertical @picker-check-item-content-padding-left;
transition: @picker-item-transition;
line-height: @line-height-computed;

.high-contrast-mode({
Expand Down
21 changes: 1 addition & 20 deletions src/Picker/styles/mixin.less
Original file line number Diff line number Diff line change
Expand Up @@ -31,21 +31,15 @@
padding: @picker-item-content-padding-vertical @picker-item-content-padding-horizontal;
padding-right: (@padding-x + @dropdown-caret-width + @dropdown-caret-padding);
position: relative;
cursor: default;
transition: @picker-item-transition;
cursor: pointer;
color: var(--rs-text-heading);

&:hover {
background-color: var(--rs-state-hover-bg);
}

.rs-@{prefix}-menu-group-caret {
display: inline-block;
margin-left: 2px;
position: absolute;
top: @padding-y;
right: @padding-x;
transition: transform 0.3s linear;
padding: 3px;
}
}
Expand All @@ -60,19 +54,6 @@
}
}

.picker-select-item() {
display: block;
padding: @picker-item-content-padding-vertical @picker-item-content-padding-horizontal;
clear: both;
font-weight: normal;
line-height: @line-height-base;
color: var(--rs-text-primary);
cursor: pointer; //fixed link has not [href] style
transition: @picker-item-transition;
text-decoration: none;
width: 100%;
}

.picker-item-hover() {
color: var(--rs-text-primary);
background-color: var(--rs-state-hover-bg);
Expand Down
2 changes: 1 addition & 1 deletion src/Sidebar/test/SidebarStylesSpec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ describe('Sidebar styles', () => {
const dom = getDOMNode(instanceRef.current);
assert.equal(
getStyle(dom, 'transition'),
'flex 0.2s ease-in 0s, width 0.2s ease-in 0s',
'flex 0.15s ease-in 0s, width 0.15s ease-in 0s',
'Sidebar collapse transition'
);
});
Expand Down
15 changes: 7 additions & 8 deletions src/styles/variables.less
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@
@btn-border-radius-base: @border-radius; // @deprecated use @btn-border-radius instead
@btn-border-radius: @btn-border-radius-base;

@btn-transition: color 0.2s linear, background-color 0.3s linear;
@btn-transition: color 0.15s ease-out, background-color 0.15s ease-out;
@btn-disabled-opacity: 0.3;

// Ghost Button
Expand Down Expand Up @@ -312,7 +312,7 @@
@input-padding-y: @padding-base-input-vertical;
@input-padding-x: @padding-base-input-horizontal;
@input-border-width: 1px;
@input-transition: border-color ease-in-out 0.3s;
@input-transition: border-color ease-in-out 0.15s;

// This has no effect on `<select>`s in some browsers, due to the limited stylability of `<select>`s in CSS.
@input-border-radius: @border-radius;
Expand Down Expand Up @@ -368,7 +368,7 @@
// Toggle

@toggle-active-scale: 1.2;
@toggle-transition: 0.2s ease-in-out;
@toggle-transition: 0.15s ease-out;

@toggle-md-height: 24px;
@toggle-md-handle-gap: 3px;
Expand All @@ -393,7 +393,7 @@

// Navs

@nav-item-transition: color 0.3s linear, background-color 0.3s linear;
@nav-item-transition: color 0.15s ease-out, background-color 0.15s ease-out;

// Tab
@nav-tab-bar-width: 1px;
Expand Down Expand Up @@ -432,7 +432,7 @@
@sidenav-icon-spacing: 20px;
@sidenav-icon-width: @sidenav-level1-item-font-size;
@sidenav-dropdown-toggle-caret-width: 20px;
@sidenav-collapse-transition-config: 0.2s ease-in;
@sidenav-collapse-transition-config: 0.15s ease-in;

@sidenav-level-retract: 9px;
@sidenav-level2-retract: (@sidenav-padding-horizontal + @sidenav-icon-width + @sidenav-icon-spacing);
Expand Down Expand Up @@ -648,7 +648,7 @@
@panel-padding: 20px;
@panel-header-font-size: 16px;
@panel-split-line-color: @dropdown-divider-bg;
@panel-accodion-transition: 0.3s linear;
@panel-accodion-transition: 0.15s linear;
@panel-box-shadow: @box-shadow;

// Timeline
Expand Down Expand Up @@ -717,7 +717,6 @@

@picker-item-content-padding-vertical: 8px;
@picker-item-content-padding-horizontal: @picker-menu-padding;
@picker-item-transition: color 0.3s linear, background-color 0.3s linear;

// group title
@picker-group-children-padding-left: 26px;
Expand Down Expand Up @@ -806,7 +805,7 @@
@slider-calibration-diameter: 8px;
@slider-calibration-border-width: 2px;
@slider-mark-margin-top: 9px;
@slider-handle-transition: 0.3s ease-in-out;
@slider-handle-transition: 0.15s ease-in-out;

// Breadcrumbs

Expand Down

1 comment on commit d1829da

@vercel
Copy link

@vercel vercel bot commented on d1829da Jan 12, 2023

Choose a reason for hiding this comment

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

Please sign in to comment.