-
Notifications
You must be signed in to change notification settings - Fork 5k
add task solution #5445
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
add task solution #5445
Changes from all commits
7a7b0f8
d2f2424
ac0a036
78fc08f
3eab0a0
b7fbeec
cfbbfc4
8aba36f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,85 @@ | ||
| /* stylelint-disable scss/operator-no-newline-after */ | ||
| $calendar-columns: 7; | ||
| $calendar-days-count: 31; | ||
| $day-border-width: 1px; | ||
| $day-size: 100px; | ||
| $day-bg: #eee; | ||
| $day-border-color: #000; | ||
| $calendar-gap: 1px; | ||
| $calendar-padding: 10px; | ||
| $day-step: $day-size + $calendar-gap; | ||
| $weekdays: ( | ||
| mon: 0, | ||
| tue: 1, | ||
| wed: 2, | ||
| thu: 3, | ||
| fri: 4, | ||
| sat: 5, | ||
| sun: 6, | ||
| ); | ||
|
|
||
| body { | ||
| margin: 0; | ||
| min-height: 100vh; | ||
| display: flex; | ||
| justify-content: center; | ||
| align-items: center; | ||
| } | ||
|
|
||
| .calendar { | ||
| display: flex; | ||
| flex-wrap: wrap; | ||
| gap: $calendar-gap; | ||
| width: ( | ||
| $calendar-columns * $day-size + ($calendar-columns - 1) * $calendar-gap + 2 * | ||
| $calendar-padding | ||
| ); | ||
| padding: $calendar-padding; | ||
| box-sizing: border-box; | ||
| &__day { | ||
| box-sizing: border-box; | ||
| width: $day-size; | ||
| height: $day-size; | ||
| background-color: $day-bg; | ||
| border: $day-border-width solid $day-border-color; | ||
| display: flex; | ||
| align-items: center; | ||
| justify-content: center; | ||
| transition: | ||
| transform 0.5s, | ||
| background-color 0.5s; | ||
| &::before { | ||
| font: | ||
| 30px Arial, | ||
| sans-serif; | ||
| line-height: 1; | ||
| } | ||
| &:hover { | ||
| cursor: pointer; | ||
| background-color: #ffbfcb; | ||
| transform: translateY(-20px); | ||
| } | ||
| } | ||
|
|
||
| @for $i from 1 through $calendar-days-count { | ||
| .calendar__day:nth-child(#{$i})::before { | ||
| content: '#{$i}'; | ||
| } | ||
| } | ||
|
|
||
| @each $day, $offset in $weekdays { | ||
| &--start-day-#{$day} { | ||
| .calendar__day:first-child { | ||
| margin-left: if($offset > 0, $offset * $day-step, 0); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| @for $length from 28 through $calendar-days-count { | ||
| &--month-length-#{$length} { | ||
| .calendar__day:nth-child(n + #{$length + 1}) { | ||
| display: none; | ||
| } | ||
| } | ||
| } | ||
|
Comment on lines
+78
to
+84
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This second |
||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
calendarelement usescalendar--start-day-sunandcalendar--month-length-31, but in SCSS you generate modifiers as&--start-day--#{$day}and&--month-length--#{$length}(double dash before the value). This mismatch violates checklist item #1: "Changing 'month-lengh' and 'start-day' modifier in the code element reflects in changing calendar layout" because changing the HTML modifiers does not trigger the intended styles. Align the class naming convention between HTML and SCSS and keep only one consistent pattern.