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

fix(NcDateTimePicker): change styling to look more like the native picker #6095

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 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
7 changes: 5 additions & 2 deletions src/components/NcDateTimePicker/NcDateTimePicker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ export default {
// 0 = sunday, 1 = monday
firstDayOfWeek: getFirstDay(),
},
monthFormat: 'MMM',
monthFormat: 'MMMM',
}
},

Expand Down Expand Up @@ -477,7 +477,10 @@ export default {
}
}
}

.v-select.select {
min-width: 246px;
left: -8px !important;
}
// TODO: This should be scoped or targeted by a specific selector, but the NcSelect component does not allow this yet.
.vs__dropdown-menu--floating {
// Higher z-index than the popover in which the NcSelect is located.
Expand Down
5 changes: 0 additions & 5 deletions src/components/NcDateTimePicker/chevron-double-left.svg

This file was deleted.

5 changes: 0 additions & 5 deletions src/components/NcDateTimePicker/chevron-double-right.svg

This file was deleted.

69 changes: 36 additions & 33 deletions src/components/NcDateTimePicker/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
* SPDX-FileCopyrightText: 2020 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/

$cell_height: 32px;
$opacity_full: 1;

@import 'vue2-datepicker/scss/index';

Expand All @@ -23,7 +24,7 @@
border: 2px solid var(--color-border-maxcontrast);
background-color: var(--color-main-background);
background-clip: content-box;

&:active:not(.disabled),
&:hover:not(.disabled),
&:focus:not(.disabled) {
Expand Down Expand Up @@ -51,6 +52,7 @@
background-color: var(--color-main-background);
font-family: var(--font-face) !important;
line-height: 1.5;
left: 0 !important;

svg {
fill: var(--color-main-text);
Expand All @@ -64,7 +66,7 @@
border-left: 1px solid var(--color-border);
}
}

&.show-week-number .mx-calendar {
width: $cell_height * 8 + 2 * 5px + 30px; // week number + 7 days + padding + 30px padding to fit the buttons
}
Expand Down Expand Up @@ -109,12 +111,13 @@

// first active cell, range style on day picker panel only
.mx-calendar-content .mx-table-date .cell {
border-radius: var(--border-radius-small);
&.active {
border-radius: var(--border-radius) 0 0 var(--border-radius);
border-radius: var(--border-radius-small) 0 0 var(--border-radius-small);
}
// second selected cell
&.in-range + .cell.active {
border-radius: 0 var(--border-radius) var(--border-radius) 0;
border-radius: 0 var(--border-radius-small) var(--border-radius-small) 0;
}
}
}
Expand All @@ -126,7 +129,7 @@
thead > tr > th {
text-align: center;
opacity: $opacity_disabled;
color: var(--color-text-lighter);
color: var(--color-main-text);
}

// Override table rule from server
Expand All @@ -141,7 +144,8 @@
transition: all 100ms ease-in-out;
text-align: center;
opacity: $opacity_normal;
border-radius: 50px;
border-radius: var(--border-radius-small);
min-height: var(--clickable-area-small) !important;

// force pointer on all content
> * {
Expand All @@ -151,24 +155,28 @@
// Selected and mouse event
&.today {
opacity: $opacity_full;
color: var(--color-primary-element);
font-weight: bold;
background-color: transparent;
color: var(--color-primary-element);
border-radius: var(--border-radius-small);
&:hover,
&:focus {
color: var(--color-primary-element-text);
}
}
&.in-range,
&.disabled {
border-radius: 0;
font-weight: normal;
border-radius: var(--border-radius-small);
background-color: var(--color-background-dark);
color: var(--color-main-text);
opacity: 1;
}
&.in-range {
opacity: $opacity_normal;
}
&.not-current-month {
opacity: $opacity_disabled;
color: var(--color-text-lighter);
color: var(--color-text-maxcontrast);
&:hover,
&:focus {
opacity: $opacity_full;
Expand All @@ -188,8 +196,8 @@
}
&.disabled {
opacity: $opacity_disabled;
color: var(--color-text-lighter);
border-radius: 0;
color: var(--color-main-text);
border-radius: var(--border-radius-small);
background-color: var(--color-background-darker);
}
}
Expand Down Expand Up @@ -222,6 +230,7 @@
flex: 1 1 $cell_height;
justify-content: space-around;
min-height: $cell_height;
color: var(--color-main-text);
}
// Default cell style
th,
Expand All @@ -236,6 +245,7 @@
height: 95%;
min-height: $cell_height;
transition: background 100ms ease-in-out;
color: var(--color-main-text);
}
}
&.mx-table-year {
Expand All @@ -262,9 +272,9 @@
padding: 7px 10px;
cursor: pointer;
text-decoration: none;
opacity: $opacity_disabled;
color: var(--color-text-lighter);
border-radius: $cell_height;
opacity: $opacity_full;
color: var(--color-main-text);
border-radius: var(--border-radius-small);
line-height: $cell_height - 12px; // padding minus 2px for better visual
// Mouse feedback
&:hover,
Expand Down Expand Up @@ -293,7 +303,8 @@
text-decoration: none;
opacity: $opacity_normal;
color: var(--color-main-text);
border-radius: $cell_height;
border-radius: var(--border-radius-small);
background-color: transparent;
line-height: $cell_height - 12px; // padding minus 2px for better visual

// Mouse feedback
Expand All @@ -305,10 +316,8 @@
}

// Header arrows
&.mx-btn-icon-double-left,
&.mx-btn-icon-left,
&.mx-btn-icon-right,
&.mx-btn-icon-double-right {
&.mx-btn-icon-right {
align-items: center;
justify-content: center;
width: $cell_height;
Expand All @@ -332,13 +341,13 @@
line-height: initial;
}
}

.mx-calendar-header-label {
display: flex;
color: var(--color-main-text);
}

.mx-btn-icon-double-left > i {
background-image: url('./chevron-double-left.svg');
.mx-btn-icon-double-left,
.mx-btn-icon-double-right {
display: none;
}

.mx-btn-icon-left > i {
Expand All @@ -349,17 +358,9 @@
background-image: url('./chevron-right.svg');
}

.mx-btn-icon-double-right > i {
background-image: url('./chevron-double-right.svg');
}

button.mx-btn-icon-right {
order: 2;
}

button.mx-btn-icon-double-right {
order: 3;
}
}
// Week panel
.mx-calendar-week-mode {
Expand All @@ -371,7 +372,7 @@
&:hover,
&.mx-active-week {
opacity: $opacity_full;
border-radius: 50px;
border-radius: var(--border-radius-small);
background-color: var(--color-background-dark);
td {
background-color: transparent;
Expand Down Expand Up @@ -400,6 +401,8 @@
// only one button, center it
justify-content: center;
border-bottom: 1px solid var(--color-border);
opacity: 1 !important;
background-color: transparent;
}

.mx-time-column {
Expand Down
Loading