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(core/datetime-picker): adjust done button placement #484

Merged
merged 2 commits into from
Apr 12, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 4 additions & 0 deletions packages/core/src/components/date-picker/date-picker.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
@import 'common-variables';

:host {
ix-date-time-card {
display: inline-block;
}

.header {
display: flex;
align-items: center;
Expand Down
13 changes: 9 additions & 4 deletions packages/core/src/components/date-picker/date-picker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -166,23 +166,23 @@ export class DatePicker {
@Event() dateSelect: EventEmitter<DateChangeEvent>;

get year() {
if (this.from) {
if (this.from !== null) {
return DateTime.fromFormat(this.from, this.format).year;
}

return DateTime.now().year;
}

get day() {
if (this.from) {
if (this.from !== null) {
return DateTime.fromFormat(this.from, this.format).day;
}

return null;
}

get month() {
if (this.from) {
if (this.from !== null) {
return DateTime.fromFormat(this.from, this.format).month;
}

Expand Down Expand Up @@ -493,6 +493,7 @@ export class DatePicker {
>
{this.years.map((year) => (
<div
key={year}
class={{ arrowYear: true }}
onClick={(event) => this.selectTempYear(event, year)}
>
Expand All @@ -513,6 +514,7 @@ export class DatePicker {
<div class="overflow">
{this.monthNames.map((month, index) => (
<div
key={month}
class={{
arrowYear: true,
selected: this.tempMonth - 1 === index,
Expand Down Expand Up @@ -553,7 +555,9 @@ export class DatePicker {
<div class="grid">
<div class="calendar-item week-day"></div>
{this.dayNames.map((name) => (
<div class="calendar-item week-day">{name.slice(0, 3)}</div>
<div key={name} class="calendar-item week-day">
{name.slice(0, 3)}
</div>
))}

{this.calendar.map((week) => {
Expand All @@ -562,6 +566,7 @@ export class DatePicker {
<div class="calendar-item week-number">{week[0]}</div>
{week[1].map((day) => (
<div
key={day}
class={this.getDayClasses(day)}
onClick={() => this.selectDay(day)}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,19 @@
display: block;
background-color: var(--theme-menu--background);
border-radius: 4px;
position: relative;
width: 32.6875rem;
}

.flex {
display: flex;
justify-content: center;
}

.done {
display: inline-flex;
justify-content: flex-end;
padding: $default-space;
width: 100%;
.btn-select-date{
position: absolute;
bottom: $default-space;
right: $default-space;
}

.separator {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,11 +241,9 @@ export class DateTimePicker {
<div class="separator"></div>
</div>

<div class="done">
<ix-button onClick={() => this.onDone()}>
{this.textSelectDate}
</ix-button>
</div>
<ix-button class="btn-select-date" onClick={() => this.onDone()}>
{this.textSelectDate}
</ix-button>
</Host>
);
}
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.