Skip to content

Commit

Permalink
add task solution
Browse files Browse the repository at this point in the history
  • Loading branch information
GrzegorzLasota committed Oct 28, 2024
1 parent 7f98364 commit 57d3bfb
Show file tree
Hide file tree
Showing 7 changed files with 378 additions and 2 deletions.
36 changes: 35 additions & 1 deletion src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,40 @@
/>
</head>
<body>
<h1>Calendar</h1>
<main class="calendar">
<div
class="day calendar__day1 day--mon day--tue day--wed day--thu day--fri day--sat day--sun"
></div>
<div class="day calendar__day2"></div>
<div class="day calendar__day3"></div>
<div class="day calendar__day4"></div>
<div class="day calendar__day5"></div>
<div class="day calendar__day6"></div>
<div class="day calendar__day7"></div>
<div class="day calendar__day8"></div>
<div class="day calendar__day9"></div>
<div class="day calendar__day10"></div>
<div class="day calendar__day11"></div>
<div class="day calendar__day12"></div>
<div class="day calendar__day13"></div>
<div class="day calendar__day14"></div>
<div class="day calendar__day15"></div>
<div class="day calendar__day16"></div>
<div class="day calendar__day17"></div>
<div class="day calendar__day18"></div>
<div class="day calendar__day19"></div>
<div class="day calendar__day20"></div>
<div class="day calendar__day21"></div>
<div class="day calendar__day22"></div>
<div class="day calendar__day23"></div>
<div class="day calendar__day24"></div>
<div class="day calendar__day25"></div>
<div class="day calendar__day26"></div>
<div class="day calendar__day27"></div>
<div class="day calendar__day28 day__month--length"></div>
<div class="day calendar__day29 day__month--length"></div>
<div class="day calendar__day30 day__month--length"></div>
<div class="day calendar__day31 day__month--length"></div>
</main>
</body>
</html>
272 changes: 272 additions & 0 deletions src/style.css

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

1 change: 1 addition & 0 deletions src/style.css.map

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

10 changes: 10 additions & 0 deletions src/styles/blocks/calendar.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.calendar {
box-sizing: border-box;
padding: 10px;
width: 732px;
min-height: 500px;
display: flex;
align-items: center;
flex-wrap: wrap;
gap: 1px;
}
27 changes: 27 additions & 0 deletions src/styles/blocks/days.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
.day {
width: 100px;
height: 100px;
box-sizing: border-box;
background-color: #eee;
border: 1px solid black;
margin: 0;
padding: 10px;
display: flex;
align-items: center;
justify-content: center;
transition: all 0.5s;
}

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

@for $i from 1 through 31 {
.calendar__day#{$i}::before {
content: '#{$i}';
font-family: Arial, Helvetica, sans-serif;
font-size: 30px;
}
}
12 changes: 11 additions & 1 deletion src/styles/index.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
@use './blocks/calendar.scss';
@use './blocks/days.scss';
@use './utils/variables.scss';

body {
margin: 0;
margin: 0 auto;
padding: 10px;
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
width: 1000px;
}
22 changes: 22 additions & 0 deletions src/styles/utils/variables.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
$start-day: // a
'mon' 0,
'tue' 105px,
'wed' 205px,
'thu' 305px,
'fri' 405px,
'sat' 505px,
'sun' 606px;

@each $day, $margin in $start-day {
.day--#{$day} {
margin-left: $margin;
}
}

$month-length: 28, 29, 30, 31;

@for $i from 28 through 31 {
.calendar .day__month--length:nth-child(#{$i}) {
opacity: 1;
}
}

0 comments on commit 57d3bfb

Please sign in to comment.