Skip to content
This repository was archived by the owner on Sep 5, 2024. It is now read-only.

Commit 1330cb0

Browse files
jelbournThomasBurleson
authored andcommitted
feat(datepicker): add shadow and animation cue for scrolling. Fixes
Closes #4547.
1 parent 582d94c commit 1330cb0

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

src/components/datepicker/calendar.scss

+10-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ $md-calendar-weeks-to-show: 7 !default;
88
$md-calendar-month-label-padding: 8px !default;
99
$md-calendar-month-label-font-size: 13px !default;
1010

11+
$md-calendar-scroll-cue-shadow-radius: 6px;
12+
1113
$md-calendar-width: (7 * $md-calendar-cell-size) + (2 * $md-calendar-side-padding);
1214
$md-calendar-height:
1315
($md-calendar-weeks-to-show * $md-calendar-cell-size) + $md-calendar-header-height;
@@ -79,9 +81,16 @@ md-calendar {
7981

8082
// Contains the scrolling element (this is the md-virtual-repeat-container).
8183
.md-calendar-scroll-container {
84+
// Add an inset shadow to help cue users that the calendar is scrollable. Use a negative x
85+
// offset to push the vertical edge shadow off to the right so that it's cut off by the edge
86+
// of the calendar container.
87+
box-shadow: inset -3px 3px $md-calendar-scroll-cue-shadow-radius rgba(black, 0.2);
88+
8289
display: inline-block;
8390
height: $md-calendar-weeks-to-show * $md-calendar-cell-size;
84-
width: $md-calendar-width;
91+
92+
// Add the shadow radius to the width so that the shadow os pushed off to the side and cut off.
93+
width: $md-calendar-width + $md-calendar-scroll-cue-shadow-radius;
8594
}
8695

8796
// A single date cell in the calendar table.

src/components/datepicker/datePicker.scss

+14
Original file line numberDiff line numberDiff line change
@@ -163,3 +163,17 @@ md-datepicker[disabled] {
163163
display: none;
164164
}
165165
}
166+
167+
// Animate the calendar inside of the floating calendar pane such that it appears to "scroll" into
168+
// view while the pane is opening. This is done as a cue to users that the calendar is scrollable.
169+
.md-datepicker-calendar-pane {
170+
.md-calendar {
171+
transform: translateY(150px);
172+
transition: transform 0.4s $swift-ease-out-timing-function;
173+
transition-delay: 0.1s;
174+
}
175+
176+
&.md-pane-open .md-calendar {
177+
transform: translateY(0);
178+
}
179+
}

0 commit comments

Comments
 (0)