Skip to content

Commit

Permalink
Group order confirmation page code by file types
Browse files Browse the repository at this point in the history
  • Loading branch information
Starotitorov committed Nov 1, 2018
1 parent ffe5986 commit 447bb9d
Show file tree
Hide file tree
Showing 43 changed files with 9,710 additions and 9,628 deletions.
249 changes: 163 additions & 86 deletions package-lock.json

Large diffs are not rendered by default.

94 changes: 47 additions & 47 deletions packages/peregrine/src/Peregrine/Peregrine.js
Original file line number Diff line number Diff line change
@@ -1,47 +1,47 @@
import React from 'react';
import { Provider as ReduxProvider } from 'react-redux';
import createStore from '../store';
import MagentoRouter from '../Router';

/**
*
* @param {string} apiBase Absolute URL pointing to the GraphQL endpoint
* @param {string} __tmp_webpack_public_path__ Temporary hack. Expects the `__webpack_public_path__` value
* @returns {{ store: Store, Provider: () => JSX.Element }}
*/
export default function bootstrap({
apiBase,
renderRoutes,
__tmp_webpack_public_path__
}) {
// Remove deprecation warning after 2 version bumps
if (process.env.NODE_ENV !== 'production' && this instanceof bootstrap) {
throw new Error(
'The API for Peregrine has changed. ' +
'Please see the Release Notes on Github ' +
'for instructions to update your application'
);
}

const store = createStore();
const routerProps = {
apiBase,
renderRoutes,
__tmp_webpack_public_path__: ensureDirURI(__tmp_webpack_public_path__)
};
const Provider = () => (
<ReduxProvider store={store}>
<MagentoRouter {...routerProps} />
</ReduxProvider>
);

return { store, Provider };
}

/**
* Given a URI, will always return the same URI with a trailing slash
* @param {string} uri
*/
function ensureDirURI(uri) {
return uri.endsWith('/') ? uri : uri + '/';
}
import React from 'react';
import { Provider as ReduxProvider } from 'react-redux';
import createStore from '../store';
import MagentoRouter from '../Router';

/**
*
* @param {string} apiBase Absolute URL pointing to the GraphQL endpoint
* @param {string} __tmp_webpack_public_path__ Temporary hack. Expects the `__webpack_public_path__` value
* @returns {{ store: Store, Provider: () => JSX.Element }}
*/
export default function bootstrap({
apiBase,
renderRoutes,
__tmp_webpack_public_path__
}) {
// Remove deprecation warning after 2 version bumps
if (process.env.NODE_ENV !== 'production' && this instanceof bootstrap) {
throw new Error(
'The API for Peregrine has changed. ' +
'Please see the Release Notes on Github ' +
'for instructions to update your application'
);
}

const store = createStore();
const routerProps = {
apiBase,
renderRoutes,
__tmp_webpack_public_path__: ensureDirURI(__tmp_webpack_public_path__)
};
const Provider = () => (
<ReduxProvider store={store}>
<MagentoRouter {...routerProps} />
</ReduxProvider>
);

return { store, Provider };
}

/**
* Given a URI, will always return the same URI with a trailing slash
* @param {string} uri
*/
function ensureDirURI(uri) {
return uri.endsWith('/') ? uri : uri + '/';
}
102 changes: 51 additions & 51 deletions packages/peregrine/src/Router/Router.js
Original file line number Diff line number Diff line change
@@ -1,51 +1,51 @@
import React, { Component } from 'react';
import { BrowserRouter, Route } from 'react-router-dom';
import { string, func, object } from 'prop-types';
import MagentoRouteHandler from './MagentoRouteHandler';

export default class MagentoRouter extends Component {
static propTypes = {
/* Can be BrowserRouter, MemoryRouter, HashRouter, etc */
using: func,
routerProps: object,
apiBase: string.isRequired,
renderRoutes: func,
__tmp_webpack_public_path__: string.isRequired
};

static defaultProps = {
using: BrowserRouter,
routerProps: {},
renderRoutes: ({ magentoRoute }) => magentoRoute
};

render() {
const {
using: Router,
routerProps,
apiBase,
renderRoutes,
__tmp_webpack_public_path__
} = this.props;

return (
<Router {...routerProps}>
{renderRoutes({
magentoRoute: (
<Route
render={({ location }) => (
<MagentoRouteHandler
location={location}
apiBase={apiBase}
__tmp_webpack_public_path__={
__tmp_webpack_public_path__
}
/>
)}
/>
)
})}
</Router>
);
}
}
import React, { Component } from 'react';
import { BrowserRouter, Route } from 'react-router-dom';
import { string, func, object } from 'prop-types';
import MagentoRouteHandler from './MagentoRouteHandler';

