diff --git a/.github/workflows/test.yml-template b/.github/workflows/test.yml-template new file mode 100644 index 000000000..8b5743ecb --- /dev/null +++ b/.github/workflows/test.yml-template @@ -0,0 +1,29 @@ +name: Test + +on: + pull_request: + branches: [ master ] + +jobs: + build: + + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [20.x] + + steps: + - uses: actions/checkout@v2 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + - run: npm install + - run: npm test + - name: Upload HTML report(backstop data) + if: ${{ always() }} + uses: actions/upload-artifact@v2 + with: + name: report + path: backstop_data diff --git a/README.md b/README.md index 37cba2aad..b9102c160 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://anastvozniuk.github.io/layout_calendar/) +- [TEST REPORT LINK](https://anastvozniuk.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/css/main.css b/css/main.css new file mode 100644 index 000000000..ee3442d02 --- /dev/null +++ b/css/main.css @@ -0,0 +1,93 @@ +body { + margin: 0; + display: -webkit-box; + display: -ms-flexbox; + display: flex; + -webkit-box-pack: center; + -ms-flex-pack: center; + justify-content: center; + -webkit-box-align: center; + -ms-flex-align: center; + align-items: center; + height: 100vh; +} + +.calendar { + margin: 0 auto; + padding: 10px; + display: -webkit-box; + display: -ms-flexbox; + display: flex; + -ms-flex-wrap: wrap; + flex-wrap: wrap; + gap: 1px; + max-width: 706px; + counter-reset: day 0; +} +.calendar .calendar__day { + width: 100px; + height: 100px; + border: solid 1px black; + background-color: #eee; + display: -webkit-box; + display: -ms-flexbox; + display: flex; + -webkit-box-align: center; + -ms-flex-align: center; + align-items: center; + -webkit-box-pack: center; + -ms-flex-pack: center; + justify-content: center; + position: relative; + font-family: Arial, sans-serif; + font-size: 30px; + -webkit-box-sizing: border-box; + box-sizing: border-box; + cursor: pointer; + -webkit-transition: 0.5s; + transition: 0.5s; +} +.calendar .calendar__day:first-child { + margin-left: 606px; +} +.calendar .calendar__day::before { + content: counter(day); + counter-increment: day; + position: absolute; +} +.calendar .calendar__day:hover { + background-color: #ffbfcb; + -webkit-transform: translateY(-20px); + -ms-transform: translateY(-20px); + transform: translateY(-20px); +} +.calendar.calendar--start-day-mon .calendar__day:first-child { + margin-left: calc((100px + 1px) * (0)); +} +.calendar.calendar--start-day-tue .calendar__day:first-child { + margin-left: calc((100px + 1px) * (1)); +} +.calendar.calendar--start-day-wed .calendar__day:first-child { + margin-left: calc((100px + 1px) * (2)); +} +.calendar.calendar--start-day-thu .calendar__day:first-child { + margin-left: calc((100px + 1px) * (3)); +} +.calendar.calendar--start-day-fri .calendar__day:first-child { + margin-left: calc((100px + 1px) * (4)); +} +.calendar.calendar--start-day-sat .calendar__day:first-child { + margin-left: calc((100px + 1px) * (5)); +} +.calendar.calendar--month-length-28 .calendar__day:nth-child(n+29) { + display: none; +} +.calendar.calendar--month-length-29 .calendar__day:nth-child(n+30) { + display: none; +} +.calendar.calendar--month-length-30 .calendar__day:nth-child(n+31) { + display: none; +} +.calendar.calendar--month-length-31 .calendar__day:nth-child(n+32) { + display: none; +} \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 08a8b9f22..3651c4525 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,7 +14,7 @@ "@mate-academy/backstop-config": "latest", "@mate-academy/bemlint": "latest", "@mate-academy/linthtml-config": "latest", - "@mate-academy/scripts": "^1.8.6", + "@mate-academy/scripts": "^1.9.12", "@mate-academy/stylelint-config": "latest", "@parcel/transformer-sass": "^2.12.0", "backstopjs": "6.3.23", @@ -1212,9 +1212,9 @@ "dev": true }, "node_modules/@mate-academy/scripts": { - "version": "1.8.6", - "resolved": "https://registry.npmjs.org/@mate-academy/scripts/-/scripts-1.8.6.tgz", - "integrity": "sha512-b4om/whj4G9emyi84ORE3FRZzCRwRIesr8tJHXa8EvJdOaAPDpzcJ8A0sFfMsWH9NUOVmOwkBtOXDu5eZZ00Ig==", + "version": "1.9.12", + "resolved": "https://registry.npmjs.org/@mate-academy/scripts/-/scripts-1.9.12.tgz", + "integrity": "sha512-/OcmxMa34lYLFlGx7Ig926W1U1qjrnXbjFJ2TzUcDaLmED+A5se652NcWwGOidXRuMAOYLPU2jNYBEkKyXrFJA==", "dev": true, "dependencies": { "@octokit/rest": "^17.11.2", diff --git a/package.json b/package.json index 8ba3c0562..5691b66ca 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,7 @@ "@mate-academy/backstop-config": "latest", "@mate-academy/bemlint": "latest", "@mate-academy/linthtml-config": "latest", - "@mate-academy/scripts": "^1.8.6", + "@mate-academy/scripts": "^1.9.12", "@mate-academy/stylelint-config": "latest", "@parcel/transformer-sass": "^2.12.0", "backstopjs": "6.3.23", diff --git a/src/index.html b/src/index.html index c10199d38..6245b0a7a 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 293d3b1f1..000000000 --- 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 000000000..750f13b22 --- /dev/null +++ b/src/styles/main.scss @@ -0,0 +1,76 @@ +$day-size: 100px; +$day-border: 1px; +$day-color: #eee; +$day-color-hover: #ffbfcb; +$day-font: Arial, sans-serif; +$day-font-size: 30px; +$gap: 1px; +$columns: 7; +$columns-size: $day-size + $day-border * 2; +$max-width: $columns * $day-size + (($columns - 1) * $gap); + +body { + margin: 0; + display: flex; + justify-content: center; + align-items: center; + height: 100vh; +} + +.calendar { + margin: 0 auto; + padding: 10px; + display: flex; + flex-wrap: wrap; + gap: $gap; + max-width: $max-width; + + .calendar__day { + width: $day-size; + height: $day-size; + border: solid $day-border black; + background-color: $day-color; + display: flex; + align-items: center; + justify-content: center; + position: relative; + font-family: $day-font; + font-size: $day-font-size; + box-sizing: border-box; + cursor: pointer; + transition: 0.5s; + + &:first-child { + margin-left: $day-size * 6 + (($columns - 1) * $gap); + } + + &::before { + content: counter(day); + counter-increment: day; + position: absolute; + } + + &:hover { + background-color: $day-color-hover; + transform: translateY(-20px); + } + } + + @each $day, $margin in (mon: 1, tue: 2, wed: 3, thu: 4, fri: 5, sat: 6) { + &.calendar--start-day-#{$day} { + .calendar__day:first-child { + margin-left: calc((#{$day-size} + #{$gap}) * (#{$margin - 1})); + } + } + } + + @for $i from 28 through 31 { + &.calendar--month-length-#{$i} { + .calendar__day:nth-child(n + #{$i + 1}) { + display: none; + } + } + } + + counter-reset: day 0; +}