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

add task solution #4021

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
34 changes: 33 additions & 1 deletion src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,38 @@
/>
</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>
Comment on lines +16 to +48

Choose a reason for hiding this comment

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

Ensure that the BEM modifiers for start-day and month-length are correctly implemented and that changing these modifiers reflects in the calendar layout as expected. This is crucial for maintaining the intended functionality and appearance of the calendar.

</body>
</html>
3 changes: 0 additions & 3 deletions src/styles/index.scss

This file was deleted.

67 changes: 67 additions & 0 deletions src/styles/main.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
$cell-size: 100px;
$gap: 1px;
$days: (
'mon': 0,
'tue': 1,
'wed': 2,
'thu': 3,
'fri': 4,
'sat': 5,
'sun': 6,
);

html {
font-family: Arial, Helvetica, sans-serif;
font-size: 30px;
}

body {
margin: 0;
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
}

.calendar {
display: flex;
flex-wrap: wrap;
gap: 1px;
padding: 10px;
width: calc($cell-size * 7 + $gap * 6);

&__day {
box-sizing: border-box;
display: flex;
width: 100px;
height: 100px;
border: 1px solid black;
background-color: #eee;
justify-content: center;
align-items: center;
transition-duration: 0.5s;
&:hover {
cursor: pointer;
background-color: #ffbfcb;
transform: translateY(-20px);
}
}
}

@for $i from 1 through 31 {
.calendar__day:nth-child(n + #{$i})::before {
content: '#{$i}';
}
}

@for $i from 28 through 31 {
.calendar--month-length-#{$i} .calendar__day:nth-child(n + #{$i + 1}) {
display: none;
}
}
Comment on lines +57 to +61

Choose a reason for hiding this comment

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

Ensure that the BEM modifiers for month-length are correctly implemented and that changing these modifiers reflects in the calendar layout as expected. This is crucial for maintaining the intended functionality and appearance of the calendar.


@each $day, $i in $days {
.calendar--start-day-#{$day} .calendar__day:first-child {
margin-left: calc(#{$i} * $cell-size + #{$i * $gap});
}
}
Comment on lines +63 to +67

Choose a reason for hiding this comment

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

Ensure that the BEM modifiers for start-day are correctly implemented and that changing these modifiers reflects in the calendar layout as expected. This is crucial for maintaining the intended functionality and appearance of the calendar.

Loading