cometchat-react-ui-kit2
Version:
CometChat UI Kit for React App
122 lines (121 loc) • 5.78 kB
JavaScript
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.listItemStyle = exports.groupMsgTxtStyle = exports.groupMsgStyle = exports.groupMsgImgStyle = exports.groupListStyle = void 0;
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
var _ = require("../..");
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
var groupListStyle = function groupListStyle(style, theme) {
var _theme$palette;
return _objectSpread({
position: "relative",
display: "flex",
flexDirection: "column",
width: style.width,
height: style.height,
overflowX: "hidden",
overflowY: "auto",
margin: "0",
padding: "0",
background: (style === null || style === void 0 ? void 0 : style.background) || (theme === null || theme === void 0 ? void 0 : (_theme$palette = theme.palette) === null || _theme$palette === void 0 ? void 0 : _theme$palette.getBackground()),
border: style.border,
borderRadius: style.borderRadius
}, theme.globalStyles);
};
exports.groupListStyle = groupListStyle;
var groupMsgStyle = function groupMsgStyle(style) {
return {
overflow: "hidden",
width: style.width,
display: "flex",
justifyContent: "center",
alignItems: "center",
position: "absolute",
top: "50%"
};
};
exports.groupMsgStyle = groupMsgStyle;
var groupMsgTxtStyle = function groupMsgTxtStyle(style, theme, decoratorMessage) {
var color = {
color: theme.palette.accent400[theme.palette.mode]
};
var font = {
font: (0, _.fontHelper)(theme.typography.heading)
};
if (decoratorMessage.toLowerCase() === "no_groups_found") {
if (style !== null && style !== void 0 && style.emptyTextColor) {
color = {
color: style.emptyTextColor
};
}
if (style !== null && style !== void 0 && style.emptyTextFont) {
font = {
font: style.emptyTextFont
};
}
} else if (decoratorMessage.toLowerCase() === "something_wrong") {
color = {
color: theme.palette.error[theme.palette.mode]
};
if (style !== null && style !== void 0 && style.errorTextColor) {
color = {
color: style.errorTextColor
};
}
if (style !== null && style !== void 0 && style.errorTextFont) {
font = {
font: style.errorTextFont
};
}
}
return _objectSpread(_objectSpread(_objectSpread({
display: "flex",
justifyContent: "center",
margin: "0",
minHeight: "36px"
}, color), font), {}, {
wordWrap: "break-word",
padding: "0 16px",
width: "calc(100% - 32px)"
});
};
exports.groupMsgTxtStyle = groupMsgTxtStyle;
var groupMsgImgStyle = function groupMsgImgStyle(style, theme, loadingIconURL) {
var background = {
background: theme.palette.accent600[theme.palette.mode]
};
if (style !== null && style !== void 0 && style.loadingIconTint) {
background = {
background: style.loadingIconTint
};
}
return _objectSpread(_objectSpread({
WebkitMask: "url(".concat(loadingIconURL, ") center center no-repeat")
}, background), {}, {
margin: "0",
height: "36px",
wordWrap: "break-word",
padding: "0 16px",
width: "calc(100% - 32px)"
});
};
exports.groupMsgImgStyle = groupMsgImgStyle;
var listItemStyle = function listItemStyle(theme) {
var _theme$palette2, _theme$palette3, _theme$palette4, _theme$palette5, _theme$typography, _theme$palette6, _theme$typography2;
return {
width: "100%",
height: "auto",
background: "transparent",
activeBackground: theme === null || theme === void 0 ? void 0 : (_theme$palette2 = theme.palette) === null || _theme$palette2 === void 0 ? void 0 : _theme$palette2.getAccent50(),
border: "1px solid " + (theme === null || theme === void 0 ? void 0 : (_theme$palette3 = theme.palette) === null || _theme$palette3 === void 0 ? void 0 : _theme$palette3.accent200[theme === null || theme === void 0 ? void 0 : (_theme$palette4 = theme.palette) === null || _theme$palette4 === void 0 ? void 0 : _theme$palette4.mode]),
borderRadius: "0",
titleColor: theme === null || theme === void 0 ? void 0 : (_theme$palette5 = theme.palette) === null || _theme$palette5 === void 0 ? void 0 : _theme$palette5.getAccent(),
titleFont: (0, _.fontHelper)(theme === null || theme === void 0 ? void 0 : (_theme$typography = theme.typography) === null || _theme$typography === void 0 ? void 0 : _theme$typography.title2),
subtitleColor: theme === null || theme === void 0 ? void 0 : (_theme$palette6 = theme.palette) === null || _theme$palette6 === void 0 ? void 0 : _theme$palette6.getAccent600(),
subtitleFont: (0, _.fontHelper)(theme === null || theme === void 0 ? void 0 : (_theme$typography2 = theme.typography) === null || _theme$typography2 === void 0 ? void 0 : _theme$typography2.subtitle2)
};
};
exports.listItemStyle = listItemStyle;