diff --git a/i18n/en.toml b/i18n/en.toml new file mode 100644 index 0000000..c6da9f0 --- /dev/null +++ b/i18n/en.toml @@ -0,0 +1,8 @@ +[days] +sun = "Sunday" +mon = "Monday" +tues = "Tuesday" +wend = "Wednesday" +thurs = "Thursday" +fri = "Friday" +sat = "Saturday" \ No newline at end of file diff --git a/i18n/pl.toml b/i18n/pl.toml new file mode 100644 index 0000000..ffa89e2 --- /dev/null +++ b/i18n/pl.toml @@ -0,0 +1,8 @@ +[days] +sun = "Niedziela" +mon = "Poniedziałek" +tues = "Wtorek" +wend = "Środa" +thurs = "Czwartek" +fri = "Piątek" +sat = "Sobota" \ No newline at end of file diff --git a/layouts/shortcodes/calendar.html b/layouts/shortcodes/calendar.html index 9aa7975..17bc3bd 100644 --- a/layouts/shortcodes/calendar.html +++ b/layouts/shortcodes/calendar.html @@ -15,101 +15,47 @@ {{ $daysInMonth := $daysInMonth.Hours }} {{ $daysInMonth := div $daysInMonth 24 }} -{{ $padding := $t1.Weekday | int }} -
- {{ if eq .Site.Language.Lang "pl" }}{{ $polish_month_names := slice "Styczeń" "Luty" "Marzec" "Kwiecień" "Maj" "Czerwiec" "Lipiec" "Sierpień" "Wrzesień" "Październik" "Listopad" "Grudzień" }}{{ $month := sub $month 1}}{{ $label := index $polish_month_names $month }}{{ printf "%s %d" $label $year }}{{ else }}{{ time.Format "January 2006" $t1 }}{{ end }} -
- {{ if gt $padding 0 }} - {{ range seq 1 $padding }} -
- {{ end }} - {{ end }} + + {{ if eq .Site.Language.Lang "pl" }} + {{ $polish_month_names := slice "Styczeń" "Luty" "Marzec" "Kwiecień" "Maj" "Czerwiec" "Lipiec" "Sierpień" "Wrzesień" "Październik" "Listopad" "Grudzień" }} + {{ $month := sub $month 1}} + {{ $label := index $polish_month_names $month }} + {{ printf "%s %d" $label $year }} + {{ else }} + {{ time.Format "January 2006" $t1 }} + {{ end }} +
+ {{ $days := slice "sun" "mon" "tues" "wend" "thurs" "fri" "sat" }} + {{ range $days }}

{{ i18n (printf "days.%s" .) }}

{{ end }} +
+ +
+ {{ $padding := $t1.Weekday | int }} + {{ if gt $padding 0 }} + {{ range seq 1 $padding }} +
+ {{ end }} + {{ end }} {{ range seq 1 $daysInMonth }}
- {{ $startDate := printf "%4d-%02d-%02dT00:00:00" $year $month . }} - {{ $startDate := time.AsTime $startDate }} - {{ $endDate := printf "%4d-%02d-%02dT23:59:59" $year $month . }} - {{ $endDate := time.AsTime $endDate }} - - {{ . }} - ` - {{ range where $.Site.RegularPages "Section" "eq" "events" }} - {{ $eventStart := time.AsTime .Params.start_date | int }} - {{ if after $eventStart $startDate }} -

{{ .Title }}

- {{ end }} - + {{ $startDate := time.AsTime ( printf "%4d-%02d-%02dT00:00:00" $year $month . ) }} + {{ $endDate := time.AsTime ( printf "%4d-%02d-%02dT23:59:59" $year $month . ) }} +

{{ . }}

+ {{ range where $.Site.RegularPages "Section" "eq" "events" }} + {{ $eventStart := time.AsTime .Params.start_date }} + {{ $eventEnd := time.AsTime .Params.end_date }} + + {{ if and ( or ($eventEnd.After $startDate) ($eventEnd.Equal $startDate)) (or ( $eventStart.Before $endDate ) ( $eventStart.Equal $endDate )) }} + + {{ end }} {{ end }} - -
-{{ end }} - - - - -{{ range where .Site.Pages "Type" "event" }} - {{ if (and (gt .Params.start_date $.Date) (lt .Params.end_date $.Date)) }} -

{{ .Title }}

- {{ end }} -{{ end }} - - - - +
+ {{ end }}
-
- - - - + \ No newline at end of file diff --git a/static/css/calendar.css b/static/css/calendar.css new file mode 100644 index 0000000..ce8f390 --- /dev/null +++ b/static/css/calendar.css @@ -0,0 +1,113 @@ +:root { +--cal-bg: darkslategray; +--cal-fg: white; + +--cal-month-bg: black; +--cal-month-fg: cyan; + +--cal-weekdays-bg: gray ; +--cal-weekdays-fg: black; + +--cal-day-empty-fg: #888; +--cal-day-empty-bg: #555; + +--cal-day-busy-fg: #555; +--cal-day-busy-bg: #888; + +--cal-day-hover-fg: #555; +--cal-day-hover-bg: black; + +--cal-event-fg: white; +--cal-event-bg: var(--acc-1) ; +} + + .calendar { + width: 100%; + max-width: 1000px; + margin: 20px auto; + padding: 0; + background-color: var(--cal-bg); + color: var(--cal-fg); + } + + a.month { + display: block; + width: 100%; + padding: 15px 0; + text-align: center; + background-color: var(--cal-month-bg); + color: var(--cal-month-fg); + } + + .days { + width: calc(100% - 10 px) ; + padding: 5px; + margin: auto; + display: flex; + flex-wrap: wrap; + } + + .weekdays { + display: block; + width: 100%; + margin: 0; + padding: 0; + } + + .weekdays p { + display: inline-block; + width: calc(14.28%); + background-color: var(--cal-weekdays-bg); + color: var(--cal-weekdays-fg); + margin: 0; + padding: 0; + text-align: center; + /* border: 0px solid var(--bg); */ + /* border-collapse: collapse; */ +} + + .pad-day, .day { + width: calc(14.28% - 3px - 10px); + padding: 0 5px; + margin: 1.5px; + aspect-ratio: 1; + } + + + .day { + background-color: var(--cal-day-empty-bg); + color: var(--cal-day-empty-fg); + transition: 400ms; + + display: flex; + align-items: center; + justify-content: center; + text-align: center; + } + + + .day:has(>.event) { + display: block; + color: var(--cal-day-busy-fg); + background-color: var(--cal-day-busy-bg); + } + +.day:has(>.event):hover { + transform: scale(1.2); + background-color: var(--cal-day-hover-bg); + color: var(--cal-day-hover-fg); + } + + .day-num { + font-size: 48px; + } + +.day:has(>.event) .day-num { + font-size: 32px; + } + + .event, .event a { + color: var(--cal-event-fg); + background-color: var(--cal-event-bg); + } + \ No newline at end of file