简体   繁体   English

在选定日期为反应日期添加半径(airBnB)

[英]add raduis in selected dates for react-dates (airBnB)

I'm using react-dates in order to achieve the following date range picker:我正在使用 react-dates 来实现以下日期范围选择器:

预期产出

here is what I have done: https://codesandbox.io/s/ecstatic-almeida-3u72o?fontsize=14&hidenavigation=1&theme=dark but I still have a problem to apply the selected style out of border radius of the selected dates (i tried before and ofter also I tried to create a custom content cell in order to apply a background style but it doesn't work) Anyone can help me, please Here is a screenshot of the problem that i'm facing:这是我所做的: https://codesandbox.io/s/ecstatic-almeida-3u72o?fontsize=14&hidenavigation=1&theme=dark但我仍然无法将所选样式应用到所选日期的边界半径之外(我之前尝试过并且经常尝试创建自定义内容单元格以应用背景样式,但它不起作用)任何人都可以帮助我,请这是我面临的问题的屏幕截图: 在此处输入图像描述

What are you having trouble with exactly?你到底有什么问题?

Making the css rules apply or making the rules to be exactly like the screenshot design?使 css 规则适用或使规则与屏幕截图设计完全相同?

If it is the second one, I would just do something like:如果是第二个,我会做类似的事情:

.CalendarDay__selected {
  border: none;
}

.CalendarDay__selected_start,
.CalendarDay__selected_end {
    border-radius: 50%;
    position: relative;
    z-index: 0;
  
  &:before {
    display: block;
    position: absolute;
    content: '';
    left: 50%;
    right: 0;
    bottom: 0;
    top: 0;
    background: #66e2da;
    z-index: -1;
  }
  
  &:after {
    display: block;
    position: absolute;
    content: '';
    left: 0;
    right: 0;
    bottom: 0;
    top: 0;
    background: #00a699;
    z-index: -1;
    border-radius: 50%;
  }
}

.CalendarDay__selected_span {
  border: none;
}

.CalendarDay__selected_span:last-of-type {
  border-top-right-radius: 50%;
  border-bottom-right-radius: 50%;
}

.CalendarDay__selected_span:first-of-type {
  border-top-left-radius: 50%;
  border-bottom-left-radius: 50%;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM