react-date-range icon indicating copy to clipboard operation
react-date-range copied to clipboard

How to make it responsive.

Open saransh-veris opened this issue 5 years ago • 4 comments

Subject of the issue

Can't change the height and width of the component

[BUG] Bug Reproduce Steps

Tell us how to reproduce this issue.

[BUG] Expected behaviour

Environment

Package Version: React version: Node version: Browser:

saransh-veris avatar Nov 03 '20 16:11 saransh-veris

Actually you need to use flexbox outside it to get better results on responsive layout. In my case I used that css code to customize :

.rdrDateRangePickerWrapper {
    font-family: sans-serif;
    display: flex;

    .rdrStaticRangeLabel {
      font-family: "Roboto", "Helvetica", "Arial", sans-serif;
      line-height: 25px;
      font-size: 14px;
    }
  .rdrDayToday .rdrDayNumber span:after {
      background-color: #3f51b5;
  }
    .datePicker {
      justify-content: space-around;
    }
    .rdrStaticRange{
      border: none;
    }
    .rdrCalendarWrapper, .rdrDefinedRangesWrapper {
      flex: 1;
      border: none;
    }
  }

  @media (max-width: 600px) {
    .rdrDateRangePickerWrapper {
      display: block;
    }
  }

eduardopatrick avatar Apr 01 '21 22:04 eduardopatrick

Here's my solution for version 0.9.x

.rdr-Calendar {
  width: 100% !important;
  padding: 0 !important;
}
.rdr-Days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  justify-items: center;
}
.rdr-WeekDays {
  display: flex;
}
.rdr-WeekDay {
  flex: 1;
}

Might work for 1.x as well with appropriate tweaks.

Vanuan avatar Aug 31 '21 12:08 Vanuan

Actually you need to use flexbox outside it to get better results on responsive layout. In my case I used that css code to customize :

.rdrDateRangePickerWrapper {
    font-family: sans-serif;
    display: flex;

    .rdrStaticRangeLabel {
      font-family: "Roboto", "Helvetica", "Arial", sans-serif;
      line-height: 25px;
      font-size: 14px;
    }
  .rdrDayToday .rdrDayNumber span:after {
      background-color: #3f51b5;
  }
    .datePicker {
      justify-content: space-around;
    }
    .rdrStaticRange{
      border: none;
    }
    .rdrCalendarWrapper, .rdrDefinedRangesWrapper {
      flex: 1;
      border: none;
    }
  }

  @media (max-width: 600px) {
    .rdrDateRangePickerWrapper {
      display: block;
    }
  }

This worked for me, but I added the next code for multiples months.

.rdrDateRangePickerWrapper {
  font-family: sans-serif;
  display: flex;
}
.rdrStaticRangeLabel {
  font-family: "Roboto", "Helvetica", "Arial", sans-serif;
  line-height: 25px;
  font-size: 14px;
}
.rdrDayToday .rdrDayNumber span:after {
  background-color: #3f51b5;
}
.datePicker {
  justify-content: space-around;
}
.rdrStaticRange {
  border: none;
}
.rdrCalendarWrapper,
.rdrDefinedRangesWrapper {
  flex: 1;
  border: none;
}
@media (max-width: 1000px) {
  .rdrMonths {
    flex-direction: column;
  }
}
@media (max-width: 600px) {
  .rdrDateRangePickerWrapper {
    display: block;
  }
  .datePicker {
    display: flex;
    flex-direction: column;
  }
  .rdrMonths {
    flex-direction: column;
  }
}

Results: image

dagamo avatar Jan 12 '23 20:01 dagamo

Actually you need to use flexbox outside it to get better results on responsive layout. In my case I used that css code to customize :

.rdrDateRangePickerWrapper {
    font-family: sans-serif;
    display: flex;

    .rdrStaticRangeLabel {
      font-family: "Roboto", "Helvetica", "Arial", sans-serif;
      line-height: 25px;
      font-size: 14px;
    }
  .rdrDayToday .rdrDayNumber span:after {
      background-color: #3f51b5;
  }
    .datePicker {
      justify-content: space-around;
    }
    .rdrStaticRange{
      border: none;
    }
    .rdrCalendarWrapper, .rdrDefinedRangesWrapper {
      flex: 1;
      border: none;
    }
  }

  @media (max-width: 600px) {
    .rdrDateRangePickerWrapper {
      display: block;
    }
  }

This worked for me, but I added the next code for multiples months.

.rdrDateRangePickerWrapper {
  font-family: sans-serif;
  display: flex;
}
.rdrStaticRangeLabel {
  font-family: "Roboto", "Helvetica", "Arial", sans-serif;
  line-height: 25px;
  font-size: 14px;
}
.rdrDayToday .rdrDayNumber span:after {
  background-color: #3f51b5;
}
.datePicker {
  justify-content: space-around;
}
.rdrStaticRange {
  border: none;
}
.rdrCalendarWrapper,
.rdrDefinedRangesWrapper {
  flex: 1;
  border: none;
}
@media (max-width: 1000px) {
  .rdrMonths {
    flex-direction: column;
  }
}
@media (max-width: 600px) {
  .rdrDateRangePickerWrapper {
    display: block;
  }
  .datePicker {
    display: flex;
    flex-direction: column;
  }
  .rdrMonths {
    flex-direction: column;
  }
}

Results: image

in which file we should put this style ? i am puting this in one file which i have imported in index file

hemaljoshi avatar Nov 10 '23 17:11 hemaljoshi