Skip to content
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

Develop #3893

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

Develop #3893

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 34 additions & 2 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,42 @@
<title>Calendar</title>
<link
rel="stylesheet"
href="styles/index.scss"
href="./styles/main.scss"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The href attribute in the link tag is pointing to a '.scss' file. Browsers cannot directly interpret SCSS files; they need to be compiled into CSS first. Ensure that the SCSS file is compiled to a CSS file and update the href to point to the resulting '.css' file.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The stylesheet link is pointing to a '.scss' file. HTML cannot directly use SCSS files; they need to be compiled to CSS first. Ensure the stylesheet is linked to a '.css' file instead.

/>
</head>
<body>
<h1>Calendar</h1>
<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>
7 changes: 7 additions & 0 deletions src/styles/blocks/body.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
body {
margin: 0;
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
}
54 changes: 54 additions & 0 deletions src/styles/blocks/calendar.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
.calendar {
display: flex;
flex-wrap: wrap;
width: ($day-size + $gap) * $col-count - $gap;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ensure that the variables $day-size, $gap, and $col-count are defined elsewhere in your SCSS files. If they are not defined, this will cause a compilation error.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ensure that the variables $day-size, $gap, $col-count, and $padding are defined elsewhere in your SCSS files. If they are not defined, this will cause a compilation error.

gap: $gap;
padding: $padding;

&__day {
display: flex;
height: $day-size;
width: $day-size;
border: 1px solid black;
background-color: #eee;

position: relative;
text-align: center;
align-items: center;
justify-content: center;
box-sizing: border-box;

&:hover {
cursor: pointer;
background-color: #ffbfcb;
transform: translate(0, -20px);
transition-duration: 0.5s;
}

@for $number from 1 through $month-length {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ensure that the variable $month-length is defined and holds the correct number of days for the month you are styling. Otherwise, the loop will not work as intended.

&:nth-child(#{$number})::before {
content: '#{$number}';
display: block;
position: absolute;
font-family: Arial, Helvetica, sans-serif;
font-size: 30px;
}
}
}

@each $day, $index in $week-day {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ensure that the variable $week-day is defined as a list or map of days. This is necessary for the @each loop to function correctly.

&--start-day-#{$day} {
.calendar__day:first-child {
margin-left: ($day-size + $gap) * $index;
}
}
}

@for $day from 28 through $month-length {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ensure that the variable $month-length is defined and correctly set to the number of days in the current month. This is crucial for the correct functioning of the calendar layout.

&--month-length-#{$day} {
.calendar__day:nth-child(n + #{$day + 1}) {
display: none;
}
}
}
}
3 changes: 0 additions & 3 deletions src/styles/index.scss

This file was deleted.

3 changes: 3 additions & 0 deletions src/styles/main.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@import '../utils/variables';
@import '../styles/blocks/body';
@import '../styles/blocks/calendar';
14 changes: 14 additions & 0 deletions src/utils/variables.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
$day-size: 100px;
$col-count: 7;
$padding: 10px;
$gap: 1px;
$week-day: (
'mon': 0,
'tue': 1,
'wed': 2,
'thu': 3,
'fri': 4,
'sat': 5,
'sun': 6,
);
$month-length: 31;
Loading