This repository has been archived on 2023-03-18. You can view files and clone it, but cannot push or open issues or pull requests.
osr-discourse-src/app/assets/javascripts/discourse/widgets/footer-nav.js.es6
Penar Musaraj de10bd7fb4 UI: Footer nav fixes
- moves footer nav to the header on iPads
- disables scrolling events for iPads
- removes footer nav entirely on Chrome PWAs
- toggles DiscourseHub iOS app status bar styling (dark/light) when opening/closing lightboxes and modals
2019-04-15 15:25:40 -04:00

57 lines
1.1 KiB
JavaScript

import { createWidget } from "discourse/widgets/widget";
import { isAppWebview, postRNWebviewMessage } from "discourse/lib/utilities";
createWidget("footer-nav", {
tagName: "div.footer-nav-widget",
html(attrs) {
const buttons = [];
buttons.push(
this.attach("flat-button", {
action: "goBack",
icon: "chevron-left",
className: "btn-large",
disabled: !attrs.canGoBack
})
);
buttons.push(
this.attach("flat-button", {
action: "goForward",
icon: "chevron-right",
className: "btn-large",
disabled: !attrs.canGoForward
})
);
if (isAppWebview()) {
buttons.push(
this.attach("flat-button", {
action: "share",
icon: "link",
className: "btn-large"
})
);
buttons.push(
this.attach("flat-button", {
action: "dismiss",
icon: "chevron-down",
className: "btn-large"
})
);
}
return buttons;
},
dismiss() {
postRNWebviewMessage("dismiss", true);
},
share() {
postRNWebviewMessage("shareUrl", window.location.href);
}
});