Skip to content

Commit

Permalink
fix(ui5-datetime-picker): set min width (#1698)
Browse files Browse the repository at this point in the history
  • Loading branch information
vladitasev authored May 29, 2020
1 parent 1f809c9 commit 7313838
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
5 changes: 5 additions & 0 deletions packages/main/src/DateTimePicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import {
import DateTimePickerPopoverTemplate from "./generated/templates/DateTimePickerPopoverTemplate.lit.js";

// Styles
import DateTimePickerCss from "./generated/themes/DateTimePicker.css.js";
import DateTimePickerPopoverCss from "./generated/themes/DateTimePickerPopover.css.js";

const PHONE_MODE_BREAKPOINT = 640; // px
Expand Down Expand Up @@ -169,6 +170,10 @@ class DateTimePicker extends DatePicker {
return DateTimePickerPopoverTemplate;
}

static get styles() {
return [super.styles, DateTimePickerCss];
}

static get staticAreaStyles() {
return [...super.staticAreaStyles, DateTimePickerPopoverCss];
}
Expand Down
3 changes: 3 additions & 0 deletions packages/main/src/themes/DateTimePicker.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
:host .ui5-datepicker-input {
min-width: 15rem;
}
11 changes: 7 additions & 4 deletions packages/main/test/pages/DateTimePicker.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>DateTimePicker Test Page</title>

<script src="../../webcomponentsjs/webcomponents-loader.js"></script>
<script>
delete Document.prototype.adoptedStyleSheets;
</script>

<script src="../../webcomponentsjs/webcomponents-loader.js"></script>
<script src="../../resources/bundle.esm.js" type="module"></script>
<script nomodule src="../../resources/bundle.es5.js"></script>

Expand All @@ -17,7 +21,6 @@
}

ui5-datetime-picker {
width: 300px;
margin-bottom: 0.25rem;
}
</style>
Expand Down Expand Up @@ -100,7 +103,7 @@
id="input1"
style="width: 300px">
</ui5-input>

<br><ui5-label>Changed value</ui5-label><br>
<ui5-input
id="input2"
Expand Down Expand Up @@ -178,4 +181,4 @@

</script>
</body>
</html>
</html>

0 comments on commit 7313838

Please sign in to comment.