@bbc/morty-docs 1.11.0 → 1.11.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,9 @@
1
1
  const React = require('react');
2
2
 
3
+ const {
4
+ prettyDate
5
+ } = require('./PrettyDate');
6
+
3
7
  const Styles = {
4
8
  footer: {
5
9
  bottom: '0',
@@ -9,7 +13,8 @@ const Styles = {
9
13
  minHeight: '25vh',
10
14
  position: 'relative',
11
15
  textAlign: 'center',
12
- padding: '1em 0 2em 0'
16
+ padding: '1em 0 2em 0',
17
+ lineHeight: '1.5rem'
13
18
  },
14
19
  footerLink: {
15
20
  color: '#337ab7'
@@ -22,7 +27,7 @@ const Footer = () => {
22
27
  }, React.createElement("a", {
23
28
  href: "https://github.com/bbc/morty-docs",
24
29
  style: Styles.footerLink
25
- }, "Morty-Docs on github"));
30
+ }, "Morty-Docs on github"), React.createElement("br", null), "Page generated on ", prettyDate(new Date()));
26
31
  };
27
32
 
28
33
  module.exports = Footer;
@@ -49,14 +49,16 @@ const HeaderLinks = ({
49
49
  const Header = ({
50
50
  relPath,
51
51
  basePath
52
- }) => React.createElement("div", {
53
- style: Styles.navbar
54
- }, React.createElement("nav", {
55
- style: Styles.headerNav
56
- }, React.createElement("ol", {
57
- style: Styles.headerLinks
58
- }, React.createElement(HeaderLinks, {
59
- paths: getHeaderPaths(basePath, relPath)
60
- }))));
52
+ }) => {
53
+ return React.createElement("div", {
54
+ style: Styles.navbar
55
+ }, React.createElement("nav", {
56
+ style: Styles.headerNav
57
+ }, React.createElement("ol", {
58
+ style: Styles.headerLinks
59
+ }, React.createElement(HeaderLinks, {
60
+ paths: getHeaderPaths(basePath, relPath)
61
+ }))));
62
+ };
61
63
 
62
64
  module.exports = Header;
@@ -0,0 +1,31 @@
1
+ const React = require('react');
2
+
3
+ const nth = function (d) {
4
+ if (d > 3 && d < 21) return 'th';
5
+
6
+ switch (d % 10) {
7
+ case 1:
8
+ return 'st';
9
+
10
+ case 2:
11
+ return 'nd';
12
+
13
+ case 3:
14
+ return 'rd';
15
+
16
+ default:
17
+ return 'th';
18
+ }
19
+ };
20
+
21
+ const month = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
22
+
23
+ const prettyDate = dateObj => {
24
+ const day = dateObj.getDate();
25
+ const year = dateObj.getFullYear();
26
+ return React.createElement(React.Fragment, null, day, React.createElement("sup", null, nth(day)), " ", month[dateObj.getMonth()], " ", year);
27
+ };
28
+
29
+ module.exports = {
30
+ prettyDate
31
+ };
@@ -48,6 +48,11 @@ table {
48
48
  border-collapse: collapse;
49
49
  border-spacing: 0;
50
50
  }
51
+ sup {
52
+ vertical-align: super;
53
+ font-size: smaller;
54
+ padding-right: 0.2rem;
55
+ }
51
56
  `;
52
57
 
53
58
  const Reset = () => React.createElement("style", {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bbc/morty-docs",
3
- "version": "1.11.0",
3
+ "version": "1.11.3",
4
4
  "description": "To generate a static website from markdown documentation, to allow users to consume content in an easily accessible format",
5
5
  "main": "build/index.js",
6
6
  "publishConfig": {