update from RIFT as of 696b75d2fe9fb046261b08c616f1bcf6c0b54a9b third try
[osm/UI.git] / skyquake / plugins / admin / src / components / ActionBar.jsx
diff --git a/skyquake/plugins/admin/src/components/ActionBar.jsx b/skyquake/plugins/admin/src/components/ActionBar.jsx
new file mode 100644 (file)
index 0000000..87e62d1
--- /dev/null
@@ -0,0 +1,30 @@
+import React from 'react'
+import { TrashIcon } from 'react-open-iconic-svg';
+import { PencilIcon } from 'react-open-iconic-svg';
+import { PlusIcon } from 'react-open-iconic-svg';
+import { CircleXIcon } from 'react-open-iconic-svg';
+
+const actionIcon = {
+    'create': {icon: PlusIcon, title: "Add"},
+    'update': {icon: PencilIcon, title: "Edit"},
+    'delete': {icon: TrashIcon, title: "Delete"},
+    'close': {icon: CircleXIcon, title: "Close Panel"}
+}
+
+export default (props) => {
+    const { isHidden, actions, handler } = props;
+    const buttons = [];
+    actions && actions.forEach((action => buttons.push(
+        <div key={action} style={{ visibility: isHidden ? 'hidden' : 'visible', display: 'inline-block', padding: '.15rem .5rem' }}>
+            <div title={actionIcon[action].title} style={{ display: 'inline-block', cursor: 'pointer' }}>
+                {React.createElement(actionIcon[action].icon, {width: '12', height: '12', onClick: () => handler(action)})}
+            </div>
+        </div>
+    )));
+    return (
+        <div className='button-bar' style={{ height: '17px', width: '100%', textAlign: 'right' }} >
+            {buttons}
+        </div>
+    )
+}
+