@ludo.ninja/components 2.4.38 → 2.4.39
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.
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
import React from "react";
|
|
2
|
+
declare const CreditsLabel: ({ value, link, loading, className, style, withIcon, }: {
|
|
2
3
|
value: number;
|
|
3
|
-
|
|
4
|
-
|
|
4
|
+
withIcon?: boolean;
|
|
5
|
+
link?: string;
|
|
6
|
+
loading?: boolean;
|
|
7
|
+
className?: string;
|
|
8
|
+
style?: React.CSSProperties;
|
|
5
9
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
6
10
|
export default CreditsLabel;
|
|
@@ -1,4 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
2
25
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
27
|
};
|
|
@@ -9,12 +32,12 @@ const ScreenWidth_1 = require("../../../styles/ScreenWidth");
|
|
|
9
32
|
const boxShadow_1 = __importDefault(require("../../../styles/mixins/boxShadow"));
|
|
10
33
|
const boxTransform_1 = __importDefault(require("../../../styles/mixins/boxTransform"));
|
|
11
34
|
const SkeletonLabel_1 = __importDefault(require("../SkeletonLabel"));
|
|
35
|
+
const constants_1 = require("@ludo.ninja/core/build/constants");
|
|
12
36
|
const _4k_1 = require("@ludo.ninja/ui/build/utils/4k");
|
|
37
|
+
const image_1 = __importDefault(require("next/image"));
|
|
13
38
|
const link_1 = __importDefault(require("next/link"));
|
|
14
|
-
const styled_components_1 =
|
|
15
|
-
|
|
16
|
-
const StyledExpTab = (0, styled_components_1.default)(link_1.default) `
|
|
17
|
-
${boxTransform_1.default};
|
|
39
|
+
const styled_components_1 = __importStar(require("styled-components"));
|
|
40
|
+
const CreditsLabelStyles = () => (0, styled_components_1.css) `
|
|
18
41
|
${boxShadow_1.default};
|
|
19
42
|
display: flex;
|
|
20
43
|
gap: 8px;
|
|
@@ -48,10 +71,19 @@ const StyledExpTab = (0, styled_components_1.default)(link_1.default) `
|
|
|
48
71
|
}
|
|
49
72
|
}
|
|
50
73
|
`;
|
|
51
|
-
|
|
52
|
-
|
|
74
|
+
const StyledCreditsLink = (0, styled_components_1.default)(link_1.default) `
|
|
75
|
+
${boxTransform_1.default};
|
|
76
|
+
${CreditsLabelStyles};
|
|
77
|
+
`;
|
|
78
|
+
const StyledCreditsTab = styled_components_1.default.div `
|
|
79
|
+
${CreditsLabelStyles};
|
|
80
|
+
`;
|
|
81
|
+
const CreditsLabel = ({ value = 0, link, loading, className, style, withIcon = false, }) => {
|
|
53
82
|
if (loading)
|
|
54
83
|
return (0, jsx_runtime_1.jsx)(SkeletonLabel_1.default, {});
|
|
55
|
-
return ((0, jsx_runtime_1.jsx)(
|
|
84
|
+
return link ? ((0, jsx_runtime_1.jsx)(StyledCreditsLink, { href: link, className: className, style: style, children: (0, jsx_runtime_1.jsx)(LabelContent, { value: value, withIcon: withIcon }) })) : ((0, jsx_runtime_1.jsx)(StyledCreditsTab, { className: className, style: style, children: (0, jsx_runtime_1.jsx)(LabelContent, { value: value, withIcon: withIcon }) }));
|
|
85
|
+
};
|
|
86
|
+
const LabelContent = ({ value, withIcon }) => {
|
|
87
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [withIcon && (0, jsx_runtime_1.jsx)(image_1.default, { src: `${constants_1.staticLink}/public/credits_icon.svg`, alt: "Credits icon", width: 20, height: 20 }), (0, jsx_runtime_1.jsx)("p", { className: `value `, children: `${value} credit${value !== 1 ? 's' : ''}` })] }));
|
|
56
88
|
};
|
|
57
89
|
exports.default = CreditsLabel;
|