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

Solution of task Calendar #3956

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
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://MannyShussan.github.io/layout_calendar/)
- [TEST REPORT LINK](https://MannyShussan.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
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>
<section 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>
</section>
</body>
</html>
67 changes: 67 additions & 0 deletions src/styles/index.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,70 @@
body {
margin: 0;
min-height: 100vh;
display: flex;
justify-content: center;
align-items: center;
box-sizing: border-box;
}

.calendar {
padding: 10px;
display: flex;

Choose a reason for hiding this comment

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

Consider refactoring repeated px values into variables for better maintainability and readability. This will help make your code more efficient and easier to update in the future.

flex-wrap: wrap;
gap: 1px;
width: 706px;

// .calendar__item

&__day {
box-sizing: border-box;
list-style: none;
height: 100px;
width: 100px;
background-color: #eee;
border: 1px solid black;
display: flex;
align-items: center;
justify-content: center;

&:hover {
background-color: #ffbfcb;
transform: translateY(-20px);
animation: move 0.5s;
}
}

@for $number from 1 through 31 {
& :nth-child(#{$number})::before {

Choose a reason for hiding this comment

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

The selector '& :nth-child(#{$number})::before' might cause specificity issues due to the space before ':nth-child'. Consider removing the space to ensure the styles are applied correctly to the intended elements.

content: '#{$number}';
font-family: Arial, Helvetica, sans-serif;
font-size: 30px;
}
}

$days: ('mon' 0, 'tue' 1, 'wed' 2, 'thu' 3, 'fri' 4, 'sat' 5, 'sun' 6);

@each $day, $dayCount in $days {
&--start-day-#{$day} :first-child {

Choose a reason for hiding this comment

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

Similar to the previous comment, the selector '&--start-day-#{$day} :first-child' has a space that might lead to specificity issues. Remove the space to ensure the styles are applied correctly.

margin-left: 101px * $dayCount;
}
}

@for $number from 28 through 31 {
&--month-length-#{$number} :nth-child(n + #{$number + 1}) {

Choose a reason for hiding this comment

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

The selector '&--month-length-#{$number} :nth-child(n + #{$number + 1})' also contains a space that might cause specificity issues. Consider removing the space to ensure the styles are applied correctly.

display: none;
}
}

@keyframes move {
from {
background-color: #eee;
transform: translate(0);
}

to {
background-color: #ffbfcb;
transform: translate(0, -20px);
}
}
}
Loading