Creating header package and dropdown component
This commit is contained in:
1 parent
04e9a85def
commit
2d52c9ef0a
17 files changed
+243
-49
No files matched your search
@@ -0,0 +1,29 @@
|
||||
import { Template } from 'meteor/templating';
|
||||
import { Blaze } from 'meteor/blaze';
|
||||
import { OHIF } from 'meteor/ohif:core';
|
||||
|
||||
OHIF.ui.showDropdown = (items=[], options={}) => {
|
||||
// Prepare the method to destroy the view
|
||||
let view;
|
||||
const destroyView = () => Blaze.remove(view);
|
||||
const templateData = {
|
||||
items,
|
||||
options,
|
||||
destroyView
|
||||
};
|
||||
|
||||
// Render the dialog with the given template and data
|
||||
const parentElement = options.parentElement || document.body;
|
||||
view = Blaze.renderWithData(Template.dropdownForm, templateData, parentElement);
|
||||
};
|
||||
|
||||
Meteor.startup(() => {
|
||||
OHIF.ui.showDropdown([{
|
||||
text: 'test 1',
|
||||
action: () => console.warn('test1Clicked'),
|
||||
separatorAfter: true
|
||||
}, {
|
||||
text: 'test 2',
|
||||
action: () => console.warn('test2Clicked')
|
||||
}]);
|
||||
});
|
||||
Reference in new issue
Block a user