diff --git a/README.md b/README.md index 6a30283def..2ef201119a 100644 --- a/README.md +++ b/README.md @@ -36,8 +36,8 @@ This is possible because [we use the Parcel library](https://en.parceljs.org/scs ❗️ Replace `` with your Github username and copy the links to `Pull Request` description: -- [DEMO LINK](https://.github.io/layout_calendar/) -- [TEST REPORT LINK](https://.github.io/layout_calendar/report/html_report/) +- [DEMO LINK](https://AdrJeeN.github.io/layout_calendar/) +- [TEST REPORT LINK](https://AdrJeeN.github.io/layout_calendar/report/html_report/) ❗️ Copy this `Checklist` to the `Pull Request` description after links, and put `- [x]` before each point after you checked it. diff --git a/src/index.html b/src/index.html index c10199d38b..1283bcf51a 100644 --- a/src/index.html +++ b/src/index.html @@ -13,6 +13,40 @@ /> -

Calendar

+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/styles/index.scss b/src/styles/index.scss index 293d3b1f13..dbd429a22e 100644 --- a/src/styles/index.scss +++ b/src/styles/index.scss @@ -1,3 +1,88 @@ +$square-size: 100px; +$border-weight: 1px; +$gap: 1px; +$padding: 10px; +$columns: 7; +$square-color: #eee; +$square-color-hover: #ffbfcb; +$font-family: Arial, Helvetica, sans-serif; +$font-size: 30px; +$transirtion-duration: 0.5s; + body { margin: 0; + height: 100vh; + display: flex; + justify-content: center; + align-items: center; + overflow: hidden; +} + +.calendar { + max-width: calc((($square-size) * $columns) + (($columns - 1) * $gap)); + display: flex; + flex-wrap: wrap; + justify-content: flex-start; + align-items: center; + gap: $gap; + margin: auto; + padding: $padding; + + &__day { + position: relative; + height: $square-size; + width: $square-size; + border: $border-weight solid black; + background-color: $square-color; + font-size: $font-size; + font-family: $font-family; + box-sizing: border-box; + display: flex; + justify-content: center; + align-items: center; + cursor: pointer; + transition: + transform $transirtion-duration, + background-color $transirtion-duration; + + &::before { + content: counter(day); + counter-increment: day; + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); + } + + &:hover { + background-color: $square-color-hover; + transform: translateY(-20px); + } + } + + &--start-day-sun { + .calendar__day:first-child { + margin-left: 0; + } + } + + @each $day, + $margin in (mon: 1, tue: 2, wed: 3, thu: 4, fri: 5, sat: 6, sun: 7) + { + &--start-day-#{$day} { + .calendar__day:first-child { + margin-left: (($square-size + $gap) * ($margin - 1)); + } + } + } + + @for $i from 28 through 31 { + &--month-length-#{$i} { + .calendar__day:nth-child(n + #{$i + 1}) { + display: none; + } + } + } + + counter-reset: day; }