-
Notifications
You must be signed in to change notification settings - Fork 5k
add task solution #5458
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 #5458
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,10 +9,42 @@ | |
| <title>Calendar</title> | ||
| <link | ||
| rel="stylesheet" | ||
| href="styles/index.scss" | ||
| href="./styles/main.scss" | ||
| /> | ||
| </head> | ||
| <body> | ||
| <h1>Calendar</h1> | ||
| <div class="calendar calendar--start-day-sun calendar--month-length-31"> | ||
|
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. The 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 |
||
| <div class="calendar__day"></div> | ||
| <div class="calendar__day"></div> | ||
| <div class="calendar__day"></div> | ||
|
Comment on lines
+18
to
+19
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.
|
||
| <div class="calendar__day"></div> | ||
| <div class="calendar__day"></div> | ||
| <div class="calendar__day"></div> | ||
| <div class="calendar__day"></div> | ||
| <div class="calendar__day"></div> | ||
| <div class="calendar__day"></div> | ||
| <div class="calendar__day"></div> | ||
|
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. You only set |
||
| <div class="calendar__day"></div> | ||
| <div class="calendar__day"></div> | ||
| <div class="calendar__day"></div> | ||
| <div class="calendar__day"></div> | ||
| <div class="calendar__day"></div> | ||
| <div class="calendar__day"></div> | ||
| <div class="calendar__day"></div> | ||
| <div class="calendar__day"></div> | ||
| <div class="calendar__day"></div> | ||
| <div class="calendar__day"></div> | ||
| <div class="calendar__day"></div> | ||
| <div class="calendar__day"></div> | ||
| <div class="calendar__day"></div> | ||
|
Comment on lines
+38
to
+39
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. The |
||
| <div class="calendar__day"></div> | ||
| <div class="calendar__day"></div> | ||
| <div class="calendar__day"></div> | ||
| <div class="calendar__day"></div> | ||
|
Comment on lines
+38
to
+43
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. Only |
||
| <div class="calendar__day"></div> | ||
| <div class="calendar__day"></div> | ||
| <div class="calendar__day"></div> | ||
| <div class="calendar__day"></div> | ||
| </div> | ||
|
Comment on lines
+46
to
+48
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. The loop for numbering days with |
||
| </body> | ||
| </html> | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,81 @@ | ||
| $day-size: 100px; | ||
| $gap: 1px; | ||
| $calendar-padding: 10px; | ||
| $columns: 7; | ||
| $hover-color: #ffbfcb; | ||
| $day-color: #eee; | ||
| $border-color: #000; | ||
| $hover-shift: 20px; | ||
| $days-width: $day-size * $columns; | ||
| $gaps-width: $gap * ($columns - 1); | ||
| $padding-width: $calendar-padding * 2; | ||
| $calendar-width: $days-width + $gaps-width + $padding-width; | ||
|
|
||
| body { | ||
| margin: 0; | ||
| min-height: 100vh; | ||
| display: flex; | ||
| justify-content: center; | ||
| align-items: center; | ||
| } | ||
|
|
||
| .calendar { | ||
| box-sizing: border-box; | ||
| display: flex; | ||
| flex-wrap: wrap; | ||
| gap: $gap; | ||
| width: $calendar-width; | ||
| padding: 0 $calendar-padding; | ||
| } | ||
|
|
||
| .calendar__day { | ||
| box-sizing: border-box; | ||
| width: $day-size; | ||
| height: $day-size; | ||
| border: 1px solid $border-color; | ||
| background-color: $day-color; | ||
| transition: | ||
| background-color 0.5s, | ||
| transform 0.5s; | ||
|
|
||
| &:hover { | ||
| cursor: pointer; | ||
| background-color: $hover-color; | ||
| transform: translateY(-$hover-shift); | ||
| } | ||
| } | ||
|
|
||
| @for $day from 1 through 31 { | ||
| .calendar__day:nth-child(#{$day})::before { | ||
| content: '#{$day}'; | ||
| display: flex; | ||
| justify-content: center; | ||
| align-items: center; | ||
| height: 100%; | ||
| font-family: Arial, sans-serif; | ||
| font-size: 30px; | ||
| } | ||
| } | ||
|
|
||
| $start-days: ( | ||
| mon: 0, | ||
| tue: 1, | ||
| wed: 2, | ||
| thu: 3, | ||
| fri: 4, | ||
| sat: 5, | ||
| sun: 6, | ||
|
Comment on lines
+60
to
+67
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
Comment on lines
+60
to
+67
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 violates checklist item #1: "Changing 'month-lengh' and 'start-day' modifier in the code element reflects in changing calendar layout" because the |
||
| ); | ||
|
|
||
| @each $day, $offset in $start-days { | ||
| .calendar--start-day-#{$day} .calendar__day:first-child { | ||
| margin-left: calc((#{$day-size} + #{$gap}) * #{$offset}); | ||
| } | ||
| } | ||
|
|
||
| @for $month-length from 28 through 31 { | ||
| .calendar--month-length-#{$month-length} | ||
| .calendar__day:nth-child(n + #{$month-length + 1}) { | ||
| display: none; | ||
| } | ||
| } | ||
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.
calendarwidth is hardcoded with100pxand1pxrepeated, and there is no padding included; this violates the requirement to “use properly named variables” and to limit width to “7 columns + 10px paddings” without duplicatingpxvalues.