Skip to content
Open

init #5200

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://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
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">

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>
81 changes: 81 additions & 0 deletions src/styles/index.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,84 @@
// Variables

Choose a reason for hiding this comment

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

The task requires: "Write styles in src/styles/main.scss instead of src/style.css." Your stylesheet is named src/styles/index.scss. Move/rename the file to src/styles/main.scss so it matches the required project structure and automatic checks.

$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;
cursor: pointer;

Choose a reason for hiding this comment

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

You set cursor: pointer; on .calendar__day at all times (line 39). The requirement states: "On hovering over a cell: cursor should become pointer." Move cursor: pointer; into the &:hover block so the cursor becomes pointer only on hover.

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 {
background-color: #ffbfcb;
transform: translateY(-20px);
}
}
}

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

Choose a reason for hiding this comment

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

The $start-days map maps 'mon' -> 0 and 'sun' -> 6 which assumes Monday is the leftmost column. The task expects the calendar to start from Sunday by default and that start-day modifiers place the 1st on the correct column. This will produce incorrect month starts and breaks: "Changing 'month-lengh' and 'start-day' modifier in the code element reflects in changing calendar layout" [CHECKLIST ITEM #1]. Consider changing the offsets so 'sun': 0, 'mon': 1, 'tue': 2, 'wed': 3, 'thu': 4, 'fri': 5, 'sat': 6 (or adjust according to your chosen leftmost column), then the margin-left calculation will place first day correctly.

);

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

// month-length modifiers — @for to hide days beyond the chosen length
@for $i from 28 through 31 {

Choose a reason for hiding this comment

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

I don't see the HTML (src/index.html) provided with this submission. Without it I cannot verify HTML-dependent requirements: "Create a markup for the calendar block with 31 days inside", "Set calendar to start from Sunday by default in your HTML", and checklist item #2: "Each day has no modifiers, only class (eg. calendar__day)". Please add src/index.html with the calendar markup (31 .calendar__day elements and default start-day modifier set to Sunday) so I can finish verification.

.calendar--month-length-#{$i} .calendar__day:nth-child(n + #{$i + 1}) {
display: none;
}
}