Skip to content

Commit 555e1b8

Browse files
Merge pull request #43 from vinzdeveloper/custom-style
Adding dark themes to json rule editor
2 parents 5277482 + c9f1289 commit 555e1b8

39 files changed

+561
-90
lines changed

.DS_Store

6 KB
Binary file not shown.

assets/.DS_Store

6 KB
Binary file not shown.

assets/icons/.DS_Store

6 KB
Binary file not shown.

assets/icons/dark-mode.png

20.1 KB
Loading

assets/icons/light-mode.png

19.7 KB
Loading

assets/icons/mdblue-mode.png

22.1 KB
Loading

assets/icons/plus-rounded-dark.svg

Lines changed: 13 additions & 0 deletions
Loading

src/components/button/button-groups.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1-
import React from 'react';
1+
import React, { useContext } from 'react';
22
import PropTypes from 'prop-types';
3+
import ApperanceContext from '../../context/apperance-context';
34

45
const ButtonGroup = ({ buttons, onConfirm }) => {
6+
const { background } = useContext(ApperanceContext);
57

6-
return (<div className="btn-group-container">
8+
return (<div className={`btn-group-container ${background}`}>
79
{buttons.length > 0 && buttons.map(button =>
810
<div key={button.label} className={`btn-grp`}>
911
<button onClick={() => onConfirm(button.label)} type="button" className={button.active ? 'active': undefined}

src/components/decisions/add-decision.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import { transformTreeToRule } from '../../utils/transform';
1414
import { sortBy } from 'lodash/collection';
1515
import { validateAttribute } from '../../validations/decision-validation';
1616
import { PLACEHOLDER } from '../../constants/data-types';
17-
17+
import ApperanceContext from '../../context/apperance-context';
1818

1919

2020
const nodeStyle ={
@@ -285,13 +285,14 @@ class AddDecision extends Component {
285285
const attributeOptions = attributes.map(attr => attr.name);
286286
const attribute = addAttribute.name && attributes.find(attr => attr.name === addAttribute.name);
287287
const operatorOptions = attribute && operator[attribute.type];
288+
const { background } = this.context;
288289

289290
const placeholder = addAttribute.operator === 'contains' || addAttribute.operator === 'doesNotContain' ?
290291
PLACEHOLDER['string'] : PLACEHOLDER[attribute.type]
291292

292293
return (<Panel>
293294

294-
<div className="attributes-header">
295+
<div className={`attributes-header ${background}`}>
295296
<div className="attr-link" onClick={this.addPath}>
296297
<span className="plus-icon" /><span className="text">Add Path</span>
297298
</div>
@@ -325,9 +326,10 @@ class AddDecision extends Component {
325326
outputPanel() {
326327
const { outcome } = this.state;
327328
const { editDecision } = this.props;
329+
const { background } = this.context;
328330

329331
return (<Panel>
330-
<div className="attributes-header">
332+
<div className={`attributes-header ${background}`}>
331333
<div className="attr-link" onClick={this.addParams}>
332334
<span className="plus-icon" /><span className="text">Add Params</span>
333335
</div>
@@ -388,6 +390,8 @@ class AddDecision extends Component {
388390
}
389391
}
390392

393+
AddDecision.contextType = ApperanceContext;
394+
391395
AddDecision.defaultProps = ({
392396
addCondition: () => false,
393397
cancel: () => false,

src/components/navigation/navigation-panel.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@ import PropTypes from 'prop-types';
44
import { createHashHistory } from 'history';
55
import FooterLinks from '../footer/footer';
66
import footerLinks from '../../data-objects/footer-links.json';
7+
import AppearanceContext from '../../context/apperance-context';
78

89
const navmenu = [{ name: 'Create Rules', navigate: './create-ruleset', iconClass: "icon fa fa-plus-square-o", linkClass: 'navmenu'},
9-
{ name: 'Upload Rules', navigate: './home', iconClass: "icon fa fa-cloud-upload", linkClass: 'navmenu' } ];
10+
{ name: 'Upload Rules', navigate: './home', iconClass: "icon fa fa-cloud-upload", linkClass: 'navmenu' },
11+
{ name: 'Appearance', navigate: './appearance', iconClass: "icon fa fa-sliders", linkClass: 'navmenu'} ];
1012
class NavigationPanel extends Component {
1113

1214
constructor(props) {
@@ -37,8 +39,10 @@ class NavigationPanel extends Component {
3739

3840
let sideNav = loggedIn && closedState ? 'open' : 'closed';
3941

42+
let appctx = this.context;
43+
4044
return (
41-
<div className={`nav-container ${closedState ? 'closed': 'open'}`}>
45+
<div className={`nav-container ${closedState ? 'closed': 'open'} ${appctx.background}`}>
4246
<div className="menu-bar">
4347
<a href="" onClick={(e) => { e.preventDefault(); this.props.updateState(sideNav)}}> <span className="close-icon fa fa-reorder" ></span></a>
4448
</div>
@@ -56,6 +60,8 @@ class NavigationPanel extends Component {
5660
}
5761
}
5862

63+
NavigationPanel.contextType = AppearanceContext;
64+
5965
NavigationPanel.defaultProps = {
6066
closedState: false,
6167
rulenames: [],

0 commit comments

Comments
 (0)