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

task solution #3941

Open
wants to merge 4 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>
</body>
</html>
68 changes: 68 additions & 0 deletions src/styles/index.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,71 @@
$day-size: 100px;
$calendar-width: ($day-size + 1px) * 7;
$days: (
'mon': 5,
'tue': 101px,
Comment on lines +4 to +5

Choose a reason for hiding this comment

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

In the $days map, the value for 'mon' is given as 5 without a unit, while 'tue' has 101px. Ensure all values in the map have consistent units (e.g., px) for consistency and to avoid potential issues in calculations.

'wed': 202px,
'thu': 303px,
'fri': 404px,
'sat': 505px,
'sun': 606px,
);

* {
box-sizing: border-box;
}

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

.calendar {
display: flex;
width: $calendar-width;
flex-wrap: wrap;
gap: 1px;
}

.calendar__day {
position: relative;
height: $day-size;
width: $day-size;
background-color: #eee;
border: 1px solid #000;
display: flex;
align-items: center;
justify-content: center;
font-family: Arial, Helvetica, sans-serif;
font-size: 30px;
}

@for $day from 1 through 31 {
.calendar__day:nth-of-type(#{$day})::before {
content: '#{$day}';
}
}

.calendar__day:hover {
cursor: pointer;
background-color: #ffbfcb;
transform: translateY(-20px);
transition-duration: 0.5s;
transition-timing-function: ease-in-out;
}

@each $name, $margin in $days {
.calendar--start-day-#{$name} {
.calendar__day:first-child {
margin-left: $margin;
}
}
}

@for $i from 28 through 31 {
.calendar--month-length-#{$i} :nth-child(n + #{$i + 1}) {
display: none;
}
}
Loading