render reactions in div instead of ul
This commit is contained in:
parent
3e2b7ba5fa
commit
d91282a767
2 changed files with 5 additions and 3 deletions
|
@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {tag} from "./html.js";
|
import {el} from "./html.js";
|
||||||
import {errorToDOM} from "./error.js";
|
import {errorToDOM} from "./error.js";
|
||||||
|
|
||||||
function insertAt(parentNode, idx, childNode) {
|
function insertAt(parentNode, idx, childNode) {
|
||||||
|
@ -28,10 +28,11 @@ function insertAt(parentNode, idx, childNode) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export class ListView {
|
export class ListView {
|
||||||
constructor({list, onItemClick, className, parentProvidesUpdates = true}, childCreator) {
|
constructor({list, onItemClick, className, tagName = "ul", parentProvidesUpdates = true}, childCreator) {
|
||||||
this._onItemClick = onItemClick;
|
this._onItemClick = onItemClick;
|
||||||
this._list = list;
|
this._list = list;
|
||||||
this._className = className;
|
this._className = className;
|
||||||
|
this._tagName = tagName;
|
||||||
this._root = null;
|
this._root = null;
|
||||||
this._subscription = null;
|
this._subscription = null;
|
||||||
this._childCreator = childCreator;
|
this._childCreator = childCreator;
|
||||||
|
@ -62,7 +63,7 @@ export class ListView {
|
||||||
if (this._className) {
|
if (this._className) {
|
||||||
attr.className = this._className;
|
attr.className = this._className;
|
||||||
}
|
}
|
||||||
this._root = tag.ul(attr);
|
this._root = el(this._tagName, attr);
|
||||||
this.loadList();
|
this.loadList();
|
||||||
if (this._onItemClick) {
|
if (this._onItemClick) {
|
||||||
this._root.addEventListener("click", this._onClick);
|
this._root.addEventListener("click", this._onClick);
|
||||||
|
|
|
@ -21,6 +21,7 @@ export class ReactionsView extends ListView {
|
||||||
constructor(reactionsViewModel) {
|
constructor(reactionsViewModel) {
|
||||||
const options = {
|
const options = {
|
||||||
className: "Timeline_messageReactions",
|
className: "Timeline_messageReactions",
|
||||||
|
tagName: "div",
|
||||||
list: reactionsViewModel.reactions,
|
list: reactionsViewModel.reactions,
|
||||||
onItemClick: (reactionView, evt) => reactionView.onClick(),
|
onItemClick: (reactionView, evt) => reactionView.onClick(),
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue