-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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 solution #3977
base: master
Are you sure you want to change the base?
add solution #3977
Changes from all commits
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,65 @@ | ||
@import './utils/variables'; | ||
|
||
body { | ||
margin: 0; | ||
padding-top: 25px; | ||
} | ||
|
||
.calendar { | ||
display: flex; | ||
gap: $gap; | ||
flex-wrap: wrap; | ||
width: $col-count * $cell-width + $gap * $col-count; | ||
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. Ensure that the variables |
||
margin: 0 auto; | ||
|
||
&__day { | ||
display: flex; | ||
font-family: Arial, Helvetica, sans-serif; | ||
justify-content: center; | ||
align-items: center; | ||
font-size: 30px; | ||
line-height: 100%; | ||
box-sizing: border-box; | ||
background-color: #eee; | ||
width: $cell-width; | ||
height: $cell-height; | ||
border: 1px solid black; | ||
|
||
&:first-child { | ||
margin-left: ($col-count - 1) * $cell-width + $gap * ($col-count - 1); | ||
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 |
||
} | ||
|
||
@each $day, $number in $days-of-week { | ||
@if $day == $current-day { | ||
&:first-child { | ||
margin-left: $number * $cell-width + $gap * $number; | ||
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. Ensure that |
||
} | ||
} | ||
} | ||
|
||
&:hover { | ||
transform: translateY(-20px); | ||
background-color: #ffbfcb; | ||
cursor: pointer; | ||
transition-duration: 500ms; | ||
} | ||
|
||
@for $days from 1 through 31 { | ||
&:nth-child(#{$days})::before { | ||
content: '#{$days}'; | ||
} | ||
} | ||
|
||
@for $i from $month-length + 1 through 32 { | ||
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 hiding days beyond the |
||
&:nth-child(#{$i}) { | ||
display: none; | ||
} | ||
} | ||
|
||
@for $i from 28 through 31 { | ||
.calendar--month-length-#{$i} .calendar__day:nth-child(n + #{$i + 1}) { | ||
display: none; | ||
} | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
$col-count: 7; | ||
$gap: 1; | ||
$cell-width: 100; | ||
$cell-height: 100; | ||
$days-of-week: ( | ||
'mon': 0, | ||
'tue': 1, | ||
'wed': 2, | ||
'thu': 3, | ||
'fri': 4, | ||
'sat': 5, | ||
'sun': 6, | ||
); | ||
$month-length: 31; | ||
$current-day: 'sun'; |
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 HTML file links to a
.scss
file, which browsers cannot interpret. Please compile your SCSS to CSS and update the link to point to the compiled CSS file.