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 #3935

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

Develop #3935

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
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ 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://kwagfn.github.io/layout_calendar/)
- [TEST REPORT LINK](https://kwagfn.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.

- [ ] Changing 'month-lengh' and 'start-day' modifier in the code element
- [x] Changing 'month-lengh' and 'start-day' modifier in the code element
reflects in changing calendar layout
- [ ] Each day has no modifiers, only class (eg. calendar__day)
- [ ] All `Typical Mistakes` from `BEM` lesson theory are checked.
- [ ] Code follows all the [Code Style Rules ❗️](https://mate-academy.github.io/layout_task-guideline/html-css-code-style-rules)
- [x] Each day has no modifiers, only class (eg. calendar__day)
- [x] All `Typical Mistakes` from `BEM` lesson theory are checked.
- [x] Code follows all the [Code Style Rules ❗️](https://mate-academy.github.io/layout_task-guideline/html-css-code-style-rules)
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>
74 changes: 74 additions & 0 deletions src/styles/index.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,77 @@
body {
margin: 0;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
}

$calendar-day-width: 100px;

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

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

@each $day, $i in $days {
&--start-day-#{$day} {
.calendar__day:nth-child(1) {
margin-left: (
$calendar-day-width * ($i) + ($calendar-day-width * ($i) / 100)

Choose a reason for hiding this comment

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

The calculation for margin-left seems to be adding an extra percentage of the calendar-day-width. Ensure this is intentional and aligns with your design requirements. If not, consider revising the calculation.

);
}
}
}

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

&__day {
box-sizing: border-box;

width: $calendar-day-width;
height: $calendar-day-width;

background-color: #eee;
border: 1px solid black;

align-content: center;
text-align: center;

font-family: Arial, sans-serif;
font-size: 30px;

cursor: pointer;

transition: all 500ms ease;

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

@for $i from 1 through 31 {
&:nth-child(#{$i}):before {
content: '#{$i}';
}
}
}
}
Loading