Skip to content
Open

init #5200

Show file tree
Hide file tree
Changes from 2 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
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://peloso31.github.io/layout_calendar/)
- [TEST REPORT LINK](https://peloso31.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
170 changes: 5 additions & 165 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": "^2.1.3",
"@mate-academy/stylelint-config": "latest",
"@parcel/transformer-sass": "^2.12.0",
"backstopjs": "6.3.23",
Expand Down
36 changes: 34 additions & 2 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,42 @@
<title>Calendar</title>
<link
rel="stylesheet"
href="styles/index.scss"
href="styles/main.scss"
/>
</head>
<body>
<h1>Calendar</h1>
<div class="calendar calendar--start-day-sun calendar--month-length-31">

Choose a reason for hiding this comment

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

The HTML currently links to styles/index.scss (in the ) and the project requires styles written in src/styles/main.scss. Please place your SCSS in src/styles/main.scss and upload that file so I can validate SCSS-specific requirements (use of @for/@each, ::before numbering, flex layout, hover behavior, nth-child month-length logic, etc.). Without the SCSS file I cannot verify checklist items that depend on styling, including: "Changing 'month-lengh' and 'start-day' modifier in the code element reflects in changing calendar layout" [CHECKLIST ITEM #1], "All Typical Mistakes from BEM lesson theory are checked." [CHECKLIST ITEM #3], and "Code follows all the Code Style Rules ❗️" [CHECKLIST ITEM #4].

<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>
85 changes: 85 additions & 0 deletions src/styles/main.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
// Variables
$day-size: 100px;
$border-width: 1px;
$gap: 1px;
$padding: 10px;
$columns: 7;

// Step between the start of one day and the next (size + gap)
$day-step: $day-size + $gap;

// Total calendar width: 7 columns + 6 gaps + 2 side paddings
$calendar-width: $columns * $day-size + ($columns - 1) * $gap + 2 * $padding;

body {
margin: 0;
min-height: 100vh;
display: flex;
justify-content: center;
align-items: center;
}

.calendar {
display: flex;
flex-wrap: wrap;
gap: $gap;
padding: $padding;
width: $calendar-width;
box-sizing: border-box;

&__day {
box-sizing: border-box;
width: $day-size;
height: $day-size;
background-color: #eee;
border: $border-width solid black;
display: flex;
justify-content: center;
align-items: center;
transition:
background-color 0.5s,
transform 0.5s;

// Generate day numbers via ::before using @for
@for $i from 1 through 31 {
&:nth-child(#{$i})::before {
content: '#{$i}';
font-family: Arial, sans-serif;
font-size: 30px;
}
}

&:hover {
cursor: pointer;
background-color: #ffbfcb;
transform: translateY(-20px);
}
}
}

// start-day modifiers — @each over day name → column offset map
// Sun is column 1 (offset 0), Mon is column 2 (offset 1), … Sat is column 7 (offset 6)
$start-days: (
'sun': 0,
'mon': 1,
'tue': 2,
'wed': 3,
'thu': 4,
'fri': 5,
'sat': 6,
);

@each $day, $offset in $start-days {
.calendar--start-day-#{$day} .calendar__day:first-child {
@if $offset > 0 {
margin-left: $offset * $day-step;
}
Comment on lines 62 to 76

Choose a reason for hiding this comment

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

This violates checklist item #1: "Changing 'month-lengh' and 'start-day' modifier in the code element reflects in changing calendar layout". The $start-days map currently treats 'sun' as offset 0 (leftmost column) and 'mon' as offset 1 (lines 62–69 and the @each block 72–77). The task requires a Monday-first week (Monday should be column 1, Friday column 5), and the HTML default must be calendar--start-day-sun (so 'sun' should map to the last column). Update the offsets so Monday maps to 0, Tuesday 1, … Sunday 6 (or otherwise adjust the margin-left calculation to reflect a Monday-first layout). After that, changing .calendar--start-day-* classes will place day 1 in the correct column.

}
}

// month-length modifiers — @for to hide days beyond the chosen length
@for $i from 28 through 31 {
.calendar--month-length-#{$i} .calendar__day:nth-child(n + #{$i + 1}) {
display: none;
}
}
Loading