_calendars.scss 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  1. // Calendars
  2. .calendar {
  3. border: $border-width solid $border-color;
  4. border-radius: $border-radius;
  5. display: block;
  6. min-width: 280px;
  7. .calendar-nav {
  8. align-items: center;
  9. background: $bg-color;
  10. border-top-left-radius: $border-radius;
  11. border-top-right-radius: $border-radius;
  12. display: flex;
  13. font-size: $font-size-lg;
  14. padding: $layout-spacing;
  15. }
  16. .calendar-header,
  17. .calendar-body {
  18. display: flex;
  19. flex-wrap: wrap;
  20. justify-content: center;
  21. padding: $layout-spacing 0;
  22. .calendar-date {
  23. flex: 0 0 14.28%; // 7 calendar-items each row
  24. max-width: 14.28%;
  25. }
  26. }
  27. .calendar-header {
  28. background: $bg-color;
  29. border-bottom: $border-width solid $border-color;
  30. color: $gray-color;
  31. font-size: $font-size-sm;
  32. text-align: center;
  33. }
  34. .calendar-body {
  35. color: $gray-color-dark;
  36. }
  37. .calendar-date {
  38. border: 0;
  39. padding: $unit-1;
  40. .date-item {
  41. appearance: none;
  42. background: transparent;
  43. border: $border-width solid transparent;
  44. border-radius: 50%;
  45. color: $gray-color-dark;
  46. cursor: pointer;
  47. font-size: $font-size-sm;
  48. height: $unit-7;
  49. line-height: $unit-5;
  50. outline: none;
  51. padding: $unit-h;
  52. position: relative;
  53. text-align: center;
  54. text-decoration: none;
  55. transition: background .2s, border .2s, box-shadow .2s, color .2s;
  56. vertical-align: middle;
  57. white-space: nowrap;
  58. width: $unit-7;
  59. &.date-today {
  60. border-color: $secondary-color-dark;
  61. color: $primary-color;
  62. }
  63. &:focus {
  64. @include control-shadow();
  65. }
  66. &:focus,
  67. &:hover {
  68. background: $secondary-color-light;
  69. border-color: $secondary-color-dark;
  70. color: $primary-color;
  71. text-decoration: none;
  72. }
  73. &:active,
  74. &.active {
  75. background: $primary-color-dark;
  76. border-color: darken($primary-color-dark, 5%);
  77. color: $light-color;
  78. }
  79. // Calendar badge support
  80. &.badge {
  81. &::after {
  82. position: absolute;
  83. top: 3px;
  84. right: 3px;
  85. transform: translate(50%, -50%);
  86. }
  87. }
  88. }
  89. .date-item,
  90. .calendar-event {
  91. &:disabled,
  92. &.disabled {
  93. cursor: default;
  94. opacity: .25;
  95. pointer-events: none;
  96. }
  97. }
  98. &.prev-month,
  99. &.next-month {
  100. .date-item,
  101. .calendar-event {
  102. opacity: .25;
  103. }
  104. }
  105. }
  106. .calendar-range {
  107. position: relative;
  108. &::before {
  109. background: $secondary-color;
  110. content: "";
  111. height: $unit-7;
  112. left: 0;
  113. position: absolute;
  114. right: 0;
  115. top: 50%;
  116. transform: translateY(-50%);
  117. }
  118. &.range-start {
  119. &::before {
  120. left: 50%;
  121. }
  122. }
  123. &.range-end {
  124. &::before {
  125. right: 50%;
  126. }
  127. }
  128. &.range-start,
  129. &.range-end {
  130. .date-item {
  131. background: $primary-color-dark;
  132. border-color: darken($primary-color-dark, 5%);
  133. color: $light-color;
  134. }
  135. }
  136. .date-item {
  137. color: $primary-color;
  138. }
  139. }
  140. // Calendars size
  141. &.calendar-lg {
  142. .calendar-body {
  143. padding: 0;
  144. .calendar-date {
  145. border-bottom: $border-width solid $border-color;
  146. border-right: $border-width solid $border-color;
  147. display: flex;
  148. flex-direction: column;
  149. height: 5.5rem;
  150. padding: 0;
  151. &:nth-child(7n) {
  152. border-right: 0;
  153. }
  154. &:nth-last-child(-n+7) {
  155. border-bottom: 0;
  156. }
  157. }
  158. }
  159. .date-item {
  160. align-self: flex-end;
  161. height: $unit-7;
  162. margin-right: $layout-spacing-sm;
  163. margin-top: $layout-spacing-sm;
  164. }
  165. .calendar-range {
  166. &::before {
  167. top: 19px;
  168. }
  169. &.range-start {
  170. &::before {
  171. left: auto;
  172. width: 19px;
  173. }
  174. }
  175. &.range-end {
  176. &::before {
  177. right: 19px;
  178. }
  179. }
  180. }
  181. .calendar-events {
  182. flex-grow: 1;
  183. line-height: 1;
  184. overflow-y: auto;
  185. padding: $layout-spacing-sm;
  186. }
  187. .calendar-event {
  188. border-radius: $border-radius;
  189. font-size: $font-size-sm;
  190. display: block;
  191. margin: $unit-h auto;
  192. overflow: hidden;
  193. padding: 3px 4px;
  194. text-overflow: ellipsis;
  195. white-space: nowrap;
  196. }
  197. }
  198. }