@redocly/theme 0.40.2 → 0.40.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.
|
@@ -10,21 +10,18 @@ const FooterItem_1 = require("../../components/Footer/FooterItem");
|
|
|
10
10
|
const utils_1 = require("../../core/utils");
|
|
11
11
|
const hooks_1 = require("../../core/hooks");
|
|
12
12
|
const FooterCopyright_1 = require("../../components/Footer/FooterCopyright");
|
|
13
|
-
const FooterLogo_1 = require("../../components/Footer/FooterLogo");
|
|
14
13
|
const FooterColumn_1 = require("../../components/Footer/FooterColumn");
|
|
15
14
|
function Footer({ className }) {
|
|
16
|
-
const { footer
|
|
17
|
-
const { items, copyrightText
|
|
18
|
-
if (
|
|
15
|
+
const { footer } = (0, hooks_1.useThemeConfig)() || {};
|
|
16
|
+
const { items = [], copyrightText } = footer || {};
|
|
17
|
+
if (((0, utils_1.isEmptyArray)(items) && !copyrightText) || (footer === null || footer === void 0 ? void 0 : footer.hide)) {
|
|
19
18
|
return null;
|
|
20
19
|
}
|
|
21
20
|
const withColumns = items.some((item) => { var _a; return (((_a = item === null || item === void 0 ? void 0 : item.items) === null || _a === void 0 ? void 0 : _a.length) || 0) > 0; });
|
|
22
21
|
return (react_1.default.createElement(FooterWrapper, { "data-component-name": "Footer/Footer", className: className, withColumns: withColumns },
|
|
23
|
-
react_1.default.createElement(FooterColumnsSection, null,
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
? items.map((column, index) => (react_1.default.createElement(FooterColumn_1.FooterColumn, { key: `${column.label}_${index}`, column: column })))
|
|
27
|
-
: items.map((item, index) => (react_1.default.createElement(FooterItem_1.FooterItem, { key: index, item: item })))),
|
|
22
|
+
!!items.length && (react_1.default.createElement(FooterColumnsSection, null, withColumns
|
|
23
|
+
? items.map((column, index) => (react_1.default.createElement(FooterColumn_1.FooterColumn, { key: `${column.label}_${index}`, column: column })))
|
|
24
|
+
: items.map((item, index) => (react_1.default.createElement(FooterItem_1.FooterItem, { key: index, item: item }))))),
|
|
28
25
|
react_1.default.createElement(FooterCopyrightWrapper, null, copyrightText && react_1.default.createElement(FooterCopyright_1.FooterCopyright, { copyrightText: copyrightText }))));
|
|
29
26
|
}
|
|
30
27
|
exports.Footer = Footer;
|
package/package.json
CHANGED
|
@@ -7,7 +7,6 @@ import { FooterItem } from '@redocly/theme/components/Footer/FooterItem';
|
|
|
7
7
|
import { breakpoints, isEmptyArray } from '@redocly/theme/core/utils';
|
|
8
8
|
import { useThemeConfig } from '@redocly/theme/core/hooks';
|
|
9
9
|
import { FooterCopyright } from '@redocly/theme/components/Footer/FooterCopyright';
|
|
10
|
-
import { FooterLogo } from '@redocly/theme/components/Footer/FooterLogo';
|
|
11
10
|
import { FooterColumn } from '@redocly/theme/components/Footer/FooterColumn';
|
|
12
11
|
|
|
13
12
|
export type FooterProps = {
|
|
@@ -15,10 +14,10 @@ export type FooterProps = {
|
|
|
15
14
|
};
|
|
16
15
|
|
|
17
16
|
export function Footer({ className }: FooterProps): JSX.Element | null {
|
|
18
|
-
const { footer
|
|
19
|
-
const { items, copyrightText
|
|
17
|
+
const { footer } = useThemeConfig() || {};
|
|
18
|
+
const { items = [], copyrightText } = footer || {};
|
|
20
19
|
|
|
21
|
-
if (
|
|
20
|
+
if ((isEmptyArray(items) && !copyrightText) || footer?.hide) {
|
|
22
21
|
return null;
|
|
23
22
|
}
|
|
24
23
|
|
|
@@ -30,16 +29,17 @@ export function Footer({ className }: FooterProps): JSX.Element | null {
|
|
|
30
29
|
className={className}
|
|
31
30
|
withColumns={withColumns}
|
|
32
31
|
>
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
32
|
+
{!!items.length && (
|
|
33
|
+
<FooterColumnsSection>
|
|
34
|
+
{withColumns
|
|
35
|
+
? (items as ResolvedNavItem[]).map((column, index) => (
|
|
36
|
+
<FooterColumn key={`${column.label}_${index}`} column={column} />
|
|
37
|
+
))
|
|
38
|
+
: (items as ResolvedNavItem[]).map((item, index) => (
|
|
39
|
+
<FooterItem key={index} item={item} />
|
|
40
|
+
))}
|
|
41
|
+
</FooterColumnsSection>
|
|
42
|
+
)}
|
|
43
43
|
<FooterCopyrightWrapper>
|
|
44
44
|
{copyrightText && <FooterCopyright copyrightText={copyrightText} />}
|
|
45
45
|
</FooterCopyrightWrapper>
|