diff --git a/src/index.html b/src/index.html index c10199d38b..9484eb698c 100644 --- a/src/index.html +++ b/src/index.html @@ -11,8 +11,44 @@ rel="stylesheet" href="styles/index.scss" /> + -

Calendar

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