@redocly/theme 0.4.4 → 0.4.5

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.
@@ -10,16 +10,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
10
10
  exports.LastUpdated = void 0;
11
11
  var react_1 = __importDefault(require("react"));
12
12
  var styled_components_1 = __importDefault(require("styled-components"));
13
+ var timeago_js_1 = require("timeago.js");
13
14
  var hooks_1 = require("../mocks/hooks");
14
15
  var constants_1 = require("../mocks/constants");
15
- // import { timeAgo } from '../mocks/utils';
16
- // TODO: use timeago.js instead
17
- // import { format } from 'timeago.js';
18
- // Last updated ${format(lastModified)}
19
- function timeAgo(date) {
20
- var d = new Date(date);
21
- return "".concat(d.getDate(), "-").concat(d.getMonth() + 1, "-").concat(d.getFullYear());
22
- }
23
16
  function LastUpdated(_a) {
24
17
  var lastModified = _a.lastModified;
25
18
  var lastUpdatedBlock = (0, hooks_1.useThemeSettings)(constants_1.DEFAULT_THEME_NAME).lastUpdatedBlock;
@@ -28,7 +21,7 @@ function LastUpdated(_a) {
28
21
  }
29
22
  return (react_1.default.createElement(Wrapper, { "data-component-name": "LastUpdated/LastUpdated" },
30
23
  "Last updated ",
31
- timeAgo(lastModified)));
24
+ (0, timeago_js_1.format)(lastModified)));
32
25
  }
33
26
  exports.LastUpdated = LastUpdated;
34
27
  var Wrapper = styled_components_1.default.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n color: var(--last-updated-text-color);\n font-size: var(--last-updated-font-size);\n font-family: var(--last-updated-font-family);\n line-height: var(--last-updated-line-height);\n padding-bottom: 30px;\n"], ["\n color: var(--last-updated-text-color);\n font-size: var(--last-updated-font-size);\n font-family: var(--last-updated-font-family);\n line-height: var(--last-updated-line-height);\n padding-bottom: 30px;\n"])));
@@ -9,7 +9,7 @@ declare type MarkdownLayoutProps = {
9
9
  text: string;
10
10
  icon: string;
11
11
  };
12
- lastModified?: string | Date;
12
+ lastModified?: string | null;
13
13
  };
14
14
  export declare function MarkdownLayout({ tableOfContent, markdownWrapper, showPrevButton, showNextButton, editPage, lastModified, }: MarkdownLayoutProps): JSX.Element;
15
15
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redocly/theme",
3
- "version": "0.4.4",
3
+ "version": "0.4.5",
4
4
  "description": "Shared UI components",
5
5
  "author": "team@redocly.com",
6
6
  "license": "SEE LICENSE IN LICENSE",
@@ -1,17 +1,9 @@
1
1
  import React from 'react';
2
2
  import styled from 'styled-components';
3
+ import { format } from 'timeago.js';
3
4
 
4
5
  import { useThemeSettings } from '@portal/hooks';
5
6
  import { DEFAULT_THEME_NAME } from '@portal/constants';
6
- // import { timeAgo } from '@portal/utils';
7
-
8
- // TODO: use timeago.js instead
9
- // import { format } from 'timeago.js';
10
- // Last updated ${format(lastModified)}
11
- function timeAgo(date: string | Date) {
12
- const d = new Date(date);
13
- return `${d.getDate()}-${d.getMonth() + 1}-${d.getFullYear()}`;
14
- }
15
7
 
16
8
  export interface LastUpdatedProps {
17
9
  lastModified: string | Date;
@@ -26,7 +18,7 @@ export function LastUpdated({ lastModified }: LastUpdatedProps): JSX.Element | n
26
18
 
27
19
  return (
28
20
  <Wrapper data-component-name="LastUpdated/LastUpdated">
29
- Last updated {timeAgo(lastModified)}
21
+ Last updated {format(lastModified)}
30
22
  </Wrapper>
31
23
  );
32
24
  }
@@ -17,7 +17,7 @@ type MarkdownLayoutProps = {
17
17
  text: string;
18
18
  icon: string;
19
19
  };
20
- lastModified?: string | Date;
20
+ lastModified?: string | null;
21
21
  };
22
22
 
23
23
  export function MarkdownLayout({