@trap_stevo/legendarybuilderproreact-ui
Version:
The legendary UI & utility API that makes your application a legendary application. ~ Created by Steven Compton
207 lines • 15.1 kB
JavaScript
import _extends from "@babel/runtime/helpers/extends";
import _defineProperty from "@babel/runtime/helpers/defineProperty";
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
import React, { useState } from "react";
import { motion } from "framer-motion";
var flipVariants = {
front: {
rotateY: 0
},
back: {
rotateY: 180
}
};
var HUDRedeemableCard = function HUDRedeemableCard(_ref) {
var _ref$redeemableCardFr = _ref.redeemableCardFrontHeaderContentContainerConfigurationSettings,
redeemableCardFrontHeaderContentContainerConfigurationSettings = _ref$redeemableCardFr === void 0 ? {} : _ref$redeemableCardFr,
_ref$redeemableCardFr2 = _ref.redeemableCardFrontFooterContentContainerConfigurationSettings,
redeemableCardFrontFooterContentContainerConfigurationSettings = _ref$redeemableCardFr2 === void 0 ? {} : _ref$redeemableCardFr2,
_ref$redeemableCardBa = _ref.redeemableCardBackHeaderContentContainerConfigurationSettings,
redeemableCardBackHeaderContentContainerConfigurationSettings = _ref$redeemableCardBa === void 0 ? {} : _ref$redeemableCardBa,
_ref$redeemableCardBa2 = _ref.redeemableCardBackFooterContentContainerConfigurationSettings,
redeemableCardBackFooterContentContainerConfigurationSettings = _ref$redeemableCardBa2 === void 0 ? {} : _ref$redeemableCardBa2,
_ref$redeemableCardFr3 = _ref.redeemableCardFrontContentContainerConfigurationSettings,
redeemableCardFrontContentContainerConfigurationSettings = _ref$redeemableCardFr3 === void 0 ? {} : _ref$redeemableCardFr3,
_ref$redeemableCardBa3 = _ref.redeemableCardBackContentContainerConfigurationSettings,
redeemableCardBackContentContainerConfigurationSettings = _ref$redeemableCardBa3 === void 0 ? {} : _ref$redeemableCardBa3,
_ref$redeemableCardFr4 = _ref.redeemableCardFrontContainerConfigurationSettings,
redeemableCardFrontContainerConfigurationSettings = _ref$redeemableCardFr4 === void 0 ? {} : _ref$redeemableCardFr4,
_ref$redeemableCardBa4 = _ref.redeemableCardBackContainerConfigurationSettings,
redeemableCardBackContainerConfigurationSettings = _ref$redeemableCardBa4 === void 0 ? {} : _ref$redeemableCardBa4,
_ref$redeemableCardFr5 = _ref.redeemableCardFrontContentConfigurationSettings,
redeemableCardFrontContentConfigurationSettings = _ref$redeemableCardFr5 === void 0 ? {} : _ref$redeemableCardFr5,
_ref$redeemableCardBa5 = _ref.redeemableCardBackContentConfigurationSettings,
redeemableCardBackContentConfigurationSettings = _ref$redeemableCardBa5 === void 0 ? {} : _ref$redeemableCardBa5,
_ref$redeemableCardDe = _ref.redeemableCardDescriptionConfigurationSettings,
redeemableCardDescriptionConfigurationSettings = _ref$redeemableCardDe === void 0 ? {} : _ref$redeemableCardDe,
_ref$redeemableCardCo = _ref.redeemableCardContainerConfigurationSettings,
redeemableCardContainerConfigurationSettings = _ref$redeemableCardCo === void 0 ? {} : _ref$redeemableCardCo,
_ref$redeemableCardCo2 = _ref.redeemableCardCodeConfigurationSettings,
redeemableCardCodeConfigurationSettings = _ref$redeemableCardCo2 === void 0 ? {} : _ref$redeemableCardCo2,
_ref$redeemableCardCo3 = _ref.redeemableCardConfigurationSettings,
redeemableCardConfigurationSettings = _ref$redeemableCardCo3 === void 0 ? {} : _ref$redeemableCardCo3,
_ref$redeemableCardFr6 = _ref.redeemableCardFrontHeaderContentContainerConfigurations,
redeemableCardFrontHeaderContentContainerConfigurations = _ref$redeemableCardFr6 === void 0 ? {} : _ref$redeemableCardFr6,
_ref$redeemableCardFr7 = _ref.redeemableCardFrontFooterContentContainerConfigurations,
redeemableCardFrontFooterContentContainerConfigurations = _ref$redeemableCardFr7 === void 0 ? {} : _ref$redeemableCardFr7,
_ref$redeemableCardBa6 = _ref.redeemableCardBackHeaderContentContainerConfigurations,
redeemableCardBackHeaderContentContainerConfigurations = _ref$redeemableCardBa6 === void 0 ? {} : _ref$redeemableCardBa6,
_ref$redeemableCardBa7 = _ref.redeemableCardBackFooterContentContainerConfigurations,
redeemableCardBackFooterContentContainerConfigurations = _ref$redeemableCardBa7 === void 0 ? {} : _ref$redeemableCardBa7,
_ref$redeemableCardFr8 = _ref.redeemableCardFrontContentContainerConfigurations,
redeemableCardFrontContentContainerConfigurations = _ref$redeemableCardFr8 === void 0 ? {} : _ref$redeemableCardFr8,
_ref$redeemableCardBa8 = _ref.redeemableCardBackContentContainerConfigurations,
redeemableCardBackContentContainerConfigurations = _ref$redeemableCardBa8 === void 0 ? {} : _ref$redeemableCardBa8,
_ref$redeemableCardFr9 = _ref.redeemableCardFrontContentConfigurations,
redeemableCardFrontContentConfigurations = _ref$redeemableCardFr9 === void 0 ? {} : _ref$redeemableCardFr9,
_ref$redeemableCardBa9 = _ref.redeemableCardBackContentConfigurations,
redeemableCardBackContentConfigurations = _ref$redeemableCardBa9 === void 0 ? {} : _ref$redeemableCardBa9,
_ref$redeemableCardDe2 = _ref.redeemableCardDescriptionConfigurations,
redeemableCardDescriptionConfigurations = _ref$redeemableCardDe2 === void 0 ? {} : _ref$redeemableCardDe2,
_ref$redeemableCardCo4 = _ref.redeemableCardCodeConfigurations,
redeemableCardCodeConfigurations = _ref$redeemableCardCo4 === void 0 ? {} : _ref$redeemableCardCo4,
backgroundContent = _ref.backgroundContent,
foregroundContent = _ref.foregroundContent,
frontContent = _ref.frontContent,
backContent = _ref.backContent,
topFrontContent = _ref.topFrontContent,
bottomFrontContent = _ref.bottomFrontContent,
topBackContent = _ref.topBackContent,
bottomBackContent = _ref.bottomBackContent,
frontHeaderContent = _ref.frontHeaderContent,
frontFooterContent = _ref.frontFooterContent,
backHeaderContent = _ref.backHeaderContent,
backFooterContent = _ref.backFooterContent,
_ref$flipOnClick = _ref.flipOnClick,
flipOnClick = _ref$flipOnClick === void 0 ? false : _ref$flipOnClick,
_ref$description = _ref.description,
description = _ref$description === void 0 ? "Redeem this code in your game or platform of choice." : _ref$description,
code = _ref.code;
var _useState = useState(false),
_useState2 = _slicedToArray(_useState, 2),
flipped = _useState2[0],
setFlipped = _useState2[1];
var handleFlip = function handleFlip() {
if (flipOnClick) {
setFlipped(!flipped);
}
};
return /*#__PURE__*/React.createElement("div", {
style: _objectSpread({
position: "relative",
display: "flex",
flexDirection: "column",
alignItems: "center",
overflow: "hidden",
cursor: flipOnClick ? "pointer" : "default",
perspective: "1000px",
borderRadius: "1rem",
maxWidth: "37.69rem",
height: "30.169rem",
width: "100%"
}, redeemableCardContainerConfigurationSettings !== null && redeemableCardContainerConfigurationSettings !== void 0 ? redeemableCardContainerConfigurationSettings : {}),
onClick: handleFlip
}, /*#__PURE__*/React.createElement(motion.div, {
animate: flipped ? "back" : "front",
variants: flipVariants,
initial: "front",
style: _objectSpread({
position: "absolute",
transition: "transform 0.7s",
transformStyle: "preserve-3d",
borderRadius: "1rem",
boxShadow: "0 15px 30px rgba(0, 0, 0, 0.2)",
backgroundColor: "black",
height: "87.69%",
width: "100%",
scale: "0.8269",
marginTop: "1.70969rem"
}, redeemableCardConfigurationSettings !== null && redeemableCardConfigurationSettings !== void 0 ? redeemableCardConfigurationSettings : {})
}, backgroundContent, /*#__PURE__*/React.createElement("div", {
style: _objectSpread({
position: "absolute",
display: "flex",
flexDirection: "column",
justifyContent: "space-between",
transform: "rotateY(0deg)",
backfaceVisibility: "hidden",
borderRadius: "1rem",
color: "white",
height: "100%",
width: "auto",
margin: "0.69rem"
}, redeemableCardFrontContainerConfigurationSettings !== null && redeemableCardFrontContainerConfigurationSettings !== void 0 ? redeemableCardFrontContainerConfigurationSettings : {})
}, frontHeaderContent && /*#__PURE__*/React.createElement("div", _extends({
style: _objectSpread({
display: "flex",
justifyContent: "center",
alignItems: "center",
width: "100%"
}, redeemableCardFrontHeaderContentContainerConfigurationSettings !== null && redeemableCardFrontHeaderContentContainerConfigurationSettings !== void 0 ? redeemableCardFrontHeaderContentContainerConfigurationSettings : {})
}, redeemableCardFrontHeaderContentContainerConfigurations !== null && redeemableCardFrontHeaderContentContainerConfigurations !== void 0 ? redeemableCardFrontHeaderContentContainerConfigurations : {}), frontHeaderContent), /*#__PURE__*/React.createElement("div", _extends({
style: _objectSpread({
display: "flex",
flexGrow: 1,
justifyContent: "center",
alignItems: "center"
}, redeemableCardFrontContentContainerConfigurationSettings !== null && redeemableCardFrontContentContainerConfigurationSettings !== void 0 ? redeemableCardFrontContentContainerConfigurationSettings : {})
}, redeemableCardFrontContentContainerConfigurations !== null && redeemableCardFrontContentContainerConfigurations !== void 0 ? redeemableCardFrontContentContainerConfigurations : {}), frontContent || /*#__PURE__*/React.createElement("div", _extends({
style: _objectSpread({
textAlign: "center"
}, redeemableCardFrontContentConfigurationSettings !== null && redeemableCardFrontContentConfigurationSettings !== void 0 ? redeemableCardFrontContentConfigurationSettings : {})
}, redeemableCardFrontContentConfigurations !== null && redeemableCardFrontContentConfigurations !== void 0 ? redeemableCardFrontContentConfigurations : {}), topFrontContent, /*#__PURE__*/React.createElement("div", _extends({
style: _objectSpread({
letterSpacing: "0.25em",
fontWeight: "bold",
fontSize: "1.5rem"
}, redeemableCardCodeConfigurationSettings !== null && redeemableCardCodeConfigurationSettings !== void 0 ? redeemableCardCodeConfigurationSettings : {})
}, redeemableCardCodeConfigurations !== null && redeemableCardCodeConfigurations !== void 0 ? redeemableCardCodeConfigurations : {}), code), bottomFrontContent)), frontFooterContent && /*#__PURE__*/React.createElement("div", _extends({
style: _objectSpread({
width: "100%",
marginBottom: "1.369rem"
}, redeemableCardFrontFooterContentContainerConfigurationSettings !== null && redeemableCardFrontFooterContentContainerConfigurationSettings !== void 0 ? redeemableCardFrontFooterContentContainerConfigurationSettings : {})
}, redeemableCardFrontFooterContentContainerConfigurations !== null && redeemableCardFrontFooterContentContainerConfigurations !== void 0 ? redeemableCardFrontFooterContentContainerConfigurations : {}), frontFooterContent)), /*#__PURE__*/React.createElement("div", {
style: _objectSpread({
position: "absolute",
display: "flex",
flexDirection: "column",
justifyContent: "space-between",
overflow: "hidden",
transform: "rotateY(180deg)",
backfaceVisibility: "hidden",
borderRadius: "1rem",
color: "white",
height: "100%",
width: "100%"
}, redeemableCardBackContainerConfigurationSettings !== null && redeemableCardBackContainerConfigurationSettings !== void 0 ? redeemableCardBackContainerConfigurationSettings : {})
}, backHeaderContent && /*#__PURE__*/React.createElement("div", _extends({
style: _objectSpread({
width: "100%",
paddingTop: "1rem"
}, redeemableCardBackHeaderContentContainerConfigurationSettings !== null && redeemableCardBackHeaderContentContainerConfigurationSettings !== void 0 ? redeemableCardBackHeaderContentContainerConfigurationSettings : {})
}, redeemableCardBackHeaderContentContainerConfigurations !== null && redeemableCardBackHeaderContentContainerConfigurations !== void 0 ? redeemableCardBackHeaderContentContainerConfigurations : {}), backHeaderContent), /*#__PURE__*/React.createElement("div", _extends({
style: _objectSpread({
display: "flex",
flexGrow: 1,
justifyContent: "center",
alignItems: "center"
}, redeemableCardBackContentContainerConfigurationSettings !== null && redeemableCardBackContentContainerConfigurationSettings !== void 0 ? redeemableCardBackContentContainerConfigurationSettings : {})
}, redeemableCardBackContentContainerConfigurations !== null && redeemableCardBackContentContainerConfigurations !== void 0 ? redeemableCardBackContentContainerConfigurations : {}), backContent || /*#__PURE__*/React.createElement("div", _extends({
style: _objectSpread({
textAlign: "center",
padding: "1.5rem"
}, redeemableCardBackContentConfigurationSettings !== null && redeemableCardBackContentConfigurationSettings !== void 0 ? redeemableCardBackContentConfigurationSettings : {})
}, redeemableCardBackContentConfigurations !== null && redeemableCardBackContentConfigurations !== void 0 ? redeemableCardBackContentConfigurations : {}), topBackContent, /*#__PURE__*/React.createElement("p", _extends({
style: _objectSpread({
fontSize: "0.95rem"
}, redeemableCardDescriptionConfigurationSettings !== null && redeemableCardDescriptionConfigurationSettings !== void 0 ? redeemableCardDescriptionConfigurationSettings : {})
}, redeemableCardDescriptionConfigurations !== null && redeemableCardDescriptionConfigurations !== void 0 ? redeemableCardDescriptionConfigurations : {}), description), bottomBackContent)), backFooterContent && /*#__PURE__*/React.createElement("div", _extends({
style: _objectSpread({
width: "100%",
paddingBottom: "1rem"
}, redeemableCardBackFooterContentContainerConfigurationSettings !== null && redeemableCardBackFooterContentContainerConfigurationSettings !== void 0 ? redeemableCardBackFooterContentContainerConfigurationSettings : {})
}, redeemableCardBackFooterContentContainerConfigurations !== null && redeemableCardBackFooterContentContainerConfigurations !== void 0 ? redeemableCardBackFooterContentContainerConfigurations : {}), backFooterContent)), foregroundContent));
};
export default HUDRedeemableCard;