Skip to content
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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ npm start
| arrowColor | string | Specifies the relationship arrow fill color. |
| arrowIndent | number | Specifies the relationship arrow right indent. Sets in px |
| todayColor | string | Specifies the current period column fill color. |
| weekendColor | string | Specifies the weekend columns fill color. |
| TooltipContent | | Specifies the Tooltip view for selected taskbar. |
| TaskListHeader | | Specifies the task list Header view |
| TaskListTable | | Specifies the task list Table view |
Expand Down
2 changes: 2 additions & 0 deletions example/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ const App = () => {
onExpanderClick={handleExpanderClick}
listCellWidth={isChecked ? "155px" : ""}
columnWidth={columnWidth}
weekendColor={"#97979714"}
/>
<h3>Gantt With Limited Height</h3>
<Gantt
Expand All @@ -102,6 +103,7 @@ const App = () => {
listCellWidth={isChecked ? "155px" : ""}
ganttHeight={300}
columnWidth={columnWidth}
weekendColor={"#97979714"}
/>
</div>
);
Expand Down
4 changes: 3 additions & 1 deletion src/components/gantt/gantt.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ export const Gantt: React.FunctionComponent<GanttProps> = ({
fontFamily = "Arial, Roboto, Oxygen, Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue",
fontSize = "14px",
arrowIndent = 20,
todayColor = "rgba(252, 248, 227, 0.5)",
todayColor = "rgba(252, 248, 227, 1)",
weekendColor = "transparent",
viewDate,
TooltipContent = StandardTooltipContent,
TaskListHeader = TaskListHeaderDefault,
Expand Down Expand Up @@ -394,6 +395,7 @@ export const Gantt: React.FunctionComponent<GanttProps> = ({
rowHeight,
dates: dateSetup.dates,
todayColor,
weekendColor,
rtl,
};
const calendarProps: CalendarProps = {
Expand Down
17 changes: 17 additions & 0 deletions src/components/grid/grid-body.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export type GridBodyProps = {
rowHeight: number;
columnWidth: number;
todayColor: string;
weekendColor: string;
rtl: boolean;
};
export const GridBody: React.FC<GridBodyProps> = ({
Expand All @@ -19,6 +20,7 @@ export const GridBody: React.FC<GridBodyProps> = ({
svgWidth,
columnWidth,
todayColor,
weekendColor,
rtl,
}) => {
let y = 0;
Expand Down Expand Up @@ -60,6 +62,7 @@ export const GridBody: React.FC<GridBodyProps> = ({
const now = new Date();
let tickX = 0;
const ticks: ReactElement[] = [];
const weekends: ReactElement[] = [];
let today: ReactElement = <rect />;
for (let i = 0; i < dates.length; i++) {
const date = dates[i];
Expand All @@ -73,6 +76,19 @@ export const GridBody: React.FC<GridBodyProps> = ({
className={styles.gridTick}
/>
);

if (weekendColor !== "transparent" && [0, 6].includes(date.getDay())) {
weekends.push(
<rect
key={"WeekendColumn" + date.getTime()}
x={tickX}
y={0}
width={columnWidth}
height={y}
fill={weekendColor}
/>
);
}
if (
(i + 1 !== dates.length &&
date.getTime() < now.getTime() &&
Expand Down Expand Up @@ -121,6 +137,7 @@ export const GridBody: React.FC<GridBodyProps> = ({
<g className="rows">{gridRows}</g>
<g className="rowLines">{rowLines}</g>
<g className="ticks">{ticks}</g>
<g className="weekends">{weekends}</g>
<g className="today">{today}</g>
</g>
);
Expand Down
1 change: 1 addition & 0 deletions src/types/public-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ export interface StylingOption {
arrowColor?: string;
arrowIndent?: number;
todayColor?: string;
weekendColor?: string;
TooltipContent?: React.FC<{
task: Task;
fontSize: string;
Expand Down