-
Notifications
You must be signed in to change notification settings - Fork 5k
add task solution #5448
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 #5448
Changes from all commits
9c272da
505ce61
a8515e8
71dc4ab
7f66f2e
ea4395a
29e52f0
82b1337
c310d2a
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> | ||
| <body class="main"> | ||
| <div class="calendar calendar--start-day-sun calendar--month-length-31"> | ||
| <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. The task requires the calendar width to be "exactly 7 columns + 10px paddings" and asks not to reuse hardcoded px values. |
||
| <div class="calendar__day"></div> | ||
| <div class="calendar__day"></div> | ||
| <div class="calendar__day"></div> | ||
| <div class="calendar__day"></div> | ||
|
Comment on lines
+25
to
+26
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. With |
||
| <div class="calendar__day"></div> | ||
| <div class="calendar__day"></div> | ||
|
Comment on lines
+22
to
+28
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 task states all hover changes (transform and background color) must be animated with duration 0.5s, but this transition only animates |
||
| <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> | ||
| <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> | ||
| </body> | ||
| </html> | ||
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,83 @@ | ||
| $day__width: 100px; | ||
| $body__height: 100vh; | ||
| $days__gap: 1px; | ||
| $paddings: 10px; | ||
|
|
||
| * { | ||
| box-sizing: border-box; | ||
| } | ||
|
|
||
| body { | ||
| display: flex; | ||
| justify-content: center; | ||
| align-items: center; | ||
| height: $body__height; | ||
| margin: 0; | ||
| } | ||
|
|
||
| .calendar { | ||
| display: inline-flex; | ||
| max-width: 7 * $day__width + 6 * $days__gap + 2 * $paddings; | ||
| flex-wrap: wrap; | ||
| align-self: center; | ||
| gap: $days__gap; | ||
| padding-left: $paddings; | ||
| padding-right: $paddings; | ||
| } | ||
|
|
||
| .calendar__day { | ||
| width: $day__width; | ||
| height: $day__width; | ||
| background-color: #eee; | ||
| border: 1px solid black; | ||
| transition: | ||
| transform 0.5s, | ||
| background-color 0.5s; | ||
| } | ||
|
|
||
| .calendar__day:hover { | ||
| cursor: pointer; | ||
| transform: translateY(-20px); | ||
| background-color: #ffbfcb; | ||
| } | ||
|
|
||
| @for $i from 1 through 31 { | ||
| .calendar__day:nth-child(#{$i})::before { | ||
| font-family: Arial, Helvetica, sans-serif; | ||
| font-size: 30px; | ||
| content: '#{$i}'; | ||
| color: black; | ||
|
|
||
| display: flex; | ||
| align-items: center; | ||
| justify-content: center; | ||
| width: 100%; | ||
| height: 100%; | ||
| } | ||
| } | ||
|
|
||
| $start-days: ( | ||
| 'mon': 0, | ||
| 'tue': 1, | ||
| 'wed': 2, | ||
| 'thu': 3, | ||
| 'fri': 4, | ||
| 'sat': 5, | ||
| 'sun': 6, | ||
| ); | ||
|
|
||
| @each $day, $index in $start-days { | ||
| .calendar--start-day-#{$day} { | ||
| .calendar__day:first-child { | ||
| margin-left: calc(($day__width + $days__gap) * #{$index}); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| @for $days-count from 28 through 31 { | ||
| .calendar--month-length-#{$days-count} { | ||
| .calendar__day:nth-child(n + #{$days-count + 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.
The calendar width must be calculated as exactly 7 columns plus 10px paddings using SCSS variables, but here you hardcode
max-width: 800pxand don’t base it on the cell size, border, gap, and padding variables as required ("Don't use hardcodedpxvalues if they are used several times" and "Use properly named variables to make all the calculations more clear").