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

Set start time on time stamper component #1203

Merged
merged 2 commits into from
Nov 28, 2024
Merged
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
3 changes: 2 additions & 1 deletion common-theme/assets/scripts/time-stamper.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,15 @@ class TimeStamper extends HTMLElement {
`;

this.timelineEntries = this.querySelectorAll(".c-block");
this.startTime = this.getAttribute('start-time');
}

connectedCallback() {
this.stampTime();
}

stampTime() {
let currentTime = new Date("1970-01-01T10:00:00"); // Set initial time to 10:00 AM
let currentTime = new Date(`1970-01-01T${this.startTime}`); // Set initial time to 10:00 AM

this.timelineEntries.forEach((entry) => {
const timeElement = entry.querySelector(".c-block__time");
Expand Down
1 change: 1 addition & 0 deletions common-theme/hugo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ defaultContentLanguageInSubdir = false
[params]
googleFonts="https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300;500;700&family=Inter:wght@400;600&display=swap"
description = "A free and open source software development programme."
startTime="10:00"
# main_website = ""
# main_org_name = "eg Code Your Future"
# our_name = "alias for in text replacement"
Expand Down
5 changes: 2 additions & 3 deletions common-theme/layouts/_default/day-plan.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@
{{ if not .Params.blocks }}
{{ errorf "There are no blocks on the %s page. Make sure this day plan has blocks." $.Page.RelPermalink }}
{{ end }}


<time-stamper>
{{ $startTime := .Params.startTime | default "10:00" }}
<time-stamper start-time="{{$startTime}}">
<div class="c-block__series c-block__series--timeline">
{{ if ne .Params.noRegister true }}
{{ partial "register-attendance.html" (dict "course" site.Title "module" $.Page.CurrentSection.Parent.Title "day" $.Page.CurrentSection.Title) }}
Expand Down
Loading