-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
add task solution #3936
base: master
Are you sure you want to change the base?
add task solution #3936
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 |
---|---|---|
@@ -1,3 +1,14 @@ | ||
* { | ||
box-sizing: border-box; | ||
} | ||
|
||
body { | ||
flex-direction: column; | ||
display: flex; | ||
justify-content: center; /* Вирівнює по горизонталі */ | ||
align-items: center; /* Вирівнює по вертикалі */ | ||
height: 100vh; | ||
margin: 0; | ||
} | ||
|
||
@import 'main'; | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
$day-size: 100px; | ||
$border-color: #000; | ||
$default-bg-color: #eee; | ||
$hover-bg-color: #ffbfcb; | ||
$font-size: 30px; | ||
$font-family: Arial, sans-serif; | ||
$columns: 7; | ||
$padding: 10px; | ||
$animation-duration: 0.5s; | ||
|
||
.calendar { | ||
display: flex; | ||
flex-wrap: wrap; | ||
gap: 1px; | ||
width: calc(#{$columns} * (#{$day-size} + 1px) - 1px); | ||
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 calculation for the calendar width uses a combination of variables and arithmetic operations. Ensure that the calculation accounts for all necessary spacing and border widths to avoid layout issues. |
||
margin: 0 auto; | ||
align-items: center; | ||
counter-reset: day 0; | ||
|
||
&__day { | ||
width: $day-size; | ||
height: $day-size; | ||
background-color: $default-bg-color; | ||
border: 1px solid $border-color; | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
font-family: $font-family; | ||
font-size: $font-size; | ||
position: relative; | ||
cursor: pointer; | ||
transition: | ||
transform $animation-duration, | ||
background-color $animation-duration; | ||
counter-increment: day; | ||
|
||
&::before { | ||
content: counter(day); | ||
} | ||
|
||
&:hover { | ||
background-color: $hover-bg-color; | ||
transform: translateY(-20px); | ||
} | ||
} | ||
|
||
// Позиціюємо перший день у залежності від того, з якого дня починається місяць | ||
@each $day, $index in (mon: 0, tue: 1, wed: 2, thu: 3, fri: 4, sat: 5, sun: 6) | ||
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 |
||
{ | ||
&--start-day-#{$day} .calendar__day:nth-child(1) { | ||
/* Перший день має "заповнити" необхідне місце за допомогою flex-basis */ | ||
margin-left: calc(#{$index} * (#{$day-size} + 1px)); | ||
} | ||
} | ||
|
||
// Приховуємо додаткові дні для місяців з меншою кількістю днів | ||
@for $i from 28 through 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 |
||
&--month-length-#{$i} .calendar__day:nth-child(n + #{$i + 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
@import
rule is used to include themain
SCSS file. Make sure that themain.scss
file exists in the same directory or provide the correct path. Note that@import
is deprecated in favor of@use
and@forward
in newer versions of Sass, which offer better modularity and avoid potential conflicts.