0

I'm building a modal that will allow user to select date and time. I'm using the react-datetime component.

Here is my code:

<div className="date-time-modal">
  <div className="date-time-modal-container">
    <div className="date-time-modal-button">
      <Button onClick={this.handleCloseModal} type="noborder">
        <Icon name="window-close" size={"2x"} />
      </Button>
    </div>
    <div className="date-time-modal-title">
      "Please select date and time:"
    </div>
    <div className="date-time-modal-calendar"> 
      <DateTime input={false} />
    </div>
  </div>
</div>

And my styling:

.date-time-modal {
    position: fixed;
    z-index: 1;
    padding: 5%;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: $ux-theme-color-modal-brackground;
    display: flex;
    align-items: center;
    justify-container: center;

}

.date-time-modal-container {
    background-color: $ux-theme-color-template-header;
    padding: 20px;

}

.date-time-modal-button {
    flex: 1;
    text-align: right;
}

.date-time-modal-title {
    flex: 1;
    text-align: left;
}

.date-time-modal-calendar {
    flex: 1;
}

.date-time-modal-calendar * {
    text-align: center;
}

Every time the modal is opened the calendar is locked to the left side. If I choose the time picker, it became stacked.

Below current render (check the time picker stacked and all left aligned):

enter image description here

enter image description here

I need the picker to be centered on the parent as well as the hous picker to behave normally (hour and minutes aside).

Mendes
  • 17,489
  • 35
  • 150
  • 263

1 Answers1

0

I got the answer at this post

The component must be styled properly using react-datetime css files.

Mendes
  • 17,489
  • 35
  • 150
  • 263