export default class MagentoRouter extends Component {
static propTypes = {
/* Can be BrowserRouter, MemoryRouter, HashRouter, etc */
using: func,
routerProps: object,
apiBase: string.isRequired,
renderRoutes: func,
__tmp_webpack_public_path__: string.isRequired
};

static defaultProps = {
using: BrowserRouter,
routerProps: {},
renderRoutes: ({ magentoRoute }) => magentoRoute
};

render() {
const {
using: Router,
routerProps,
apiBase,
renderRoutes,
__tmp_webpack_public_path__
} = this.props;

return (
<Router {...routerProps}>
{renderRoutes({
magentoRoute: (
<Route
render={({ location }) => (
<MagentoRouteHandler
location={location}
apiBase={apiBase}
__tmp_webpack_public_path__={
__tmp_webpack_public_path__
}
/>
)}
/>
)
})}
</Router>
);
}
}
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
---
title: OrderConfirmation component
---

| Description | Reference image |
| -------------------------- | :-------------------------------------------: |
| Order confirmation | ![Order confirmation]{:width="300px"} |
| **Order number** link | ![Order number]{:width="300px"} |
| **Continue shopping** button | ![Continue shopping button]{:width="300px"} |
| **Create an account** button | ![Create an account button]{:width="300px"} |
{:style="table-layout:auto"}

[Order confirmation]: {{site.baseurl}}{% link venia-pwa-concept/images/order-confirmation.png %}
[Order number]: {{site.baseurl}}{% link venia-pwa-concept/images/order-number.png %}
[Continue shopping button]: {{site.baseurl}}{% link venia-pwa-concept/images/continue-shopping-button.png %}
[Create an account button]: {{site.baseurl}}{% link venia-pwa-concept/images/create-an-account-button.png %}

## Interactions

* **Continue shopping** button - On tap navigates the user to the page he came from.
* **Create an account** button - On tap navigates the user to the account creation page.
* **Order number** link - On tap navigates the user to the page of purchase he just made.
---
title: OrderConfirmation component
---

| Description | Reference image |
| -------------------------- | :-------------------------------------------: |
| Order confirmation | ![Order confirmation]{:width="300px"} |
| **Order number** link | ![Order number]{:width="300px"} |
| **Continue shopping** button | ![Continue shopping button]{:width="300px"} |
| **Create an account** button | ![Create an account button]{:width="300px"} |
{:style="table-layout:auto"}

[Order confirmation]: {{site.baseurl}}{% link venia-pwa-concept/images/order-confirmation.png %}
[Order number]: {{site.baseurl}}{% link venia-pwa-concept/images/order-number.png %}
[Continue shopping button]: {{site.baseurl}}{% link venia-pwa-concept/images/continue-shopping-button.png %}
[Create an account button]: {{site.baseurl}}{% link venia-pwa-concept/images/create-an-account-button.png %}

## Interactions

* **Continue shopping** button - On tap navigates the user to the page he came from.
* **Create an account** button - On tap navigates the user to the account creation page.
* **Order number** link - On tap navigates the user to the page of purchase he just made.
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
---
title: PurchaseHistory component
---

| Description | Reference image |
| -------------------------- | :-------------------------------------------: |
| Purchase history | ![Purchase history]{:width="300px"} |
| Filter | ![Filter]{:width="300px"} |
| Purchase history list item | ![Purchase history list item]{:width="300px"} |
{:style="table-layout:auto"}

[Purchase history]: {{site.baseurl}}{% link venia-pwa-concept/images/purchase-history.png %}
[Filter]: {{site.baseurl}}{% link venia-pwa-concept/images/purchase-history-filter.png %}
[Purchase history list item]: {{site.baseurl}}{% link venia-pwa-concept/images/purchase-history-item.png %}

## Interactions

* **Tap Item** - Navigates the user away from the purchase history and into the particular purchase history item page.
* **Tap Filter** - Shows up filter adjustments menu
---
title: PurchaseHistory component
---

| Description | Reference image |
| -------------------------- | :-------------------------------------------: |
| Purchase history | ![Purchase history]{:width="300px"} |
| Filter | ![Filter]{:width="300px"} |
| Purchase history list item | ![Purchase history list item]{:width="300px"} |
{:style="table-layout:auto"}

[Purchase history]: {{site.baseurl}}{% link venia-pwa-concept/images/purchase-history.png %}
[Filter]: {{site.baseurl}}{% link venia-pwa-concept/images/purchase-history-filter.png %}
[Purchase history list item]: {{site.baseurl}}{% link venia-pwa-concept/images/purchase-history-item.png %}

## Interactions

* **Tap Item** - Navigates the user away from the purchase history and into the particular purchase history item page.
* **Tap Filter** - Shows up filter adjustments menu
Loading

0 comments on commit 447bb9d

Please sign in to comment.