diff --git a/src/index.html b/src/index.html index c10199d38b..6245b0a7a0 100644 --- a/src/index.html +++ b/src/index.html @@ -9,10 +9,42 @@ Calendar -

Calendar

+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/styles/blocks/_calendar.scss b/src/styles/blocks/_calendar.scss new file mode 100644 index 0000000000..b5099af495 --- /dev/null +++ b/src/styles/blocks/_calendar.scss @@ -0,0 +1,47 @@ +.calendar { + display: flex; + width: calc($dayWidth * 7 + $gap * 6 + $padding * 2); + gap: $gap; + flex-wrap: wrap; + padding: $padding; + box-sizing: border-box; + + &__day { + background-color: #eee; + width: $dayWidth; + aspect-ratio: 1; + display: flex; + justify-content: center; + align-items: center; + transition: background-color $transitionDuration, transform $transitionDuration; + transition-duration: $transitionDuration; + border: 1px solid black; + box-sizing: border-box; + + &:hover { + cursor: pointer; + background-color: #ffbfcb; + transform: translateY(-20px); + } + + @for $i from 1 through 31 { + &:nth-child(#{$i})::before { + content: '#{$i}'; + font-family: Arial, sans-serif; + font-size: 30px; + } + } + } + + @each $day, $index in $days { + &--start-day-#{$day} &__day:first-child { + margin-left: calc($dayWidth * $index + $gap * $index); + } + } + + @for $i from 28 through 31 { + &--month-length-#{$i} &__day:nth-child(n + #{$i + 1}) { + display: none; + } + } +} diff --git a/src/styles/blocks/_variables.scss b/src/styles/blocks/_variables.scss new file mode 100644 index 0000000000..1ffc2cca4b --- /dev/null +++ b/src/styles/blocks/_variables.scss @@ -0,0 +1,7 @@ +$dayWidth: 100px; +$gap: 1px; +$padding: 10px; + +// prettier-ignore +$days: mon 0, tue 1, wed 2, thu 3, fri 4, sat 5, sun 6; +$transitionDuration: 0.5s; diff --git a/src/styles/index.scss b/src/styles/index.scss deleted file mode 100644 index 293d3b1f13..0000000000 --- a/src/styles/index.scss +++ /dev/null @@ -1,3 +0,0 @@ -body { - margin: 0; -} diff --git a/src/styles/main.scss b/src/styles/main.scss new file mode 100644 index 0000000000..5593c5f009 --- /dev/null +++ b/src/styles/main.scss @@ -0,0 +1,10 @@ +@import './blocks/variables'; +@import './blocks/calendar'; + +body { + margin: 0; + display: flex; + align-items: center; + justify-content: center; + height: 100vh; +}