-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Add task solution #5213
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 #5213
Changes from 1 commit
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 |
|---|---|---|
| @@ -1,3 +1,79 @@ | ||
| $black: #000; | ||
| $grey: #eee; | ||
| $pink: #ffbfcb; | ||
| $calendar-size: 706px; | ||
| $field-size: calc(($calendar-size - 6px) / 7); | ||
|
|
||
| * { | ||
| box-sizing: border-box; | ||
| } | ||
|
|
||
| body { | ||
| height: 100vh; | ||
| margin: 0; | ||
| display: flex; | ||
| align-items: center; | ||
| justify-content: center; | ||
| } | ||
|
|
||
| .calendar { | ||
| width: $calendar-size; | ||
| height: $calendar-size; | ||
| display: flex; | ||
| flex-wrap: wrap; | ||
| align-content: center; | ||
| gap: 1px; | ||
|
|
||
| &__day { | ||
| flex-basis: $field-size; | ||
| height: $field-size; | ||
| padding: 10px; | ||
| border: 1px solid $black; | ||
| display: flex; | ||
| align-items: center; | ||
| justify-content: center; | ||
| background-color: $grey; | ||
| transition: | ||
| background-color 0.5s, | ||
| transform 2s; | ||
| &:hover { | ||
| background-color: $pink; | ||
| transform: translateY(-20px); | ||
| cursor: pointer; | ||
| } | ||
| } | ||
|
|
||
| @for $index from 1 through 31 { | ||
| &__day:nth-child(#{$index})::before { | ||
| content: '#{$index}'; | ||
| font-family: Arial, sans-serif; | ||
| font-size: 30px; | ||
| } | ||
| } | ||
|
|
||
| $days: ( | ||
| mon: 0, | ||
| tue: 1, | ||
| wed: 2, | ||
| thu: 3, | ||
| fri: 4, | ||
| sat: 5, | ||
| sun: 6, | ||
| ); | ||
|
|
||
| @each $day, $index in $days { | ||
| &--start-day-#{$day} { | ||
| .calendar__day:first-child { | ||
| margin-left: ($index * $field-size) + $index; | ||
|
||
| } | ||
| } | ||
| } | ||
|
|
||
| @for $length from 28 through 31 { | ||
| &--month-length-#{$length} { | ||
| .calendar__day:nth-child(n + #{$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.
You've set a fixed height for the calendar, making it a square. This doesn't adapt to the content, which can have a varying number of rows (e.g., 5 or 6) depending on the month's start day. A fixed height can create unnecessary empty space inside the calendar block. The height should be determined by its content.