I am using wx-react-gantt in a React environment. I have seen this example for adding taskTypes, but it does not work for me. When I use the WIllowDark theme everything looks fine, but when I try this example all I get is white text on a black background. I put the .demo portion in the EventTimeline.css file.
I imagine I'll feel silly when I learn the solution but I'm just not seeing the issue. Thanks
import React, { useState } from 'react';
import { Gantt } from "wx-react-gantt";
import { Willow, WillowDark } from "wx-react-gantt";
import "wx-react-gantt/dist/gantt.css";
import "./EventTimeline.css"
function EventTimeline(props) {
console.log(props)
const tasks = [
{
id: 1,
text: "Type23_F233",
start: new Date(2040, 0, 16, 8, 30, 0),
end: new Date(2040, 0, 16, 20, 30, 0),
progress: 50,
type: "task",
lazy: false,
},
{
id: 2,
text: "LPD-4",
start: new Date(2040, 0, 16, 8, 30, 0),
end: new Date(2040, 0, 16, 18, 0, 0),
duration: 9.5,
progress: 0,
parent: 0,
type: "task",
},
{
id: 3,
text: "LPD-4",
start: new Date(2040, 0, 16, 18, 0, 0),
end: new Date(2040, 0, 16, 20, 30, 0),
duration: 2.5,
progress: 0,
parent: 0,
type: "summary",
},
{
id: 4,
text: "Type23_F237",
start: new Date(2040, 0, 16, 10, 0, 0),
end: new Date(2040, 0, 17, 8, 30, 0),
duration: 22.5,
progress: 0,
type: "task",
lazy: false,
},
{
id: 4,
text: "LPD-1",
start: new Date(2040, 0, 16, 9, 0, 0),
end: new Date(2040, 0, 16, 11, 30, 0),
duration: 15.5,
progress: 0,
type: "project",
lazy: false,
},
];
const taskTypes = [
{ id: "task", label: "Task" },
{ id: "summary", label: "Summary task" },
{ id: "milestone", label: "Milestone" },
{ id: "urgent", label: "Urgent" },
{ id: "narrow", label: "Narrow" },
{ id: "progress", label: "Progress" },
];
const links = [{ id: "L1", source: 2, target: 3, type: "e2s" }];
const scales = [
{ unit: "day", step: 1, format: "d" },
{ unit: "hour", step: 2, format: "HH" },
];
const dayStyle = (a) => {
const day = a.getDay() === 5 || a.getDay() === 6;
return day ? "sday" : "";
};
const markers = [
{
start: new Date(2040, 0, 16, 20, 30, 0),
text: "Round 2",
},
];
const complexScales = [
{ unit: "year", step: 1, format: "yyyy" },
{ unit: "month", step: 2, format: "MMMM yyy" },
{ unit: "week", step: 1, format: "w" },
{ unit: "day", step: 1, format: "d", css: dayStyle },
];
// return(
// <WillowDark>
// <Gantt
// tasks={tasks}
// links={links}
// scales={scales}
// taskTypes={taskTypes}
// start={new Date(2040, 0, 16, 8, 30, 0)}
// end ={new Date(2040, 0, 18, 8, 30, 0)}
// cellWidth={20}
// />
// </WillowDark>
// );
// }
return(
<div className="demo" style={{ padding: "20px" }}>
<Gantt
tasks={tasks}
links={links}
scales={scales}
taskTypes={taskTypes}
start={new Date(2040, 0, 16, 8, 30, 0)}
end ={new Date(2040, 0, 18, 8, 30, 0)}
cellWidth={20}
/>
</div>
);
}
export default EventTimeline;