@selfcommunity/react-ui 0.11.0-alpha.54 → 0.11.0-alpha.55
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.
- package/lib/cjs/components/Footer/Footer.js +9 -6
- package/lib/cjs/components/Footer/constants.d.ts +1 -0
- package/lib/cjs/components/Footer/constants.js +2 -1
- package/lib/esm/components/Footer/Footer.js +10 -7
- package/lib/esm/components/Footer/constants.d.ts +1 -0
- package/lib/esm/components/Footer/constants.js +1 -0
- package/lib/umd/react-ui.js +1 -1
- package/package.json +2 -2
|
@@ -22,7 +22,7 @@ const classes = {
|
|
|
22
22
|
const Root = (0, styles_1.styled)(material_1.Box, {
|
|
23
23
|
name: constants_1.PREFIX,
|
|
24
24
|
slot: 'Root'
|
|
25
|
-
})((
|
|
25
|
+
})(() => ({}));
|
|
26
26
|
/**
|
|
27
27
|
* > API documentation for the Community-JS Footer component. Learn about the available props and the CSS API.
|
|
28
28
|
*
|
|
@@ -57,12 +57,13 @@ function Footer(inProps) {
|
|
|
57
57
|
});
|
|
58
58
|
const { className, menu = null, startActions = null, endActions = null } = props, rest = tslib_1.__rest(props, ["className", "menu", "startActions", "endActions"]);
|
|
59
59
|
// PREFERENCES
|
|
60
|
-
const
|
|
60
|
+
const { preferences } = (0, react_core_1.useSCPreferences)();
|
|
61
61
|
const copyright = (0, react_1.useMemo)(() => {
|
|
62
|
-
return
|
|
63
|
-
?
|
|
62
|
+
return preferences && react_core_1.SCPreferences.TEXT_APPLICATION_COPYRIGHT in preferences
|
|
63
|
+
? preferences[react_core_1.SCPreferences.TEXT_APPLICATION_COPYRIGHT].value.replace('$year', new Date().getFullYear())
|
|
64
64
|
: null;
|
|
65
|
-
}, [
|
|
65
|
+
}, [preferences]);
|
|
66
|
+
const exploreStreamEnabled = preferences[react_core_1.SCPreferences.CONFIGURATIONS_EXPLORE_STREAM_ENABLED].value;
|
|
66
67
|
// STATE
|
|
67
68
|
const [_menu, setMenu] = (0, react_1.useState)(menu);
|
|
68
69
|
const [loading, setLoading] = (0, react_1.useState)(!menu);
|
|
@@ -95,6 +96,8 @@ function Footer(inProps) {
|
|
|
95
96
|
if (loading) {
|
|
96
97
|
return (0, jsx_runtime_1.jsx)(Skeleton_1.default, {});
|
|
97
98
|
}
|
|
98
|
-
return ((0, jsx_runtime_1.jsxs)(Root, Object.assign({}, rest, { className: (0, classnames_1.default)(classes.root, className) }, { children: [startActions, (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.itemList }, { children: (0, utils_1.sortByAttr)(_menu.items, 'order')
|
|
99
|
+
return ((0, jsx_runtime_1.jsxs)(Root, Object.assign({}, rest, { className: (0, classnames_1.default)(classes.root, className) }, { children: [startActions, (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.itemList }, { children: (0, utils_1.sortByAttr)(_menu.items, 'order')
|
|
100
|
+
.filter((item) => exploreStreamEnabled || item.url !== constants_1.EXPLORE_MENU_ITEM)
|
|
101
|
+
.map((item, index) => ((0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ component: react_core_1.Link, className: classes.item, to: item.url, variant: "text" }, { children: item.label }), item.id))) })), endActions, (0, jsx_runtime_1.jsx)(material_1.Typography, { textAlign: "center", className: classes.copyright, variant: "body2", dangerouslySetInnerHTML: { __html: copyright } })] })));
|
|
99
102
|
}
|
|
100
103
|
exports.default = Footer;
|
|
@@ -10,7 +10,7 @@ import { Logger, sortByAttr } from '@selfcommunity/utils';
|
|
|
10
10
|
import { Link, SCPreferences, useSCPreferences } from '@selfcommunity/react-core';
|
|
11
11
|
import { SCOPE_SC_UI } from '../../constants/Errors';
|
|
12
12
|
import FooterSkeleton from './Skeleton';
|
|
13
|
-
import { PREFIX } from './constants';
|
|
13
|
+
import { PREFIX, EXPLORE_MENU_ITEM } from './constants';
|
|
14
14
|
const classes = {
|
|
15
15
|
root: `${PREFIX}-root`,
|
|
16
16
|
itemList: `${PREFIX}-item-list`,
|
|
@@ -20,7 +20,7 @@ const classes = {
|
|
|
20
20
|
const Root = styled(Box, {
|
|
21
21
|
name: PREFIX,
|
|
22
22
|
slot: 'Root'
|
|
23
|
-
})((
|
|
23
|
+
})(() => ({}));
|
|
24
24
|
/**
|
|
25
25
|
* > API documentation for the Community-JS Footer component. Learn about the available props and the CSS API.
|
|
26
26
|
*
|
|
@@ -55,12 +55,13 @@ export default function Footer(inProps) {
|
|
|
55
55
|
});
|
|
56
56
|
const { className, menu = null, startActions = null, endActions = null } = props, rest = __rest(props, ["className", "menu", "startActions", "endActions"]);
|
|
57
57
|
// PREFERENCES
|
|
58
|
-
const
|
|
58
|
+
const { preferences } = useSCPreferences();
|
|
59
59
|
const copyright = useMemo(() => {
|
|
60
|
-
return
|
|
61
|
-
?
|
|
60
|
+
return preferences && SCPreferences.TEXT_APPLICATION_COPYRIGHT in preferences
|
|
61
|
+
? preferences[SCPreferences.TEXT_APPLICATION_COPYRIGHT].value.replace('$year', new Date().getFullYear())
|
|
62
62
|
: null;
|
|
63
|
-
}, [
|
|
63
|
+
}, [preferences]);
|
|
64
|
+
const exploreStreamEnabled = preferences[SCPreferences.CONFIGURATIONS_EXPLORE_STREAM_ENABLED].value;
|
|
64
65
|
// STATE
|
|
65
66
|
const [_menu, setMenu] = useState(menu);
|
|
66
67
|
const [loading, setLoading] = useState(!menu);
|
|
@@ -93,5 +94,7 @@ export default function Footer(inProps) {
|
|
|
93
94
|
if (loading) {
|
|
94
95
|
return _jsx(FooterSkeleton, {});
|
|
95
96
|
}
|
|
96
|
-
return (_jsxs(Root, Object.assign({}, rest, { className: classNames(classes.root, className) }, { children: [startActions, _jsx(Box, Object.assign({ className: classes.itemList }, { children: sortByAttr(_menu.items, 'order')
|
|
97
|
+
return (_jsxs(Root, Object.assign({}, rest, { className: classNames(classes.root, className) }, { children: [startActions, _jsx(Box, Object.assign({ className: classes.itemList }, { children: sortByAttr(_menu.items, 'order')
|
|
98
|
+
.filter((item) => exploreStreamEnabled || item.url !== EXPLORE_MENU_ITEM)
|
|
99
|
+
.map((item, index) => (_jsx(Button, Object.assign({ component: Link, className: classes.item, to: item.url, variant: "text" }, { children: item.label }), item.id))) })), endActions, _jsx(Typography, { textAlign: "center", className: classes.copyright, variant: "body2", dangerouslySetInnerHTML: { __html: copyright } })] })));
|
|
97
100
|
}
|