add component DateGate conditionally render content based on build-time date - #1845
add component DateGate conditionally render content based on build-time date#1845nikoshell wants to merge 1 commit into
Conversation
Preview available
|
hypha
left a comment
There was a problem hiding this comment.
Some minor non-blocking comments and sorry for the delay.
| <a class="nav-link-btn" href="/tickets">Register Now</a> | ||
| </li> | ||
| <DateGate before="2026-07-20"> | ||
| <Fragment slot="before"> |
There was a problem hiding this comment.
I’m confused here. so when only before="2026-07-20" is provided, the beforeDate selects during up to 20 Jul and after afterward, right? If so, it never selects before, so this slot="before" fragment doesn't reach / render? Then isn't it just a dup of during fragment?
Also, could we give an example to the the before-only case in DateGate to help with the confusedpoke?
| <a href="/tickets" class="nav-cta">Register Now</a> | ||
| </Fragment> | ||
| <Fragment slot="after"> | ||
| <span class="nav-cta" style="opacity:0.5;cursor:default" |
There was a problem hiding this comment.
opacity: 0.5 here fades both the txt and bg into the navbar, so in lightmode, the "see you next year" is so faint that I barely think you mean it. 😢 Maybe remove the opacity and give this post-event label its own txt and bg colour, or something else cleverer, to increase the contrast and sincerity of wanting to see us next year?
| // DateTime strings with offset (e.g. "...T00:00:00+02:00") parse correctly. | ||
| const parseDate = (s: string): Date => { | ||
| const iso = s.includes("T") ? s : `${s}T00:00:00.000Z`; | ||
| return new Date(iso); |
There was a problem hiding this comment.
nit: is it a good idea for parseDate to check if it produced a valid date and throw a build error if not? Like if i have a typo, e.g. before="2026-13-20", that's an invalid date, I think in the before-only case, comparing now with that invalid date returns false, so we select during and will continue to show the gated content instead of reporting the typo?
No description provided.