Skip to content

Commit 86912f2

Browse files
a-z-ivanovilhan007
authored andcommitted
refactor(ui5-daypicker): move styles to Base theme (#151)
1 parent 82b99c2 commit 86912f2

File tree

7 files changed

+37
-51
lines changed

7 files changed

+37
-51
lines changed

packages/main/src/DayPicker.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
id={{this._id}}
1616
role="columnheader"
1717
aria-label="{{this.name}}"
18-
class="{{this.classes}} sapWCDayPickerDayName">
18+
class="{{this.classes}}">
1919
{{this.ultraShortName}}
2020
</div>
2121
{{/each}}

packages/main/src/DayPicker.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ class DayPicker extends WebComponent {
245245
id: `${this._id}-WH${i.toString()}`,
246246
name: aDayNamesWide[weekday],
247247
ultraShortName: aUltraShortNames[weekday],
248-
classes: "sapWCDayPickerWH",
248+
classes: "sapWCDayPickerDayName",
249249
};
250250

251251
this._dayNames.push(dayName);

packages/main/src/themes/base/DatePicker.less

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
/* Base theme */
1010
/* ============================= */
1111

12-
@_ui5_webcomponents_datepicker_icon_border: none;
12+
@_ui5_datepicker_icon_border: none;
1313

1414
:host(ui5-datepicker) {
1515
display: inline-block;
@@ -25,7 +25,7 @@ ui5-datepicker {
2525
color: @sapUiContentIconColor;
2626
cursor: pointer;
2727
outline: none;
28-
border: @_ui5_webcomponents_datepicker_icon_border;
28+
border: @_ui5_datepicker_icon_border;
2929
box-sizing: border-box;
3030
}
3131

packages/main/src/themes/base/DayPicker.less

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
/* ============================= */
1111

1212
@_ui5_daypicker_item_margin: 2px;
13+
@_ui5_daypicker_item_border: none;
14+
@_ui5_daypicker_item_outline_width: 1px;
15+
@_ui5_daypicker_item_outline_offset: 1px;
1316
@_ui5_daypicker_daynames_container_height: 2rem;
1417
@_ui5_daypicker_weeknumbers_container_padding_top: 2rem;
1518
@_ui5_daypicker_item_background_color: lighten(@sapUiContentForegroundColor, 5);
@@ -22,6 +25,12 @@
2225
@_ui5_daypicker_item_othermonth_hover_background_color: darken(@sapUiListBackground, 10);
2326
@_ui5_daypicker_item_othermonth_color: @sapUiContentLabelColor;
2427
@_ui5_daypicker_item_othermonth_hover_color: @sapUiContentLabelColor;
28+
@_ui5_daypicker_item_border_radius: 0;
29+
@_ui5_daypicker_item_now_inner_border_radius: 0;
30+
@_ui5_daypicker_dayname_color: @sapUiContentLabelColor;
31+
@_ui5_daypicker_weekname_color: @sapUiContentLabelColor;
32+
@_ui5_daypicker_item_now_selected_focus_after_width: calc(~"100% - 0.125rem");
33+
@_ui5_daypicker_item_now_selected_focus_after_height: calc(~"100% - 0.125rem");
2534

2635
:host(ui5-daypicker) {
2736
display: inline-block;
@@ -43,6 +52,11 @@ ui5-daypicker {
4352
margin-top: @_ui5_daypicker_item_margin;
4453
margin-right: @_ui5_daypicker_item_margin;
4554
font-family: @sapUiFontFamily;
55+
border-radius: @_ui5_daypicker_item_border_radius;
56+
}
57+
58+
.sapWCDayPickerWeekName {
59+
color: @_ui5_daypicker_weekname_color;
4660
}
4761

4862
.sapWCDayPickerContent {
@@ -81,6 +95,7 @@ ui5-daypicker {
8195
color: @sapUiBaseText;
8296
background: @_ui5_daypicker_item_background_color;
8397
font-size: @sapMFontMediumSize;
98+
border: @_ui5_daypicker_item_border;
8499
}
85100

86101
.sapWCDayPickerItem:hover {
@@ -97,14 +112,10 @@ ui5-daypicker {
97112
}
98113

99114
.sapWCDayPickerDayName {
100-
color: @sapUiBaseText;
115+
color: @_ui5_daypicker_dayname_color;
101116
height: 100%;
102117
}
103118

104-
.sapWCDayPickerWH {
105-
color: @sapUiContentLabelColor;
106-
}
107-
108119
.sapWCDayPickerItem.sapWCDayPickerItemWeekEnd {
109120
background: @_ui5_daypicker_item_weekend_background_color;
110121
}
@@ -116,6 +127,7 @@ ui5-daypicker {
116127
.sapWCDayPickerItem.sapWCDayPickerItemOtherMonth {
117128
color: @_ui5_daypicker_item_othermonth_color;
118129
background: @_ui5_daypicker_item_othermonth_background_color;
130+
border-color: transparent;
119131
}
120132

121133
.sapWCDayPickerItem.sapWCDayPickerItemOtherMonth:hover,
@@ -128,10 +140,10 @@ ui5-daypicker {
128140
content: "";
129141
width: calc(~"100% - 0.25rem");
130142
height: calc(~"100% - 0.25rem");
131-
border: 1px dotted @sapUiContentFocusColor;
143+
border: @_ui5_daypicker_item_outline_width dotted @sapUiContentFocusColor;
132144
position: absolute;
133-
top: 1px;
134-
left: 1px;
145+
top: @_ui5_daypicker_item_outline_offset;
146+
left: @_ui5_daypicker_item_outline_offset;
135147
}
136148

137149
.sapWCDayPickerItem.sapWCDayPickerItemNow {
@@ -145,11 +157,12 @@ ui5-daypicker {
145157

146158
.sapWCDayPickerItem.sapWCDayPickerItemSel.sapWCDayPickerItemNow .sapWCDayPickerDayText {
147159
border: 1px solid lighten(@sapUiListBorderColor, 10);
160+
border-radius: @_ui5_daypicker_item_now_inner_border_radius;
148161
}
149162

150163
.sapWCDayPickerItem.sapWCDayPickerItemSel.sapWCDayPickerItemNow:focus::after {
151-
width: calc(~"100% - 0.125rem");
152-
height: calc(~"100% - 0.125rem");
164+
width: @_ui5_daypicker_item_now_selected_focus_after_width;
165+
height: @_ui5_daypicker_item_now_selected_focus_after_height;
153166
border-color: @sapUiContentFocusColor;
154167
top: 0px;
155168
left: 0px;

packages/main/src/themes/sap_belize_hcb/DatePicker.less

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@
2121
/* Belize HCB theme */
2222
/* ============================= */
2323

24-
@_ui5_webcomponents_datepicker_icon_border: 1px solid transparent;
24+
@_ui5_datepicker_icon_border: 1px solid transparent;

packages/main/src/themes/sap_belize_hcb/DayPicker.less

Lines changed: 7 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -23,32 +23,13 @@
2323

2424
@_ui5_daypicker_item_hover_background_color: @sapUiHighlight;
2525
@_ui5_daypicker_item_margin: 0;
26+
@_ui5_daypicker_item_border: 1px solid @sapUiListBorderColor;
27+
@_ui5_daypicker_item_outline_width: 0.125rem;
28+
@_ui5_daypicker_item_outline_offset: 0;
2629
@_ui5_daypicker_item_weekend_background_color: @sapUiHcReducedBackground;
2730
@_ui5_daypicker_item_weekend_hover_background_color: @sapUiHighlight;
2831
@_ui5_daypicker_item_othermonth_hover_background_color: @sapUiHighlight;
29-
@_ui5_daypicker_item_selected_background_color: @sapUiHighlight;
30-
@_ui5_daypicker_item_selected_hover_background_color: @sapUiHighlight;
31-
32-
.sapWCDayPickerWeekName,
33-
.sapWCDayPickerDayName {
34-
color: @sapUiHcReducedForeground;
35-
}
36-
37-
.sapWCDayPickerItem {
38-
border: 1px solid @sapUiListBorderColor;
39-
}
40-
41-
.sapWCDayPickerItem:focus::after {
42-
border-width: 0.125rem;
43-
top: 0;
44-
left: 0;
45-
}
46-
47-
.sapWCDayPickerItem.sapWCDayPickerItemSel.sapWCDayPickerItemNow:focus::after {
48-
width: calc(~"100% - 0.25rem");
49-
height: calc(~"100% - 0.25rem");
50-
}
51-
52-
.sapWCDayPickerItem.sapWCDayPickerItemOtherMonth {
53-
border-color: transparent;
54-
}
32+
@_ui5_daypicker_dayname_color: @sapUiHcReducedForeground;
33+
@_ui5_daypicker_weekname_color: @sapUiHcReducedForeground;
34+
@_ui5_daypicker_item_now_selected_focus_after_width: calc(~"100% - 0.25rem");
35+
@_ui5_daypicker_item_now_selected_focus_after_height: calc(~"100% - 0.25rem");

packages/main/src/themes/sap_fiori_3/DayPicker.less

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,5 @@
2121
@_ui5_daypicker_item_selected_hover_background_color: lighten(@sapUiActive, 3);
2222
@_ui5_daypicker_item_weekend_background_color: darken(@sapUiListBackground, 13);
2323
@_ui5_daypicker_item_weekend_hover_background_color: darken(@sapUiListBackground, 20);
24-
25-
.sapWCDayPickerWeekName,
26-
.sapWCDayPickerDayName,
27-
.sapWCDayPickerItem {
28-
border-radius: 0.25rem;
29-
}
30-
31-
.sapWCDayPickerItem.sapWCDayPickerItemNow .sapWCDayPickerDayText {
32-
border-radius: 0.125rem;
33-
}
24+
@_ui5_daypicker_item_border_radius: 0.25rem;
25+
@_ui5_daypicker_item_now_inner_border_radius: 0.125rem;

0 commit comments

Comments
 (0)