cometchat-react-ui-kit2
Version:
CometChat UI Kit for React App
133 lines (132 loc) • 6.36 kB
JavaScript
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.listItemStyle = exports.contactMsgTxtStyle = exports.contactMsgStyle = exports.contactMsgImgStyle = exports.contactListStyle = exports.contactAlphabetStyle = void 0;
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
var _Shared = require("../../Shared");
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 contactListStyle = function contactListStyle(style, theme) {
var _theme$palette;
return _objectSpread({
position: "relative",
display: "flex",
flexDirection: "column",
width: style.width,
height: style.height,
overflowX: "hidden",
overflowY: "scroll",
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.contactListStyle = contactListStyle;
var contactMsgStyle = function contactMsgStyle(style) {
return {
overflow: "hidden",
width: style.width,
display: "flex",
justifyContent: "center",
alignItems: "center",
position: "absolute",
top: "50%"
};
};
exports.contactMsgStyle = contactMsgStyle;
var contactMsgTxtStyle = function contactMsgTxtStyle(style, theme, decoratorMessage, fontHelper) {
var color = {
color: theme.palette.accent400[theme.palette.mode]
};
var font = {
font: fontHelper(theme.typography.heading)
};
if (decoratorMessage && decoratorMessage.toLowerCase() === "no_users_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 && decoratorMessage.toLowerCase() === "something_wrong") {
color = {
color: theme.palette.error[theme.palette.mode]
};
if (style !== null && style !== void 0 && style.errorTextColor) {
color = {
color: style === null || style === void 0 ? void 0 : style.errorTextColor
};
}
if (style !== null && style !== void 0 && style.errorTextFont) {
font = {
font: style === null || style === void 0 ? void 0 : style.errorTextFont
};
}
}
return _objectSpread(_objectSpread({
display: "flex",
justifyContent: "center",
margin: "0",
minHeight: "36px",
lineHeight: "30px",
wordWrap: "break-word",
padding: "0 16px",
width: "calc(100% - 32px)"
}, color), font);
};
exports.contactMsgTxtStyle = contactMsgTxtStyle;
var contactMsgImgStyle = function contactMsgImgStyle(style, loadingIconURL, theme) {
var background = {
background: theme.palette.accent600[theme.palette.mode]
};
if (style !== null && style !== void 0 && style.loadingIconTint) {
background = {
background: style === null || style === void 0 ? void 0 : style.loadingIconTint
};
}
return _objectSpread(_objectSpread({
WebkitMask: "url(".concat(loadingIconURL, ") center center no-repeat")
}, background), {}, {
margin: "0",
minHeight: "36px",
lineHeight: "30px",
wordWrap: "break-word",
padding: "0 16px",
width: "100%"
});
};
exports.contactMsgImgStyle = contactMsgImgStyle;
var contactAlphabetStyle = function contactAlphabetStyle(theme) {
var _theme$palette2;
return {
padding: "0 20px",
margin: "8px 0",
width: "calc(100% - 40px)",
color: theme === null || theme === void 0 ? void 0 : (_theme$palette2 = theme.palette) === null || _theme$palette2 === void 0 ? void 0 : _theme$palette2.getAccent500()
};
};
exports.contactAlphabetStyle = contactAlphabetStyle;
var listItemStyle = function listItemStyle(theme) {
var _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$palette3 = theme.palette) === null || _theme$palette3 === void 0 ? void 0 : _theme$palette3.getAccent50(),
border: "1px solid ".concat(theme.palette.accent200[theme.palette.mode]),
borderRadius: "0",
titleColor: theme === null || theme === void 0 ? void 0 : (_theme$palette4 = theme.palette) === null || _theme$palette4 === void 0 ? void 0 : _theme$palette4.accent[theme === null || theme === void 0 ? void 0 : (_theme$palette5 = theme.palette) === null || _theme$palette5 === void 0 ? void 0 : _theme$palette5.mode],
titleFont: (0, _Shared.fontHelper)(theme === null || theme === void 0 ? void 0 : (_theme$typography = theme.typography) === null || _theme$typography === void 0 ? void 0 : _theme$typography.title2),
subtitleColor: theme.palette.accent400[theme === null || theme === void 0 ? void 0 : (_theme$palette6 = theme.palette) === null || _theme$palette6 === void 0 ? void 0 : _theme$palette6.mode],
subtitleFont: (0, _Shared.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;