ProSchedulerSign in

Timeline · Look & feel

Time range backgrounds

Weekends, two sprints and a release day as labelled colour ranges behind the work.

Live demo

Find the release day

Fullscreen
import { useMemo } from "react"
import { ProScheduler, type PschColor } from "@andreisaac/pro-scheduler"
import { monthStart, studioAssignments, studioResources } from "./data/studio"
import { useEvents } from "./kit"

const day = (base: Date, n: number) => new Date(base.getFullYear(), base.getMonth(), base.getDate() + n)

export function TimeBackgroundsDemo() {
  const { events, handlers } = useEvents(studioAssignments)

  const backgrounds = useMemo<PschColor[]>(() => {
    const month = monthStart()
    return [
      { recurring: { repeat: "weekly", weekDays: [0, 6] }, background: "color-mix(in oklab, currentColor 7%, transparent)" },
      { start: day(month, 0), end: day(month, 14), title: "Sprint 1", background: "color-mix(in oklab, #6366f1 10%, transparent)", textColor: "#4f46e5" },
      { start: day(month, 14), end: day(month, 28), title: "Sprint 2", background: "color-mix(in oklab, #14b8a6 10%, transparent)", textColor: "#0d9488" },
      { start: day(month, 20), allDay: true, title: "Release", background: "color-mix(in oklab, #f43f5e 22%, transparent)", textColor: "#e11d48" },
    ]
  }, [])

  return (
    <ProScheduler
      data={events}
      resources={studioResources}
      view={{ timeline: { type: "month" } }}
      colors={backgrounds}
      height={520}
      {...handlers}
    />
  )
}

About this demo

Weekends, two sprints and a release day as labelled colour ranges behind the work.

Things to try

  • Find the release day

The props behind it are explained in Sizing & theming.

Use ProScheduler in your project