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

add homework #3979

Open
wants to merge 6 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
29 changes: 29 additions & 0 deletions .github/workflows/test.yml-template
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Test

on:
pull_request:
branches: [ master ]

jobs:
build:

runs-on: ubuntu-latest

strategy:
matrix:
node-version: [20.x]

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: npm install
- run: npm test
- name: Upload HTML report(backstop data)
if: ${{ always() }}
uses: actions/upload-artifact@v2
with:
name: report
path: backstop_data
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://anastvozniuk.github.io/layout_calendar/)
- [TEST REPORT LINK](https://anastvozniuk.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
83 changes: 83 additions & 0 deletions css/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
body {
margin: 0;
}

.calendar {
margin: 0 auto;
padding: 10px;
display: -webkit-box;
display: -ms-flexbox;
display: flex;

Choose a reason for hiding this comment

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

Consider removing vendor prefixes for display: flex; as modern browsers have good support for flexbox without prefixes. Use tools like Autoprefixer if you need to support older browsers.

-ms-flex-wrap: wrap;
flex-wrap: wrap;
gap: 1px;
max-width: 706px;
counter-reset: day 0;
}
.calendar .calendar__day {
width: 100px;
height: 100px;
border: solid 1px black;
background-color: #eee;
display: -webkit-box;
display: -ms-flexbox;
display: flex;

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, check if vendor prefixes for display: flex; are necessary. Modern browsers typically do not require these prefixes.

-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
-webkit-box-pack: center;
-ms-flex-pack: center;
justify-content: center;
position: relative;
font-family: Arial, sans-serif;
font-size: 30px;
-webkit-box-sizing: border-box;
box-sizing: border-box;
cursor: pointer;
-webkit-transition: linear 0.5s;
transition: linear 0.5s;

Choose a reason for hiding this comment

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

Consider removing the -webkit-transition prefix unless you need to support very old versions of WebKit browsers. Modern browsers support the unprefixed transition property.

}
.calendar .calendar__day:first-child {
margin-left: 606px;
}
.calendar .calendar__day::before {
content: counter(day);
counter-increment: day;
position: absolute;
}
.calendar .calendar__day:hover {
background-color: #ffbfcb;
-webkit-transform: translateY(-20px);
-ms-transform: translateY(-20px);
transform: translateY(-20px);

Choose a reason for hiding this comment

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

Check if vendor prefixes for transform: translateY(-20px); are necessary. Most modern browsers support the unprefixed version.

}
.calendar.calendar--start-day-mon .calendar__day:first-child {
margin-left: calc((100px + 1px * 2 + 1px) * (0));
}
.calendar.calendar--start-day-tue .calendar__day:first-child {
margin-left: calc((100px + 1px * 2 + 1px) * (1));
}
.calendar.calendar--start-day-wed .calendar__day:first-child {
margin-left: calc((100px + 1px * 2 + 1px) * (2));
}
.calendar.calendar--start-day-thu .calendar__day:first-child {
margin-left: calc((100px + 1px * 2 + 1px) * (3));
}
.calendar.calendar--start-day-fri .calendar__day:first-child {
margin-left: calc((100px + 1px * 2 + 1px) * (4));
}
.calendar.calendar--start-day-sat .calendar__day:first-child {
margin-left: calc((100px + 1px * 2 + 1px) * (5));
}
.calendar.calendar--month-length-28 .calendar__day:nth-child(n+29) {
display: none;
}
.calendar.calendar--month-length-29 .calendar__day:nth-child(n+30) {
display: none;
}
.calendar.calendar--month-length-30 .calendar__day:nth-child(n+31) {
display: none;
}
.calendar.calendar--month-length-31 .calendar__day:nth-child(n+32) {
display: none;
}
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"@mate-academy/backstop-config": "latest",
"@mate-academy/bemlint": "latest",
"@mate-academy/linthtml-config": "latest",
"@mate-academy/scripts": "^1.8.6",
"@mate-academy/scripts": "^1.9.12",
"@mate-academy/stylelint-config": "latest",
"@parcel/transformer-sass": "^2.12.0",
"backstopjs": "6.3.23",
Expand Down
38 changes: 37 additions & 1 deletion src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,44 @@
rel="stylesheet"
href="styles/index.scss"
/>
<link
rel="stylesheet"
href="./../css/index.css"

Choose a reason for hiding this comment

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

The link to the stylesheet is pointing to ./../css/index.css. Ensure that this path is correct relative to the HTML file's location. If the file structure is different, update the path accordingly.

/>
</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>
71 changes: 71 additions & 0 deletions src/styles/index.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,74 @@
$day-size: 100px;
$day-border: 1px;
$day-color: #eee;
$day-color-hover: #ffbfcb;
$day-font: Arial, sans-serif;
$day-font-size: 30px;
$gap: 1px;
$columns: 7;
$columns-size: $day-size + $day-border * 2;
$max-width: $columns * $day-size + (($columns - 1) * $gap);

body {
margin: 0;
}

.calendar {
margin: 0 auto;
padding: 10px;
display: flex;
flex-wrap: wrap;
gap: $gap;
max-width: $max-width;

.calendar__day {
width: $day-size;
height: $day-size;
border: solid $day-border black;
background-color: $day-color;
display: flex;
align-items: center;
justify-content: center;
position: relative;
font-family: $day-font;
font-size: $day-font-size;
box-sizing: border-box;
cursor: pointer;
transition: linear 0.5s;

&:first-child {
margin-left: 606px;

Choose a reason for hiding this comment

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

The margin-left value is hardcoded as 606px. Consider calculating this value using the existing SCSS variables to maintain consistency and flexibility. For example, you could use $columns-size * 6 or another appropriate calculation based on your layout requirements.

}

&::before {
content: counter(day);
counter-increment: day;
position: absolute;
}

&:hover {
background-color: $day-color-hover;
transform: translateY(-20px);
}
}

@each $day, $margin in (mon: 1, tue: 2, wed: 3, thu: 4, fri: 5, sat: 6) {
&.calendar--start-day-#{$day} {
.calendar__day:first-child {
margin-left: calc(
(#{$day-size} + #{$day-border} * 2 + #{$gap}) * (#{$margin - 1})
);
}
}
}

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

counter-reset: day 0;
}
Loading