diff --git a/README.md b/README.md index 37cba2aadd..00be944ef1 100644 --- a/README.md +++ b/README.md @@ -36,13 +36,13 @@ 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://kwagfn.github.io/layout_calendar/) +- [TEST REPORT LINK](https://kwagfn.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. -- [ ] Changing 'month-lengh' and 'start-day' modifier in the code element +- [x] Changing 'month-lengh' and 'start-day' modifier in the code element reflects in changing calendar layout -- [ ] Each day has no modifiers, only class (eg. calendar__day) -- [ ] All `Typical Mistakes` from `BEM` lesson theory are checked. -- [ ] Code follows all the [Code Style Rules ❗️](https://mate-academy.github.io/layout_task-guideline/html-css-code-style-rules) +- [x] Each day has no modifiers, only class (eg. calendar__day) +- [x] All `Typical Mistakes` from `BEM` lesson theory are checked. +- [x] Code follows all the [Code Style Rules ❗️](https://mate-academy.github.io/layout_task-guideline/html-css-code-style-rules) diff --git a/src/index.html b/src/index.html index c10199d38b..6245b0a7a0 100644 --- a/src/index.html +++ b/src/index.html @@ -9,10 +9,42 @@ Calendar -

Calendar

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