cometchat-react-ui-kit2
Version:
CometChat UI Kit for React App
261 lines (260 loc) • 9.15 kB
JavaScript
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.Typography = void 0;
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
/**
* @class FontDetails
* @param {String} fontFamily
* @param {String} fontWeight
* @param {String} fontSize
*/var FontDetails = /*#__PURE__*/(0, _createClass2["default"])(function FontDetails(_ref) {
var _ref$fontFamily = _ref.fontFamily,
fontFamily = _ref$fontFamily === void 0 ? "" : _ref$fontFamily,
_ref$fontWeight = _ref.fontWeight,
fontWeight = _ref$fontWeight === void 0 ? "" : _ref$fontWeight,
_ref$fontSize = _ref.fontSize,
fontSize = _ref$fontSize === void 0 ? "" : _ref$fontSize;
(0, _classCallCheck2["default"])(this, FontDetails);
this.fontFamily = fontFamily;
this.fontWeight = fontWeight;
this.fontSize = fontSize;
}); /**
* @class Typography
* @param {String} fontFamily
* @param {String} fontWeightRegular
* @param {String} fontWeightMedium
* @param {String} fontWeightSemibold
* @param {String} fontWeightBold
* @param {Object} heading
* @param {Object} name
* @param {Object} title1
* @param {Object} title2
* @param {Object} subtitle1
* @param {Object} subtitle2
* @param {Object} text1
* @param {Object} text2
* @param {Object} caption1
* @param {Object} caption2
*/
var Typography = /*#__PURE__*/function () {
function Typography(_ref2) {
var _ref2$fontFamily = _ref2.fontFamily,
fontFamily = _ref2$fontFamily === void 0 ? ["Inter,sans-serif"].join(",") : _ref2$fontFamily,
_ref2$fontWeightRegul = _ref2.fontWeightRegular,
fontWeightRegular = _ref2$fontWeightRegul === void 0 ? "400" : _ref2$fontWeightRegul,
_ref2$fontWeightMediu = _ref2.fontWeightMedium,
fontWeightMedium = _ref2$fontWeightMediu === void 0 ? "500" : _ref2$fontWeightMediu,
_ref2$fontWeightSemib = _ref2.fontWeightSemibold,
fontWeightSemibold = _ref2$fontWeightSemib === void 0 ? "600" : _ref2$fontWeightSemib,
_ref2$fontWeightBold = _ref2.fontWeightBold,
fontWeightBold = _ref2$fontWeightBold === void 0 ? "700" : _ref2$fontWeightBold,
_ref2$heading = _ref2.heading,
heading = _ref2$heading === void 0 ? new FontDetails({
fontFamily: fontFamily,
fontWeight: fontWeightBold,
fontSize: "22px"
}) : _ref2$heading,
_ref2$name = _ref2.name,
name = _ref2$name === void 0 ? new FontDetails({
fontFamily: fontFamily,
fontWeight: fontWeightMedium,
fontSize: "16px"
}) : _ref2$name,
_ref2$title = _ref2.title1,
title1 = _ref2$title === void 0 ? new FontDetails({
fontFamily: fontFamily,
fontWeight: fontWeightRegular,
fontSize: "22px"
}) : _ref2$title,
_ref2$title2 = _ref2.title2,
title2 = _ref2$title2 === void 0 ? new FontDetails({
fontFamily: fontFamily,
fontWeight: fontWeightSemibold,
fontSize: "15px"
}) : _ref2$title2,
_ref2$subtitle = _ref2.subtitle1,
subtitle1 = _ref2$subtitle === void 0 ? new FontDetails({
fontFamily: fontFamily,
fontWeight: fontWeightRegular,
fontSize: "15px"
}) : _ref2$subtitle,
_ref2$subtitle2 = _ref2.subtitle2,
subtitle2 = _ref2$subtitle2 === void 0 ? new FontDetails({
fontFamily: fontFamily,
fontWeight: fontWeightRegular,
fontSize: "13px"
}) : _ref2$subtitle2,
_ref2$text = _ref2.text1,
text1 = _ref2$text === void 0 ? new FontDetails({
fontFamily: fontFamily,
fontWeight: fontWeightMedium,
fontSize: "15px"
}) : _ref2$text,
_ref2$text2 = _ref2.text2,
text2 = _ref2$text2 === void 0 ? new FontDetails({
fontFamily: fontFamily,
fontWeight: fontWeightMedium,
fontSize: "13px"
}) : _ref2$text2,
_ref2$caption = _ref2.caption1,
caption1 = _ref2$caption === void 0 ? new FontDetails({
fontFamily: fontFamily,
fontWeight: fontWeightMedium,
fontSize: "12px"
}) : _ref2$caption,
_ref2$caption2 = _ref2.caption2,
caption2 = _ref2$caption2 === void 0 ? new FontDetails({
fontFamily: fontFamily,
fontWeight: fontWeightMedium,
fontSize: "11px"
}) : _ref2$caption2;
(0, _classCallCheck2["default"])(this, Typography);
this.fontFamily = fontFamily;
this.fontWeightRegular = fontWeightRegular;
this.fontWeightMedium = fontWeightMedium;
this.fontWeightSemibold = fontWeightSemibold;
this.fontWeightBold = fontWeightBold;
this.heading = new FontDetails(heading);
this.name = new FontDetails(name);
this.title1 = new FontDetails(title1);
this.title2 = new FontDetails(title2);
this.subtitle1 = new FontDetails(subtitle1);
this.subtitle2 = new FontDetails(subtitle2);
this.text1 = new FontDetails(text1);
this.text2 = new FontDetails(text2);
this.caption1 = new FontDetails(caption1);
this.caption2 = new FontDetails(caption2);
}
(0, _createClass2["default"])(Typography, [{
key: "setFontFamily",
value: function setFontFamily(fontFamily) {
this.fontFamily = fontFamily.join(",");
}
}, {
key: "setFontWeightRegular",
value: function setFontWeightRegular(fontWeightRegular) {
this.fontWeightRegular = fontWeightRegular;
}
}, {
key: "setFontWeightMedium",
value: function setFontWeightMedium(fontWeightMedium) {
this.fontWeightMedium = fontWeightMedium;
}
}, {
key: "setFontWeightSemibold",
value: function setFontWeightSemibold(fontWeightSemibold) {
this.fontWeightSemibold = fontWeightSemibold;
}
}, {
key: "setFontWeightBold",
value: function setFontWeightBold(fontWeightBold) {
this.fontWeightBold = fontWeightBold;
}
}, {
key: "setHeading",
value: function setHeading(headingFont) {
if (headingFont && headingFont.fontSize) {
this.heading.fontSize = headingFont.fontSize;
}
if (headingFont && headingFont.fontWeight) {
this.heading.fontWeight = headingFont.fontWeight;
}
}
}, {
key: "setName",
value: function setName(nameFont) {
if (nameFont && nameFont.fontSize) {
this.name.fontSize = nameFont.fontSize;
}
if (nameFont && nameFont.fontWeight) {
this.name.fontWeight = nameFont.fontWeight;
}
}
}, {
key: "setTitle1",
value: function setTitle1(titleFont) {
if (titleFont && titleFont.fontSize) {
this.title1.fontSize = titleFont.fontSize;
}
if (titleFont && titleFont.fontWeight) {
this.title1.fontWeight = titleFont.fontWeight;
}
}
}, {
key: "setTitle2",
value: function setTitle2(titleFont) {
if (titleFont && titleFont.fontSize) {
this.title2.fontSize = titleFont.fontSize;
}
if (titleFont && titleFont.fontWeight) {
this.title2.fontWeight = titleFont.fontWeight;
}
}
}, {
key: "setSubtitle1",
value: function setSubtitle1(subtitleFont) {
if (subtitleFont && subtitleFont.fontSize) {
this.subtitle1.fontSize = subtitleFont.fontSize;
}
if (subtitleFont && subtitleFont.fontWeight) {
this.subtitle1.fontWeight = subtitleFont.fontWeight;
}
}
}, {
key: "setSubtitle2",
value: function setSubtitle2(subtitleFont) {
if (subtitleFont && subtitleFont.fontSize) {
this.subtitle2.fontSize = subtitleFont.fontSize;
}
if (subtitleFont && subtitleFont.fontWeight) {
this.subtitle2.fontWeight = subtitleFont.fontWeight;
}
}
}, {
key: "setText1",
value: function setText1(textFont) {
if (textFont && textFont.fontSize) {
this.text1.fontSize = textFont.fontSize;
}
if (textFont && textFont.fontWeight) {
this.text1.fontWeight = textFont.fontWeight;
}
}
}, {
key: "setText2",
value: function setText2(textFont) {
if (textFont && textFont.fontSize) {
this.text2.fontSize = textFont.fontSize;
}
if (textFont && textFont.fontWeight) {
this.text2.fontWeight = textFont.fontWeight;
}
}
}, {
key: "setCaption1",
value: function setCaption1(captionFont) {
if (captionFont && captionFont.fontSize) {
this.caption1.fontSize = captionFont.fontSize;
}
if (captionFont && captionFont.fontWeight) {
this.caption1.fontWeight = captionFont.fontWeight;
}
}
}, {
key: "setCaption2",
value: function setCaption2(captionFont) {
if (captionFont && captionFont.fontSize) {
this.caption2.fontSize = captionFont.fontSize;
}
if (captionFont && captionFont.fontWeight) {
this.caption2.fontWeight = captionFont.fontWeight;
}
}
}]);
return Typography;
}();
exports.Typography = Typography;