This website collects cookies to deliver better user experience
function topBar (appName) { let _styleTopBar = {style :` background:orange; line-height:50px; display: flex; justify-content: space-between; margin-bottom: 50px; padding-left:10px; padding-right:10px; box-shadow: 0 5px 5px rgba(0,0,0,0.13); `} let topBar = selectBase(div("", _styleTopBar )); let _styleItems = {style:"cursor:pointer"} let brand = div("brand", _styleItems); let title = div(appName, _styleItems); let help = div("Help", _styleItems); unselectBase(); // topBar for (let item of [brand, title, help]) { item.onclick = () => alert(item.innerText); } return topBar; } let topbar = topBar("DML Demo"); console.log(topbar);
<div style="background: orange none repeat scroll 0% 0%; line-height: 50px; display: flex; justify-content: space-between; margin-bottom: 50px; padding-left: 10px; padding-right: 10px; box-shadow: rgba(0, 0, 0, 0.13) 0px 5px 5px;">...</div>
const { render } = preact; function topBar (appName) { let _styleTopBar = {style :` background:orange; line-height:50px; display: flex; justify-content: space-between; margin-bottom: 50px; padding-left:10px; padding-right:10px; box-shadow: 0 5px 5px rgba(0,0,0,0.13); `} let topBar = selectBase(div("", _styleTopBar )); let _styleItems = {style:"cursor:pointer"} let brand = div("brand", _styleItems); let title = div(appName, _styleItems); let help = div("Help", _styleItems); unselectBase(); // topBar for (let item of [brand, title, help]) { item.onclick = () => alert(item.innerText); } return topBar; } render(topBar("Demo DML"), document.body);
topBar("Demo DML") topBar("Demo DML-2")
43
0