You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+7-7
Original file line number
Diff line number
Diff line change
@@ -34,7 +34,7 @@ NB there is further documentation colocated with relevant code. The above list i
34
34
35
35
A request to a BBC article (https://www.bbc.co.uk/news/articles/clldg965yzjo) is passed on to the Simorgh application from a proprietary routing and caching service (called Mozart).
36
36
37
-
The request matches a route in our express server using a regex match (`articleRegexPath` || `frontPageRegexPath`). If the URL matches the pre-defined regex pattern for an article or a front page we fetch some params from the route using the `getRouteProps` function. This returns the service, isAmp, route and match properties. Route is a react-router route that defines a method to fetch the initial JSON used to render the page and the react container in which to render i.e. `ArticleContainer`, this is typically called `getInitialData`
37
+
The request matches a route in our express server using a regex match (`articleRegexPath`). If the URL matches the pre-defined regex pattern for an article or a front page we fetch some params from the route using the `getRouteProps` function. This returns the service, isAmp, route and match properties. Route is a react-router route that defines a method to fetch the initial JSON used to render the page and the react container in which to render i.e. `ArticleContainer`, this is typically called `getInitialData`
38
38
39
39
Once data is returned we pull the status code and pass all of this data as props to our main document using `renderDocument`.
40
40
@@ -77,17 +77,17 @@ The withContexts HOC is a wrapper that provides access to the different context
77
77
78
78
#### withPageWrapper
79
79
80
-
The page wrapper HOC simply wraps the Article or FrontPage containers with a layout, at present we only have a single page layout. This layout includes the header, footer and context providers rendering the main body as a child between the header and the footer.
80
+
The page wrapper HOC simply wraps the Article containers with a layout, at present we only have a single page layout. This layout includes the header, footer and context providers rendering the main body as a child between the header and the footer.
81
81
82
82
#### withError
83
83
84
-
The error HOC checks the error prop passed in, if error is set to null the Article or FrontPage container is simply returned.
84
+
The error HOC checks the error prop passed in, if error is set to null the Article container is simply returned.
85
85
86
86
If error is set to true the Error component is returned, giving the user a visual indication of the error e.g. a 500 error page.
87
87
88
88
#### withData
89
89
90
-
Assuming the other HOC's have returned the original Article or FrontPage container the data HOC will run some validation checks on the JSON data passed in via the data prop. If all of the checks are satisfied the ArticleContainer will be returned with a single `pageData` prop. This pageData props will house the JSON data to be rendered e.g. the Optimo blocks for a given article.
90
+
Assuming the other HOC's have returned the original Article container the data HOC will run some validation checks on the JSON data passed in via the data prop. If all of the checks are satisfied the ArticleContainer will be returned with a single `pageData` prop. This pageData props will house the JSON data to be rendered e.g. the Optimo blocks for a given article.
91
91
92
92
#### withHashChangeHandler
93
93
@@ -100,6 +100,7 @@ The withOptimizelyProvider HOC returns components that have been enhanced with a
100
100
withOptimizelyProvider should be added as the value of the `handlerBeforeContexts` object key within [applyBasicPageHandlers.js](https://github.com/bbc/simorgh/tree/latest/src/app/pages/utils/applyBasicPageHandlers.js#L8), as the `ckns_mvt` is [set within the UserContext](https://github.com/bbc/simorgh/tree/latest/src/app/contexts/UserContext/index.tsx#L33), so the `withOptimizelyProvider` HOC needs to be applied in the correct order alongside the [withContexts](https://github.com/bbc/simorgh/tree/latest/src/app/pages/utils/applyBasicPageHandlers.js#L13) HOC. This makes the `ckns_mvt` available on first time visits to pass into the `OptimizelyProvider`, along with attributes such as `service`, which is used for determining when Optimizely should enable an experiment.
@@ -118,7 +118,7 @@ When adding a new page type there are several parts required.
118
118
#### 1) Fixture data should be added to `/data/{{service}}/{{pageType}}/`
119
119
120
120
- This should be done for each service using the page type.
121
-
-[Fixture data example](https://github.com/bbc/simorgh/blob/5de59c6207d46b11c3af68c58a620e250aff3a1a/data/igbo/frontpage/index.json)
121
+
-[Fixture data example](https://github.com/bbc/simorgh/blob/latest/data/igbo/articles)
122
122
123
123
#### 2) Serving the fixture data on local development
124
124
@@ -129,7 +129,7 @@ When adding a new page type there are several parts required.
129
129
130
130
#### 3) Create a new container for the page type
131
131
132
-
- Similar to [this](https://github.com/bbc/simorgh/blob/latest/src/app/pages/FrontPage/index.jsx) we require a top level container that will act as the entry point for the page routing. Each page type should have its own container.
132
+
- Similar to [this](https://github.com/bbc/simorgh/blob/latest/src/app/pages/ArticlePage/index.jsx) we require a top level container that will act as the entry point for the page routing. Each page type should have its own container.
133
133
- The container should render a `main` element with a [`flex-grow: 1;` css declaration](https://github.com/bbc/simorgh/blob/8e19f820ec0de4abd18a4d13e62dd5d843a064c0/src/app/containers/ArticleMain/index.jsx#L39), this is to ensure it grows to fill the space between the visual header and footer, the [root div](https://github.com/bbc/simorgh/blob/8e19f820ec0de4abd18a4d13e62dd5d843a064c0/src/server/Document/component.jsx#L31) using a [flexbox 'sticky footer' implementation](https://developer.mozilla.org/en-US/docs/Web/CSS/Layout_cookbook/Sticky_footers#Alternate_method).
0 commit comments