Skip to content

Commit

Permalink
[Upd #71] Added default legend items
Browse files Browse the repository at this point in the history
  • Loading branch information
LaChope committed Oct 5, 2022
1 parent 0259c5e commit ad0c2d9
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 19 deletions.
21 changes: 7 additions & 14 deletions src/assets/PlanningTool.css
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,6 @@
width: calc(100% - 30rem);
}

.task_card {
background: #0000aa;
}

.scheduled_wo {
background: #00aa00;
}

.maintenance_wo {
background: #aa0000;
}

.rct-sidebar {
position: relative;
padding-right: 0.25rem;
Expand Down Expand Up @@ -58,8 +46,13 @@
margin-bottom: 1.25rem;
}

.explanatory-notes .note .color {
display: inline-block;
.explanatory-notes .note {
display: flex;
align-items: center;
padding: .2rem;
}

.explanatory-notes .note .legend-color {
background-color: #000;
width: 1.5rem;
height: 0.8rem;
Expand Down
24 changes: 19 additions & 5 deletions src/components/Legend.jsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,32 @@
import React from "react";
import Constants from "../constants/Constants";

const Legend = ({ title, legendItems }) => {
let defaultItems = Constants.DEFAULT_LEGEND_ITEMS;

return (
<div className="explanatory-notes">
<h3>{title}</h3>
<React.Fragment>
{legendItems.map((item, index) => {
return (
<div key={index} className="note">
<span
className="color"
style={{ backgroundColor: `${item.color}` }}
></span>
{item.name}
<div
className="legend-color"
style={{ background: `${item.color}` }}
/>
<div className="legend-item">{item.name}</div>
</div>
);
})}
{defaultItems.map((item, index) => {
return (
<div key={index} className="note">
<div
className="legend-color"
style={{ background: `${item.color}` }}
/>
<div className="legend-item">{item.name}</div>
</div>
);
})}
Expand Down
11 changes: 11 additions & 0 deletions src/constants/Constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,15 @@ export default class Constants{
static RESOURCE_REORDER = 'resource-reorder'
static MILESTONE_ADD = 'milestone-add'
static MILESTONE_EDIT = 'milestone-edit'
static DEFAULT_LEGEND_ITEMS = [
{
name: "current selection & parents/children",
color: "#FFC107",
},
{
name: "non movable item",
color:
"repeating-linear-gradient( -45deg, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0) 2px, #465298 2px, #465298 4px )",
},
];
}

0 comments on commit ad0c2d9

Please sign in to comment.