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

calendar solution #3986

Open
wants to merge 1 commit 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
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://Igor-Pysak.github.io/layout_calendar/)
- [TEST REPORT LINK](https://Igor-Pysak.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>
<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>
58 changes: 58 additions & 0 deletions src/styles/calendar.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
body {
margin: 0;
font-family: Arial, Helvetica, sans-serif;
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
}

.calendar {
width: calc($day-size * 7 + $gap-size * 6);

Choose a reason for hiding this comment

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

The variable $day-size is used but not defined in this file. Ensure it is defined or imported from another SCSS file.

display: flex;
flex-wrap: wrap;
column-count: 7;
gap: $gap-size;

Choose a reason for hiding this comment

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

The variable $gap-size is used but not defined in this file. Ensure it is defined or imported from another SCSS file.

padding: 10px;

&__day {
cursor: pointer;
box-sizing: border-box;
position: relative;
display: flex;
justify-content: center;
align-items: center;
background-color: #eee;
border: 1px solid black;
height: $day-size;
width: $day-size;
transition: 0.5s;
}

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

@for $i from 1 through 31 {
&__day:nth-child(#{$i})::before {
content: '#{$i}';
position: absolute;
text-align: center;
font-size: 30px;
color: black;
}
}

@each $day, $day-position in $week-days {

Choose a reason for hiding this comment

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

The variable $week-days is used but not defined in this file. Ensure it is defined or imported from another SCSS file.

&--start-day-#{$day} > &__day:first-child {
margin-left: calc(($day-size + $gap-size) * $day-position);
}
}

@for $number from 28 through 31 {
&--month-length-#{$number} :nth-child(n + #{$number + 1}) {
display: none;
}
}
}
5 changes: 2 additions & 3 deletions src/styles/index.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
body {
margin: 0;
}
@import './variables';
@import './calendar';
11 changes: 11 additions & 0 deletions src/styles/variables.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
$week-days: (
'mon': 0,
'tue': 1,
'wed': 2,
'thu': 3,
'fri': 4,
'sat': 5,
'sun': 6,
);
$day-size: 100px;
$gap-size: 1px;
Loading