clickable calendar
This commit is contained in:
parent
70d53ff8a0
commit
4cddc90172
3 changed files with 23 additions and 84 deletions
|
@ -1,7 +1,10 @@
|
||||||
<script>
|
<script lang="ts">
|
||||||
import { makeid } from "$lib/functions.js"
|
let current: Number = 9;
|
||||||
let id = makeid(8);
|
|
||||||
let current = 10;
|
function set_day(day: Number) {
|
||||||
|
current = day;
|
||||||
|
return null;
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="calendar rounded">
|
<div class="calendar rounded">
|
||||||
|
@ -21,9 +24,9 @@
|
||||||
{#each [...Array(31).keys()] as day}
|
{#each [...Array(31).keys()] as day}
|
||||||
<li>
|
<li>
|
||||||
{#if current == day+1}
|
{#if current == day+1}
|
||||||
<span class="active">{day+1}</span>
|
<button class="active">{day+1}</button>
|
||||||
{:else}
|
{:else}
|
||||||
{day+1}
|
<button class="nonactive" onclick={set_day(day+1)}>{day+1}</button>
|
||||||
{/if}
|
{/if}
|
||||||
</li>
|
</li>
|
||||||
{/each}
|
{/each}
|
||||||
|
@ -90,8 +93,17 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.days li .active {
|
.days li .active {
|
||||||
|
height: 2em;
|
||||||
padding: 5px;
|
padding: 5px;
|
||||||
border-radius: 30%;
|
border-radius: 30%;
|
||||||
|
aspect-ratio: 1/1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.days li .nonactive {
|
||||||
|
height: 2em;
|
||||||
|
padding: 5px;
|
||||||
|
background: none;
|
||||||
|
aspect-ratio: 1/1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@media screen and (max-width: 720px) {
|
@media screen and (max-width: 720px) {
|
||||||
|
@ -101,6 +113,7 @@
|
||||||
@media screen and (max-width: 420px) {
|
@media screen and (max-width: 420px) {
|
||||||
.weekdays li, .days li {width: 12.5%;}
|
.weekdays li, .days li {width: 12.5%;}
|
||||||
.days li .active {padding: 2px;}
|
.days li .active {padding: 2px;}
|
||||||
|
.days li .nonactive {padding: 2px;}
|
||||||
}
|
}
|
||||||
|
|
||||||
@media screen and (max-width: 290px) {
|
@media screen and (max-width: 290px) {
|
||||||
|
|
|
@ -1,75 +0,0 @@
|
||||||
ul {list-style-type: none;}
|
|
||||||
|
|
||||||
.calendar * {
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.month {
|
|
||||||
width: 100%;
|
|
||||||
text-align: center;
|
|
||||||
align-content: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.month ul {
|
|
||||||
margin: 0;
|
|
||||||
padding: 0.5rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.month ul li {
|
|
||||||
display: inline;
|
|
||||||
text-transform: uppercase;
|
|
||||||
letter-spacing: 3px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.month .prev {
|
|
||||||
float: inline-start;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
.month .next {
|
|
||||||
float: inline-end;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
.weekdays {
|
|
||||||
padding: 10px 0 0 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.weekdays li {
|
|
||||||
display: inline-block;
|
|
||||||
width: 13.6%;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.days {
|
|
||||||
padding: 10px 0;
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.days li {
|
|
||||||
list-style-type: none;
|
|
||||||
display: inline-block;
|
|
||||||
width: 13.6%;
|
|
||||||
text-align: center;
|
|
||||||
margin-bottom: 5px;
|
|
||||||
font-size: smaller;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
.days li .active {
|
|
||||||
padding: 5px;
|
|
||||||
border-radius: 30%;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media screen and (max-width: 720px) {
|
|
||||||
.weekdays li, .days li {width: 13.1%;}
|
|
||||||
}
|
|
||||||
|
|
||||||
@media screen and (max-width: 420px) {
|
|
||||||
.weekdays li, .days li {width: 12.5%;}
|
|
||||||
.days li .active {padding: 2px;}
|
|
||||||
}
|
|
||||||
|
|
||||||
@media screen and (max-width: 290px) {
|
|
||||||
.weekdays li, .days li {width: 12.2%;}
|
|
||||||
}
|
|
|
@ -8,14 +8,15 @@
|
||||||
|
|
||||||
let { children } = $props();
|
let { children } = $props();
|
||||||
|
|
||||||
let page_data = {
|
let page_data = $state({
|
||||||
title: "",
|
title: "",
|
||||||
description: "",
|
description: "",
|
||||||
time_to_read: "",
|
time_to_read: "",
|
||||||
genres: [],
|
genres: [],
|
||||||
tags: [],
|
tags: [],
|
||||||
badges: []
|
badges: [],
|
||||||
}
|
pub_date: ""
|
||||||
|
})
|
||||||
|
|
||||||
function send_json() {
|
function send_json() {
|
||||||
console.log(JSON.stringify(page_data))
|
console.log(JSON.stringify(page_data))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue