-
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 task solution #3961
base: master
Are you sure you want to change the base?
add task solution #3961
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 |
---|---|---|
|
@@ -12,7 +12,39 @@ | |
href="styles/index.scss" | ||
/> | ||
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 HTML file is linking to a |
||
</head> | ||
<body> | ||
<h1>Calendar</h1> | ||
<body class="page"> | ||
<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> | ||
<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 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> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,62 @@ | ||
$daySize: 100px; | ||
$countDays: 31; | ||
$gapValue: 1px; | ||
$calendarWidth: $daySize * 7 + 10; | ||
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 |
||
$daysOfWeek: ('mon' 1, 'tue' 2, 'wed' 3, 'thu' 4, 'fri' 5, 'sat' 6, 'sun' 7); | ||
$startDay: 'sun'; | ||
|
||
body { | ||
margin: 0; | ||
display: flex; | ||
justify-content: center; | ||
margin-top: 82px; | ||
font-family: Arial, Helvetica, sans-serif; | ||
font-size: 30px; | ||
} | ||
|
||
.calendar { | ||
display: flex; | ||
flex-wrap: wrap; | ||
padding-inline: 10px; | ||
gap: $gapValue; | ||
max-width: $calendarWidth; | ||
} | ||
|
||
.calendar__day { | ||
display: flex; | ||
box-sizing: border-box; | ||
justify-content: center; | ||
align-items: center; | ||
background-color: #eee; | ||
border: 1px solid black; | ||
height: $daySize; | ||
width: $daySize; | ||
} | ||
|
||
.calendar__day:hover { | ||
cursor: pointer; | ||
background-color: #ffbfcb; | ||
transition-duration: 0.5s; | ||
transform: translateY(-20px); | ||
} | ||
|
||
@for $dayNumber from 1 through 31 { | ||
@if $dayNumber <= $countDays { | ||
.calendar__day:nth-child(#{$dayNumber})::before { | ||
content: '#{$dayNumber}'; | ||
} | ||
} | ||
|
||
@if $dayNumber > $countDays { | ||
.calendar__day:nth-child(#{$dayNumber}) { | ||
display: none; | ||
} | ||
} | ||
} | ||
|
||
@each $name, $value in $daysOfWeek { | ||
@if $startDay == $name { | ||
.calendar--start-day-sun .calendar__day:first-child { | ||
margin-left: ($value * ($daySize + $gapValue)) - ($daySize + $gapValue); | ||
} | ||
} | ||
} |
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
href
attribute is linking to a.scss
file. Typically,.scss
files are not directly used in HTML as they need to be compiled into.css
files. Ensure that the Sass file is compiled into a CSS file and link the resulting CSS file here.