@ludo.ninja/components 2.0.17 → 2.0.18

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.
@@ -0,0 +1,33 @@
1
+ interface IShareDialog {
2
+ link: string | null;
3
+ onHide: () => void;
4
+ params?: {
5
+ email?: {
6
+ body?: string;
7
+ separator?: string;
8
+ subject?: string;
9
+ };
10
+ telegram?: {
11
+ title?: string;
12
+ };
13
+ whatsapp?: {
14
+ title?: string;
15
+ separator?: string;
16
+ };
17
+ twitter?: {
18
+ title?: string;
19
+ via?: string;
20
+ hashtags?: string[];
21
+ related?: string[];
22
+ };
23
+ reddit?: {
24
+ title?: string;
25
+ };
26
+ facebook?: {
27
+ quote?: string;
28
+ hashtag?: string;
29
+ };
30
+ };
31
+ }
32
+ declare const ShareDialog: ({ link, onHide, params }: IShareDialog) => import("react/jsx-runtime").JSX.Element;
33
+ export default ShareDialog;
@@ -0,0 +1,99 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const jsx_runtime_1 = require("react/jsx-runtime");
7
+ const react_share_1 = require("react-share");
8
+ const styled_components_1 = __importDefault(require("styled-components"));
9
+ const type_1 = require("@ludo.ninja/ui/build/system/Alert/type");
10
+ const _4k_1 = require("@ludo.ninja/ui/build/utils/4k");
11
+ const utils_1 = require("@ludo.ninja/utils");
12
+ const ui_1 = require("../../store/ui");
13
+ const ScreenWidth_1 = require("../../styles/ScreenWidth");
14
+ const colors_1 = require("../../styles/colors");
15
+ const index_1 = require("../../system/index");
16
+ // import CopyIcon from '@/public/share/copy-link-btn.svg';
17
+ // import EmailIcon from '@/public/share/email-btn.svg';
18
+ // import FacebookIcon from '@/public/share/facebook-btn.svg';
19
+ // import InstagramIcon from '@/public/share/insta-btn.svg';
20
+ // import RedditIcon from '@/public/share/reddit-btn.svg';
21
+ // import TelegramIcon from '@/public/share/telegram-btn.svg';
22
+ // import TwitterIcon from '@/public/share/twitter-btn.svg';
23
+ // import WatsUpIcon from '@/public/share/whatsapp-btn.svg';
24
+ // Styles
25
+ const STitle = (0, styled_components_1.default)(index_1.H1) `
26
+ margin-bottom: 24px;
27
+ color: ${colors_1.BlackColor};
28
+ ${ScreenWidth_1.mediaQuery.minWidthFourK} {
29
+ margin-bottom: ${(0, _4k_1.adaptiveValueCalc)(24)};
30
+ }
31
+ `;
32
+ const StyledShare = styled_components_1.default.div `
33
+ .shareButtons {
34
+ display: grid;
35
+ grid-template-columns: 1fr 1fr 1fr 1fr;
36
+ row-gap: 24px;
37
+ column-gap: 16px;
38
+ margin: 0 43px 33px 43px;
39
+ justify-content: center;
40
+
41
+ ${ScreenWidth_1.mediaQuery.mobile} {
42
+ grid-template-columns: 1fr 1fr;
43
+ justify-items: center;
44
+ align-items: center;
45
+ }
46
+ }
47
+
48
+ .shareBtn {
49
+ width: 108px;
50
+ height: 64px;
51
+ display: flex;
52
+ align-items: center;
53
+ justify-content: space-between;
54
+ flex-direction: column;
55
+ cursor: pointer;
56
+ border: none;
57
+ background-color: transparent;
58
+
59
+ img {
60
+ width: 40px;
61
+ height: 40px;
62
+ }
63
+ }
64
+
65
+ ${ScreenWidth_1.mediaQuery.minWidthFourK} {
66
+ .shareButtons {
67
+ row-gap: ${(0, _4k_1.adaptiveValueCalc)(24)};
68
+ column-gap: ${(0, _4k_1.adaptiveValueCalc)(16)};
69
+ margin: 0 ${(0, _4k_1.adaptiveValueCalc)(43)} ${(0, _4k_1.adaptiveValueCalc)(33)}
70
+ ${(0, _4k_1.adaptiveValueCalc)(43)};
71
+ }
72
+
73
+ .shareBtn {
74
+ width: ${(0, _4k_1.adaptiveValueCalc)(108)};
75
+ height: ${(0, _4k_1.adaptiveValueCalc)(64)};
76
+
77
+ img {
78
+ width: ${(0, _4k_1.adaptiveValueCalc)(40)};
79
+ height: ${(0, _4k_1.adaptiveValueCalc)(40)};
80
+ }
81
+ }
82
+ }
83
+ `;
84
+ const ShareDialog = ({ link, onHide, params }) => {
85
+ const url = new URL(link || '');
86
+ url.search = '';
87
+ const urlWithoutGetParameters = url.toString();
88
+ const openAlert = (0, ui_1.useUiStore)((state) => state.openAlert);
89
+ return ((0, jsx_runtime_1.jsxs)(StyledShare, { children: [(0, jsx_runtime_1.jsx)(index_1.Flex, { alignItems: 'center', justifyContent: 'center', children: (0, jsx_runtime_1.jsx)(STitle, { children: 'Share to...' }) }), (0, jsx_runtime_1.jsxs)("div", { className: "shareButtons", children: [(0, jsx_runtime_1.jsxs)("button", { onClick: () => {
90
+ onHide();
91
+ (0, utils_1.copyToClipboard)(urlWithoutGetParameters).then(() => {
92
+ openAlert({
93
+ type: type_1.alertVariants.copied,
94
+ });
95
+ });
96
+ }, className: 'shareBtn', children: [(0, jsx_runtime_1.jsx)("img", { src: "/share/copy-link-btn.svg", alt: "share", height: 40, width: 40 }), (0, jsx_runtime_1.jsx)(index_1.H5, { color: colors_1.TextGrayColor, children: "Copy Link" })] }), (0, jsx_runtime_1.jsxs)(react_share_1.EmailShareButton, { url: urlWithoutGetParameters, body: params?.email?.body, separator: params?.email?.separator, subject: params?.email?.subject, className: "shareBtn", onClick: onHide, children: [(0, jsx_runtime_1.jsx)("img", { src: "/share/email-btn.svg", alt: "email", height: 40, width: 40 }), (0, jsx_runtime_1.jsx)(index_1.H5, { color: colors_1.TextGrayColor, children: "Email" })] }), (0, jsx_runtime_1.jsxs)(react_share_1.TelegramShareButton, { url: urlWithoutGetParameters, title: params?.telegram?.title, className: "shareBtn", onClick: onHide, children: [(0, jsx_runtime_1.jsx)("img", { src: "/share/telegram-btn.svg", alt: "telegram", height: 40, width: 40 }), (0, jsx_runtime_1.jsx)(index_1.H5, { color: colors_1.TextGrayColor, children: "Telegram" })] }), (0, jsx_runtime_1.jsxs)(react_share_1.WhatsappShareButton, { url: urlWithoutGetParameters, title: params?.whatsapp?.title, separator: params?.whatsapp?.separator, className: "shareBtn", onClick: onHide, children: [(0, jsx_runtime_1.jsx)("img", { src: "/share/whatsapp-btn.svg", alt: "whatsapp", height: 40, width: 40 }), (0, jsx_runtime_1.jsx)(index_1.H5, { color: colors_1.TextGrayColor, children: "WhatsApp" })] }), (0, jsx_runtime_1.jsxs)(react_share_1.TwitterShareButton, { url: urlWithoutGetParameters, title: params?.twitter?.title, via: params?.twitter?.via, related: params?.twitter?.related, hashtags: params?.twitter?.hashtags, className: "shareBtn", onClick: onHide, children: [(0, jsx_runtime_1.jsx)("img", { src: "/share/twitter-btn.svg", alt: "twitter", width: 40, height: 40 }), (0, jsx_runtime_1.jsx)(index_1.H5, { color: colors_1.TextGrayColor, children: "Twitter" })] }), (0, jsx_runtime_1.jsxs)(react_share_1.RedditShareButton, { url: urlWithoutGetParameters, title: params?.reddit?.title, className: "shareBtn", onClick: onHide, children: [(0, jsx_runtime_1.jsx)("img", { src: "/share/reddit-btn.svg", alt: "reddit", width: 40, height: 40 }), (0, jsx_runtime_1.jsx)(index_1.H5, { color: colors_1.TextGrayColor, children: "Reddit" })] }), (0, jsx_runtime_1.jsxs)(react_share_1.FacebookShareButton, { url: urlWithoutGetParameters, quote: params?.facebook?.quote || 'My cool NFT', hashtag: params?.facebook?.hashtag || '#ludo', className: "shareBtn", onClick: onHide, children: [(0, jsx_runtime_1.jsx)("img", { src: "/share/facebook-btn.svg", alt: "facebook", width: 40, height: 40 }), (0, jsx_runtime_1.jsx)(index_1.H5, { color: colors_1.TextGrayColor, children: "Facebook" })] })] })] }));
97
+ };
98
+ // Export
99
+ exports.default = ShareDialog;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ludo.ninja/components",
3
- "version": "2.0.17",
3
+ "version": "2.0.18",
4
4
  "private": false,
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",