Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use React components for footer and header #3257

Merged
merged 10 commits into from
Nov 20, 2017
14 changes: 0 additions & 14 deletions client/templates/layout.html

This file was deleted.

11 changes: 0 additions & 11 deletions client/templates/layout.js

This file was deleted.

2 changes: 1 addition & 1 deletion imports/plugins/core/accounts/register.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ Reaction.registerPackage({
enabled: true,
structure: {
template: "accountsDashboard",
layoutHeader: "layoutHeader",
layoutHeader: "NavBar",
layoutFooter: "",
notFound: "notFound",
dashboardHeader: "dashboardHeader",
Expand Down
1 change: 0 additions & 1 deletion imports/plugins/core/checkout/client/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import "./templates/cartIcon/cartIcon.js";
import "./templates/checkout/addressBook/addressBook.html";
import "./templates/checkout/completed/completed.html";
import "./templates/checkout/completed/completed.js";
import "./templates/checkout/header/header.html";
import "./templates/checkout/login/login.html";
import "./templates/checkout/login/login.js";
import "./templates/checkout/progressBar/progressBar.html";
Expand Down

This file was deleted.

2 changes: 1 addition & 1 deletion imports/plugins/core/checkout/register.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Reaction.registerPackage({
enabled: true,
structure: {
template: "cartCheckout",
layoutHeader: "checkoutHeader",
layoutHeader: "NavBarCheckout",
layoutFooter: "",
notFound: "notFound",
dashboardHeader: "",
Expand Down
2 changes: 1 addition & 1 deletion imports/plugins/core/dashboard/register.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ Reaction.registerPackage({
enabled: true,
structure: {
template: "dashboardPackages",
layoutHeader: "layoutHeader",
layoutHeader: "NavBar",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any time these values change, you'll need to write a migration. This goes for all the register.js files modified.

Migrations can be found in /imports/plugins/core/versions.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks. I've written a migration for it.

layoutFooter: "",
notFound: "notFound",
dashboardHeader: "dashboardHeader",
Expand Down
2 changes: 1 addition & 1 deletion imports/plugins/core/email/register.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Reaction.registerPackage({
enabled: true,
structure: {
template: "email",
layoutHeader: "layoutHeader",
layoutHeader: "NavBar",
layoutFooter: "",
notFound: "notFound",
dashboardHeader: "dashboardHeader",
Expand Down
19 changes: 10 additions & 9 deletions imports/plugins/core/layout/client/components/coreLayout.js
Original file line number Diff line number Diff line change
@@ -1,33 +1,34 @@
import React from "react";
import PropTypes from "prop-types";
import classnames from "classnames";
import { Components, registerComponent } from "@reactioncommerce/reaction-components";
import { getComponent, registerComponent } from "@reactioncommerce/reaction-components";
import Blaze from "meteor/gadicc:blaze-react-component";
import { Template } from "meteor/templating";

const CoreLayout = ({ actionViewIsOpen, structure }) => {
const { layoutFooter, template } = structure || {};
const { layoutHeader, layoutFooter, template } = structure || {};

const pageClassName = classnames({
"page": true,
"show-settings": actionViewIsOpen
});

const headerComponent = layoutHeader && getComponent(layoutHeader);
const footerComponent = layoutFooter && getComponent(layoutFooter);

return (
<div className={pageClassName} id="reactionAppContainer">
<Components.NavBar />

{headerComponent && React.createElement(headerComponent, {})}

<Blaze template="cartDrawer" className="reaction-cart-drawer" />

{ Template[template] &&
{Template[template] &&
<main>
<Blaze template={template} />
</main>
}
</main>}

{ Template[layoutFooter] &&
<Blaze template={layoutFooter} className="reaction-navigation-footer footer-default" />
}
{footerComponent && React.createElement(footerComponent, {})}
</div>
);
};
Expand Down
17 changes: 17 additions & 0 deletions imports/plugins/core/layout/client/components/footer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import React from "react";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding a footer requires design direction from @rymorgan since for the longest time, we've not had one displayed. And the question is, should we even be adding visible one now.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Footer should not be displayed anywhere, if it wasn't already before..
Right now it's nothing more than an exemplary placeholder that's available for usage when implementing plugins.

Copy link
Contributor Author

@prinzdezibel prinzdezibel Nov 8, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But then, a plugin would have its own requirements on how the Footer is supposed to be rendered. Maybe it's just unnecessary to have it in its own place.

import { registerComponent } from "/imports/plugins/core/components/lib";

const Footer = () => (
<div className="reaction-navigation-footer footer-default">
<nav className="navbar-bottom" role="navigation">
<div className="row">
{/* Footer content */}
</div>
</nav>
</div>
);


registerComponent("Footer", Footer);

export default Footer;
7 changes: 2 additions & 5 deletions imports/plugins/core/layout/client/index.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
import "./templates/layout/admin/admin.html";
import "./templates/layout/admin/admin.js";
import "./templates/layout/alerts/alerts.html";
import "./templates/layout/alerts/alerts.js";
import "./templates/layout/alerts/inlineAlerts.js";
import "./templates/layout/alerts/reactionAlerts.js";
import "./templates/layout/createContentMenu/createContentMenu.html";
import "./templates/layout/createContentMenu/createContentMenu.js";
import "./templates/layout/footer/footer.html";
import "./templates/layout/header/brand.html";
import "./templates/layout/header/button.html";
import "./templates/layout/header/header.html";
import "./templates/layout/header/header.js";
import "./templates/layout/header/tags.html";
import "./templates/layout/notFound/notFound.html";
import "./templates/layout/notFound/notFound.js";
Expand All @@ -20,5 +15,7 @@ import "./templates/layout/notice/unauthorized.js";
import "./templates/theme/theme.html";
import "./templates/theme/theme.js";

import "./components/footer";

export CoreLayout from "./components/coreLayout";
export PrintLayout from "./components/printLayout";

This file was deleted.

157 changes: 0 additions & 157 deletions imports/plugins/core/layout/client/templates/layout/admin/admin.js

This file was deleted.

This file was deleted.

This file was deleted.

Loading