-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
fix(datepicker): use 3 rows to display months of year (consistent with internal mocks) #5427
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
$mat-calendar-body-label-padding-start: 5% !default; | ||
$mat-calendar-body-label-translation: -6px !default; | ||
// We don't want the label to jump around when we switch between month and year views, so we use | ||
// the same amount of padding regardless of the number of columns. | ||
$mat-calendar-body-label-side-padding: 33% / 7 !default; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you explain where the |
||
$mat-calendar-body-cell-min-size: 32px !default; | ||
$mat-calendar-body-cell-size: 100% / 7 !default; | ||
$mat-calendar-body-cell-content-margin: 5% !default; | ||
$mat-calendar-body-cell-content-border-width: 1px !default; | ||
|
||
$mat-calendar-body-min-size: 7 * $mat-calendar-body-cell-min-size !default; | ||
$mat-calendar-body-cell-padding: $mat-calendar-body-cell-size / 2 !default; | ||
$mat-calendar-body-cell-content-size: 100% - $mat-calendar-body-cell-content-margin * 2 !default; | ||
|
||
|
||
|
@@ -15,20 +15,17 @@ $mat-calendar-body-cell-content-size: 100% - $mat-calendar-body-cell-content-mar | |
} | ||
|
||
.mat-calendar-body-label { | ||
padding: $mat-calendar-body-cell-padding 0 | ||
$mat-calendar-body-cell-padding $mat-calendar-body-cell-padding; | ||
height: 0; | ||
line-height: 0; | ||
transform: translateX($mat-calendar-body-label-translation); | ||
text-align: left; | ||
padding-left: $mat-calendar-body-label-side-padding; | ||
padding-right: $mat-calendar-body-label-side-padding; | ||
} | ||
|
||
.mat-calendar-body-cell { | ||
position: relative; | ||
width: $mat-calendar-body-cell-size; | ||
height: 0; | ||
line-height: 0; | ||
padding: $mat-calendar-body-cell-padding 0; | ||
text-align: center; | ||
outline: none; | ||
cursor: pointer; | ||
|
@@ -53,13 +50,13 @@ $mat-calendar-body-cell-content-size: 100% - $mat-calendar-body-cell-content-mar | |
|
||
border-width: $mat-calendar-body-cell-content-border-width; | ||
border-style: solid; | ||
border-radius: 50%; | ||
|
||
// Choosing a value clearly larger than the height ensures we get the correct capsule shape. | ||
border-radius: 999px; | ||
} | ||
|
||
[dir='rtl'] { | ||
.mat-calendar-body-label { | ||
padding: 0 $mat-calendar-body-cell-padding 0 0; | ||
transform: translateX(-$mat-calendar-body-label-translation); | ||
text-align: right; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -68,6 +68,8 @@ export class MdCalendarBody { | |
/** The cell number of the active cell in the table. */ | ||
@Input() activeCell = 0; | ||
|
||
@Input() cellAspectRatio = 1; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add comment explaining how and why this is used? |
||
|
||
/** Emits when a new value is selected. */ | ||
@Output() selectedValueChange = new EventEmitter<number>(); | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
$mat-calendar-padding: 8px !default; | ||
$mat-calendar-header-divider-width: 1px !default; | ||
$mat-calendar-controls-vertical-padding: 5%; | ||
// We want to indent to the middle of the first tile. There are 7 tiles, so 100% / 7 / 2. | ||
// Then we back up a little bit since the text in the cells is center-aligned. | ||
$mat-calendar-controls-start-padding: calc(100% / 14 - 22px); | ||
// Same as above, but on other side for arrows. | ||
$mat-calendar-controls-end-padding: calc(100% / 14 - 22px); | ||
// We use the same padding as the month / year label, but subtract 16px since there is padding | ||
// between the edge of the button and the text. This ensures that the button text lines up with | ||
// the month / year label text. | ||
$mat-calendar-controls-side-margin: calc(33% / 7 - 16px); | ||
|
||
$mat-calendar-arrow-size: 5px !default; | ||
$mat-calendar-arrow-disabled-opacity: 0.5 !default; | ||
|
||
|
@@ -32,8 +32,8 @@ $mat-calendar-next-icon-transform: translateX(-2px) rotate(45deg); | |
|
||
.mat-calendar-controls { | ||
display: flex; | ||
padding: $mat-calendar-controls-vertical-padding $mat-calendar-controls-end-padding | ||
$mat-calendar-controls-vertical-padding $mat-calendar-controls-start-padding; | ||
margin: $mat-calendar-controls-vertical-padding $mat-calendar-controls-side-margin | ||
$mat-calendar-controls-vertical-padding $mat-calendar-controls-side-margin; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think you can simplify this to just margin: $mat-calendar-controls-vertical-padding $mat-calendar-controls-side-margin; |
||
} | ||
|
||
.mat-calendar-spacer { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add comments explaining the padding calculations?