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 task solution tarefa Calendar #3932

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
36 changes: 34 additions & 2 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,39 @@
href="styles/index.scss"

Choose a reason for hiding this comment

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

The href attribute in the <link> tag is pointing to a SCSS file (styles/index.scss). Browsers cannot directly interpret SCSS files. You need to compile the SCSS file into a CSS file and link to the resulting CSS file instead.

/>
</head>
<body>
<h1>Calendar</h1>
<body class="calendar-body">
<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>
72 changes: 71 additions & 1 deletion src/styles/index.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,73 @@
body {
$day-size: 100px;
$day-border: 1px;
$padding: 10px;
$gap-size: 1px;
$font-family: Arial, sans-serif;
$font-size: 30px;
$day-bg: #eee;
$day-border-color: black;
$start-day: (mon 0, tue 1, wed 2, thu 3, fri 4, sat 5, sun 6);

.calendar-body {
margin: 0;
display: flex;
justify-content: center;
align-items: center;
font-family: $font-family;
font-size: $font-size;
height: 100vh;
}

.calendar {
flex-wrap: wrap;
display: flex;
align-items: center;
gap: $gap-size;
padding: $padding;
width: calc($day-size * 7 + $gap-size * 6);

&__day {
display: flex;
justify-content: center;
align-items: center;

box-sizing: border-box;
width: $day-size;
height: $day-size;
border: $day-border solid $day-border-color;
background: $day-bg;

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

@for $i from 1 through 31 {
&__day:nth-child(#{$i})::before {
content: '#{$i}';
}
}

@each $day, $index in $start-day {
&.calendar--start-day-#{$day} {
.calendar__day:first-child {
margin-left: calc($index * ($day-size + $gap-size));
}
}
}

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