Skip to content
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
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ This is possible because [we use the Parcel library](https://en.parceljs.org/scs

❗️ Replace `<your_account>` with your Github username and copy the links to `Pull Request` description:

- [DEMO LINK](https://<your_account>.github.io/layout_calendar/)
- [TEST REPORT LINK](https://<your_account>.github.io/layout_calendar/report/html_report/)
- [DEMO LINK](https://MasyaArc.github.io/layout_calendar/)
- [TEST REPORT LINK](https://MasyaArc.github.io/layout_calendar/report/html_report/)

❗️ Copy this `Checklist` to the `Pull Request` description after links, and put `- [x]` before each point after you checked it.

Expand Down
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"
/>
</head>
<body>
<h1>Calendar</h1>
<div class="calendar calendar--start-day-sun calendar--month-length-31">
<div class="calendar__day"></div>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The description requires: "Use flex with 1px gap and limit its width to exactly 7 columns + 10px paddings" and "Don't use hardcoded px values if they are used several times". Using a hardcoded width: 706px; here does not clearly express 7 columns plus paddings via variables and calculations. Consider deriving the width from $day-width, $calendar-gap, and padding variables to satisfy this requirement.

<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>
3 changes: 0 additions & 3 deletions src/styles/index.scss

This file was deleted.

64 changes: 64 additions & 0 deletions src/styles/main.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
@use 'sass:list';

$modifikator: mon, tue, wed, thu, fri, sat, sun;
$day-width: 100px;
$day-height: 100px;
$calendar-gap: 1px;

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The project still contains an alternative stylesheet (index.scss) with a hardcoded calendar width (706px) and padding, which conflicts with the requirement to express the width as “7 columns + 10px paddings” using variables and to write styles in src/styles/main.scss. This violates the description’s rule to avoid repeated magic px values and to use main.scss as the single source of styles; consider removing or updating index.scss so only the variable-based implementation in main.scss remains.

.calendar {
width: $day-width * 7 + $calendar-gap * 6;
display: flex;
gap: $calendar-gap;
flex-wrap: wrap;
margin: auto;

&__day {
text-align: center;
align-content: center;
background-color: #eee;
box-sizing: border-box;
margin: 0;

width: $day-width;
height: $day-height;
border: 1px solid black;
transition-duration: 500ms;

&:hover {
cursor: pointer;
background-color: #ffbfcb;
transform: translateY(-20px);
}
}
}

@for $i from 1 through 31 {
.calendar .calendar__day:nth-child(#{$i})::before {
content: '#{$i}';
font-family: Arial, Helvetica, sans-serif;
font-size: 30px;
}
}

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

@each $day in $modifikator {
$offset: (list.index($modifikator, $day) - 1) * ($day-width + $calendar-gap);

.calendar--start-day-#{$day} .calendar__day:first-child {
margin-left: $offset;
}
}
Loading