From e52a4a77f5e9f488f7ed01a2c4483f820c1a763c Mon Sep 17 00:00:00 2001 From: manishbisht Date: Sat, 7 Apr 2018 23:14:08 +0530 Subject: [PATCH] RuleLabel component added Signed-off-by: manishbisht --- src/css/style.css | 34 ++++++---- src/js/components/PropertyPicker.react.js | 16 ++--- src/js/components/RuleLabel.react.js | 35 ++++++++++ src/js/components/RulePicker.react.js | 12 ++-- .../TransformationSettings.react.js | 67 +++++++++++-------- 5 files changed, 106 insertions(+), 58 deletions(-) create mode 100644 src/js/components/RuleLabel.react.js diff --git a/src/css/style.css b/src/css/style.css index 6a14952..0cd72a1 100644 --- a/src/css/style.css +++ b/src/css/style.css @@ -77,7 +77,7 @@ h1 { display: flex; } -.field-line label, +.field-line div label, .field-line input, .field-line select { display: block; @@ -134,7 +134,7 @@ h1 { border-bottom-left-radius: 5px; } -.field-line > label:first-of-type { +.field-line > div label:first-of-type { background: #f6f7f9; color: #777; padding: 5px; @@ -142,7 +142,7 @@ h1 { border-bottom: 1px solid #e8e8e8; } -.field-line.valid > label:first-of-type { +.field-line.valid > div label:first-of-type { color: #3b5998; } @@ -293,7 +293,7 @@ h1 { color: #9aaf28 !important; } -.field-line.active .match label.sub-label { +.field-line.active .match div label.sub-label { color: #9aaf28 !important; } @@ -302,7 +302,7 @@ h1 { color: #e76e63 !important; } -.field-line.active .mismatch label.sub-label { +.field-line.active .mismatch div label.sub-label { color: #e76e63 !important; } .field-line .attributes { @@ -336,7 +336,7 @@ h1 { background: #9aaf28; } -.field-line label.sub-label { +.field-line div label.sub-label { font-size: 0.8em; margin: 0px 0px; margin-bottom: -8px; @@ -349,40 +349,46 @@ h1 { color: #777; } -.field-line.active:not(.finding).single-element-found label.sub-label { +.field-line.active:not(.finding).single-element-found div label.sub-label { color: #9aaf28; } -.field-line.active:not(.finding).multiple-elements-found label.sub-label { +.field-line.active:not(.finding).multiple-elements-found div label.sub-label { color: #e76e63; } .field-line.active:not(.finding).multiple.multiple-elements-found + div label.sub-label { color: #9aaf28; } -.field-line.active label.sub-label { +.field-line.active div label.sub-label { color: #4a90e2; } -.field-line.active:not(.finding).single-element-found > label:first-of-type { +.field-line.active:not(.finding).single-element-found + > div + label:first-of-type { background: #9aaf28; color: #fff; } -.field-line.active:not(.finding).multiple-elements-found > label:first-of-type { +.field-line.active:not(.finding).multiple-elements-found + > div + label:first-of-type { background: #e76e63; color: #fff; } .field-line.active:not(.finding).multiple.multiple-elements-found - > label:first-of-type { + > div + label:first-of-type { background: #9aaf28; color: #fff; } -.field-line.active > label:first-of-type { +.field-line.active > div label:first-of-type { background: #4a90e2; color: #fff; } @@ -608,7 +614,7 @@ button { width: 325px; } -.rule-list label { +.rule-list div label { display: block; } diff --git a/src/js/components/PropertyPicker.react.js b/src/js/components/PropertyPicker.react.js index e7a20ea..2da1289 100644 --- a/src/js/components/PropertyPicker.react.js +++ b/src/js/components/PropertyPicker.react.js @@ -12,6 +12,7 @@ const React = require('react'); const classNames = require('classnames'); const DateTimeFormatPicker = require('./DateTimeFormatPicker.react.js'); const SelectorPicker = require('./SelectorPicker.react.js'); +const RuleLabel = require('./RuleLabel.react.js'); import type { RuleProperty } from '../models/RuleProperty'; import RulePropertyTypes from '../models/RulePropertyTypes'; import RuleActions from '../data/RuleActions'; @@ -122,16 +123,11 @@ class PropertyPicker extends React.Component { [propertyClass]: true, })} > - + {attributePicker} diff --git a/src/js/components/RuleLabel.react.js b/src/js/components/RuleLabel.react.js new file mode 100644 index 0000000..717b226 --- /dev/null +++ b/src/js/components/RuleLabel.react.js @@ -0,0 +1,35 @@ +/** + * Copyright 2017-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the license found in the + * LICENSE file in the root directory of this source tree. + * + * @flow + */ + +const React = require('react'); + +import type { Props as BaseProps } from '../containers/AppContainer.react'; + +type Props = BaseProps & { className: string, htmlFor: string }; + +class RuleLabel extends React.Component { + render() { + return ( +
+ +
+ ); + } +} + +module.exports = RuleLabel; diff --git a/src/js/components/RulePicker.react.js b/src/js/components/RulePicker.react.js index 290a45d..95b307e 100644 --- a/src/js/components/RulePicker.react.js +++ b/src/js/components/RulePicker.react.js @@ -11,6 +11,7 @@ const React = require('react'); const PropertyPicker = require('./PropertyPicker.react.js'); const SelectorPicker = require('./SelectorPicker.react'); +const RuleLabel = require('./RuleLabel.react.js'); const classNames = require('classnames'); const RuleActions = require('../data/RuleActions'); @@ -21,7 +22,7 @@ import { RuleUtils } from '../utils/RuleUtils'; type Props = BaseProps & { rule: Rule }; type State = { - collapsed: boolean + collapsed: boolean, }; class RulePicker extends React.Component { @@ -87,10 +88,11 @@ class RulePicker extends React.Component { valid: this.props.rule.selector != '', })} > - + {this.props.rule.properties diff --git a/src/js/components/TransformationSettings.react.js b/src/js/components/TransformationSettings.react.js index dd3d78b..eb8e340 100644 --- a/src/js/components/TransformationSettings.react.js +++ b/src/js/components/TransformationSettings.react.js @@ -9,6 +9,7 @@ */ const React = require('react'); +const RuleLabel = require('./RuleLabel.react.js'); import { Accordion, Icon } from 'semantic-ui-react'; import AdsTypes from '../data/AdsTypes'; @@ -19,11 +20,11 @@ import type { Props as BaseProps } from '../containers/AppContainer.react'; type Props = BaseProps & { accordionActive: boolean, accordionIndex: number, - onAccordionTitleClick: (e: Event, itemProps: AccordionItemProps) => void + onAccordionTitleClick: (e: Event, itemProps: AccordionItemProps) => void, }; type AccordionItemProps = { - index: number + index: number, }; class TransformationSettings extends React.Component { @@ -57,13 +58,13 @@ class TransformationSettings extends React.Component { return this.props.settings.adsSettings.type === AdsTypes.AUDIENCE_NETWORK ? (
- +
{ renderAdsRawHtmlDiv() { return this.props.settings.adsSettings.type === AdsTypes.RAW_HTML ? (
- +