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

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

Develop #3983

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
17 changes: 9 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,15 @@ Display a calendar in the middle of the screen (both horizontally and vertically
- Set 31 days by default

On hovering over a cell:

- cursor should become pointer
- The hovered cell has to become pink (use `#FFBFCB`)
- Move the hovered cell up by `20px` (use `transform`)
- All changes should be animated with the duration of 0.5s

> Here are the [Layout Tasks Instruction](https://github.com/mate-academy/layout_task-guideline#how-to-solve-the-layout-tasks-on-github)

*Important note*: In this task, you are allowed to link `*.scss` files directly in HTML `<link>` tags using `href` attribute.
_Important note_: In this task, you are allowed to link `*.scss` files directly in HTML `<link>` tags using `href` attribute.
This is possible because [we use the Parcel library](https://en.parceljs.org/scss.html) to bundle your solution's source code.

![reference image](reference.png).
Expand All @@ -36,13 +37,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://maksym2493.github.io/layout_calendar/)
- [TEST REPORT LINK](https://maksym2493.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
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] Changing 'month-lengh' and 'start-day' modifier in the code element
reflects in changing calendar layout
- [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)
37 changes: 35 additions & 2 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,43 @@
<title>Calendar</title>
<link
rel="stylesheet"
href="styles/index.scss"
href="styles/style.scss"

Choose a reason for hiding this comment

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

The stylesheet link references a .scss file, which is a Sass file. Ensure this file is compiled to a .css file and link the resulting .css file instead.

/>
</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>
60 changes: 60 additions & 0 deletions src/styles/blocks/calendar.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
@use 'sass:list';

$gap-width: 1px;
$day-size: 100px;
$number-of-columns: 7;
$days-of-week: mon, tue, wed, thu, fri, sat, sun;

.calendar {
padding: 10px;
display: flex;
flex-wrap: wrap;
gap: $gap-width;
width: $day-size * $number-of-columns + $gap-width * ($number-of-columns - 1);

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

&__day {
width: $day-size;
height: $day-size;
background-color: #eee;

display: flex;
align-items: center;
justify-content: center;

box-sizing: border-box;
border: 1px solid #000;

transition-duration: 0.5s;

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

&:hover {
cursor: pointer;
background-color: #ffbfcb;

transition-duration: 0.5s;
transform: translateY(-20px);
}
}

@each $day in $days-of-week {
&--start-day-#{$day} > :first-child {
$i: list.index($days-of-week, $day) - 1;

margin-left: ($day-size + $gap-width) * $i;
}
}

@for $i from 28 through 31 {
&--month-length-#{$i} > :nth-child(n + #{$i + 1}) {
display: none;
}
}
}
8 changes: 8 additions & 0 deletions src/styles/blocks/page.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
body {
margin: 0;
height: 100vh;

display: flex;
align-items: center;
justify-content: center;
}
3 changes: 0 additions & 3 deletions src/styles/index.scss

This file was deleted.

2 changes: 2 additions & 0 deletions src/styles/style.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@import './blocks/page';
@import './blocks/calendar';