mirror of
https://github.com/discourse/discourse.git
synced 2025-02-05 06:54:18 +08:00
37 lines
793 B
JavaScript
37 lines
793 B
JavaScript
import { createWidget } from 'discourse/widgets/widget';
|
|
import { h } from 'virtual-dom';
|
|
|
|
createWidget('menu-links', {
|
|
html(attrs) {
|
|
const links = [].concat(attrs.contents());
|
|
const liOpts = {};
|
|
|
|
if (attrs.heading) {
|
|
liOpts.className = 'header';
|
|
}
|
|
|
|
const result = [];
|
|
result.push(h('ul.menu-links.columned', links.map(l => h('li', liOpts, l))));
|
|
|
|
result.push(h('div.clearfix'));
|
|
if (!attrs.omitRule) {
|
|
result.push(h('hr'));
|
|
}
|
|
return result;
|
|
}
|
|
});
|
|
|
|
createWidget('menu-panel', {
|
|
tagName: 'div.menu-panel',
|
|
|
|
buildAttributes(attrs) {
|
|
if (attrs.maxWidth) {
|
|
return { 'data-max-width': attrs.maxWidth };
|
|
}
|
|
},
|
|
|
|
html(attrs) {
|
|
return h('div.panel-body', h('div.panel-body-contents.clearfix', attrs.contents()));
|
|
}
|
|
});
|