-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
Calendar #3989
base: master
Are you sure you want to change the base?
Calendar #3989
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
@import './utils/variables'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ensure that the file |
||
|
||
body { | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
min-height: 100vh; | ||
margin: 0; | ||
} | ||
|
||
.calendar { | ||
font-family: Arial, sans-serif; | ||
font-size: 30px; | ||
display: flex; | ||
flex-wrap: wrap; | ||
gap: 1px; | ||
width: $width-calendar; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The variable |
||
margin: auto; | ||
|
||
@each $name, $number in $week-day { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The loop uses |
||
&--start-day-#{$name} > :first-child { | ||
margin-left: (($number - 1) * $width-square) + ($number - 1); | ||
} | ||
} | ||
|
||
&--month-length-28 > :nth-last-child(-n + 3) { | ||
display: none; | ||
} | ||
|
||
&--month-length-29 > :nth-last-child(-n + 2) { | ||
display: none; | ||
} | ||
|
||
&--month-length-30 > :nth-last-child { | ||
display: none; | ||
} | ||
|
||
&__day { | ||
background-color: #eee; | ||
width: $width-square; | ||
height: $width-square; | ||
border: 1px solid black; | ||
box-sizing: border-box; | ||
|
||
text-align: center; | ||
line-height: $width-square; | ||
|
||
@for $i from 1 through $month-length { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The loop uses |
||
&:nth-child(#{$i})::before { | ||
content: '#{$i}'; | ||
} | ||
} | ||
|
||
&:hover { | ||
cursor: pointer; | ||
background-color: #ffbfcb; | ||
transform: translateY(-20px); | ||
transition-duration: 0.5s; | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
.calendar { | ||
@each $name, $number in $week-day { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ensure that the variable |
||
&--start-day--#{name} { | ||
margin-left: (($number - 1) * $width-square) + ($number - 1); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The variable |
||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
$width-square: 100px; | ||
$width-calendar: ($width-square * 7) + 10px; | ||
$week-day: ('mon' 1, 'tue' 2, 'wed' 3, 'thu' 4, 'fri' 5, 'sat' 6, 'sun' 7); | ||
$month-length: 31; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
href
attribute is linking to a.scss
file (styles/main.scss
). Browsers cannot directly interpret SCSS files. You should link to the compiled CSS file instead, such asstyles/main.css
.