diff --git a/src/index.html b/src/index.html index c10199d38b..2c793f8ddd 100644 --- a/src/index.html +++ b/src/index.html @@ -13,6 +13,38 @@ /> -

Calendar

+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/styles/index.scss b/src/styles/index.scss index 293d3b1f13..70c20692cd 100644 --- a/src/styles/index.scss +++ b/src/styles/index.scss @@ -1,3 +1,83 @@ +$cell-size: 100px; +$cell-border-width: 1px; +$calendar-columns: 7; +$calendar-gap: 1px; +$calendar-padding: 10px; +$calendar-padding-width: $calendar-padding * 2; +$calendar-days-width: $cell-size * $calendar-columns; +$calendar-gaps-width: $calendar-gap * ($calendar-columns - 1); +$calendar-content-width: $calendar-days-width + $calendar-gaps-width; +$calendar-width: $calendar-content-width + $calendar-padding-width; +$hover-shift: 20px; +$transition-duration: 0.5s; +$day-background: #eee; +$day-hover-background: #ffbfcb; +$week-days: ( + mon: 0, + tue: 1, + wed: 2, + thu: 3, + fri: 4, + sat: 5, + sun: 6, +); + +html { + font-family: Arial, sans-serif; +} + body { margin: 0; + min-height: 100vh; + display: flex; + justify-content: center; + align-items: center; +} + +.calendar { + box-sizing: border-box; + display: flex; + flex-wrap: wrap; + gap: $calendar-gap; + width: $calendar-width; + padding: $calendar-padding; + + @each $day, $offset in $week-days { + &--start-day-#{$day} &__day:first-child { + margin-left: ($cell-size + $calendar-gap) * $offset; + } + } + + @for $length from 28 through 31 { + &--month-length-#{$length} &__day:nth-child(n + #{$length + 1}) { + display: none; + } + } + + &__day { + box-sizing: border-box; + width: $cell-size; + height: $cell-size; + display: flex; + justify-content: center; + align-items: center; + border: $cell-border-width solid #000; + background-color: $day-background; + transition: + background-color $transition-duration, + transform $transition-duration; + + &:hover { + cursor: pointer; + background-color: $day-hover-background; + transform: translateY(-$hover-shift); + } + + @for $day from 1 through 31 { + &:nth-child(#{$day})::before { + content: '#{$day}'; + font-size: 30px; + } + } + } }