diff --git a/src/js/components/VariableEditor.js b/src/js/components/VariableEditor.js index 834ae55f..b7388edc 100644 --- a/src/js/components/VariableEditor.js +++ b/src/js/components/VariableEditor.js @@ -22,7 +22,12 @@ import { } from './DataTypes/DataTypes'; //clibboard icon -import { Edit, CheckCircle, RemoveCircle as Remove } from './icons'; +import { + Edit, + CheckCircle, + RemoveCircle as Remove, + SelectCircle as Select +} from './icons'; //theme import Theme from './../themes/getStyle'; @@ -144,10 +149,32 @@ class VariableEditor extends React.PureComponent { {onDelete !== false && editMode == false ? this.getRemoveIcon() : null} + {onSelect !== false ? this.getSelectObject() : null} ); } + getSelectObject = () => { + const { variable, namespace, theme, onSelect } = this.props; + + return ( + + { + onSelect({ + name, + type: typeof src, + namespace, + value: src + }); + }} + /> + + ); + }; + render = () => { const { theme, onDelete, onAdd, + onSelect, enableClipboard, src, namespace, @@ -135,8 +161,9 @@ export default class extends React.PureComponent { /> ) : null} {/* copy add/remove icons */} - {onAdd !== false ? this.getAddAttribute(rowHovered) : null} - {onDelete !== false ? this.getRemoveObject(rowHovered) : null} + {onAdd !== false ? this.getAddAttribute() : null} + {onDelete !== false ? this.getRemoveObject() : null} + {onSelect !== false ? this.getSelectObject() : null} ); }; diff --git a/src/js/components/icons.js b/src/js/components/icons.js index 863eb9ea..5f21391b 100644 --- a/src/js/components/icons.js +++ b/src/js/components/icons.js @@ -200,6 +200,28 @@ export class AddCircle extends React.PureComponent { } } +export class SelectCircle extends React.PureComponent { + render() { + const { props } = this; + const { style, ...rest } = props; + + return ( + + + + + + + + ); + } +} + export class Add extends React.PureComponent { render() { const { props } = this; diff --git a/src/js/themes/getStyle.js b/src/js/themes/getStyle.js index b00afed3..073a75b8 100644 --- a/src/js/themes/getStyle.js +++ b/src/js/themes/getStyle.js @@ -256,6 +256,14 @@ const getDefaultThemeStyling = theme => { fontSize: constants.iconFontSize, marginRight: constants.iconMarginRight }, + selectVarIcon: { + verticalAlign: 'top', + display: 'inline-block', + color: colors.editVariable.addIcon, + cursor: constants.iconCursor, + fontSize: constants.iconFontSize, + marginRight: constants.iconMarginRight + }, addVarIcon: { verticalAlign: 'top', display: 'inline-block', diff --git a/src/js/themes/styleConstants.js b/src/js/themes/styleConstants.js index 0754d3ac..ca82d905 100644 --- a/src/js/themes/styleConstants.js +++ b/src/js/themes/styleConstants.js @@ -77,7 +77,7 @@ export default { editInputFontFamily: 'monospace', iconCursor: 'pointer', - iconFontSize: '15px', + iconFontSize: '17px', iconPaddingRight: '1px', dateValueMarginLeft: '2px', diff --git a/src/style/scss/global.scss b/src/style/scss/global.scss index a7a2d2d5..e8f141c7 100644 --- a/src/style/scss/global.scss +++ b/src/style/scss/global.scss @@ -13,6 +13,9 @@ .click-to-remove { display: none; } + .click-to-select { + display: none; + } .click-to-edit { display: none; } @@ -28,6 +31,9 @@ & > .click-to-remove { display: inline-block; } + & > .click-to-select { + display: inline-block; + } } } @@ -43,6 +49,9 @@ &:hover .click-to-remove { display: inline-block; } + &:hover .click-to-select { + display: inline-block; + } &:hover .click-to-edit { display: inline-block; }