@vaneui/ui 0.0.1 → 0.0.3
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.
- package/.github/workflows/npm-publish.yml +65 -0
- package/README.md +4 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/rollup.config.mjs +22 -22
- package/src/components/complex/sharer.tsx +220 -220
- package/src/components/ui/badge.tsx +31 -31
- package/src/components/ui/chip.tsx +29 -29
- package/src/components/ui/commonValues.ts +51 -51
- package/src/components/ui/divider.tsx +7 -7
- package/src/components/ui/layout.tsx +102 -102
- package/src/components/ui/props.ts +128 -128
- package/src/components/ui/settings.ts +19 -19
- package/src/components/ui/typography.tsx +97 -97
- package/src/components/ui/utils.tsx +124 -124
- package/src/index.ts +6 -6
- package/tsconfig.json +15 -15
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaneui/ui",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -51,8 +51,8 @@
|
|
|
51
51
|
"author": "",
|
|
52
52
|
"license": "ISC",
|
|
53
53
|
"peerDependencies": {
|
|
54
|
-
"react": "^16.8.0 || ^17.0.0 || ^18.0.0",
|
|
55
|
-
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0"
|
|
54
|
+
"react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
|
|
55
|
+
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
58
|
"@rollup/plugin-commonjs": "^28.0.2",
|
package/rollup.config.mjs
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import peerDepsExternal from "rollup-plugin-peer-deps-external";
|
|
2
|
-
import resolve from "@rollup/plugin-node-resolve";
|
|
3
|
-
import commonjs from "@rollup/plugin-commonjs";
|
|
4
|
-
import typescript from "@rollup/plugin-typescript";
|
|
5
|
-
import pkg from "./package.json";
|
|
6
|
-
|
|
7
|
-
export default {
|
|
8
|
-
input: "src/index.ts", // your library entry point
|
|
9
|
-
output: [
|
|
10
|
-
{
|
|
11
|
-
file: pkg.main,
|
|
12
|
-
format: "cjs",
|
|
13
|
-
sourcemap: true,
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
file: pkg.module,
|
|
17
|
-
format: "esm",
|
|
18
|
-
sourcemap: true,
|
|
19
|
-
},
|
|
20
|
-
],
|
|
21
|
-
plugins: [peerDepsExternal(), resolve(), commonjs(), typescript({ tsconfig: "./tsconfig.json" })],
|
|
22
|
-
};
|
|
1
|
+
import peerDepsExternal from "rollup-plugin-peer-deps-external";
|
|
2
|
+
import resolve from "@rollup/plugin-node-resolve";
|
|
3
|
+
import commonjs from "@rollup/plugin-commonjs";
|
|
4
|
+
import typescript from "@rollup/plugin-typescript";
|
|
5
|
+
import pkg from "./package.json";
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
input: "src/index.ts", // your library entry point
|
|
9
|
+
output: [
|
|
10
|
+
{
|
|
11
|
+
file: pkg.main,
|
|
12
|
+
format: "cjs",
|
|
13
|
+
sourcemap: true,
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
file: pkg.module,
|
|
17
|
+
format: "esm",
|
|
18
|
+
sourcemap: true,
|
|
19
|
+
},
|
|
20
|
+
],
|
|
21
|
+
plugins: [peerDepsExternal(), resolve(), commonjs(), typescript({ tsconfig: "./tsconfig.json" })],
|
|
22
|
+
};
|
|
@@ -1,220 +1,220 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import React from 'react';
|
|
4
|
-
|
|
5
|
-
type Platform = 'fb' | 'li' | 'x' | 'th' | 'em' | 'wa' | 'tg' | 're';
|
|
6
|
-
|
|
7
|
-
interface SocialShareCommonProps {
|
|
8
|
-
url?: string;
|
|
9
|
-
text?: string;
|
|
10
|
-
width?: number;
|
|
11
|
-
height?: number;
|
|
12
|
-
isLink?: boolean;
|
|
13
|
-
isBlank?: boolean;
|
|
14
|
-
platforms?: Platform[];
|
|
15
|
-
containerComponent?: React.ElementType;
|
|
16
|
-
buttonComponent?: React.ElementType;
|
|
17
|
-
buttonComponents?: Partial<Record<Platform, React.ElementType>>;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
interface FacebookShareProps {
|
|
21
|
-
hashtag?: string;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
interface TwitterShareProps {
|
|
25
|
-
hashtags?: string;
|
|
26
|
-
via?: string;
|
|
27
|
-
related?: string;
|
|
28
|
-
inReplyTo?: string;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
interface EmailShareProps {
|
|
32
|
-
title?: string;
|
|
33
|
-
to?: string;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
interface WhatsAppShareProps {
|
|
37
|
-
to?: string;
|
|
38
|
-
web?: boolean;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
interface SocialShareProps extends SocialShareCommonProps {
|
|
42
|
-
facebookProps?: FacebookShareProps;
|
|
43
|
-
twitterProps?: TwitterShareProps;
|
|
44
|
-
emailProps?: EmailShareProps;
|
|
45
|
-
whatsappProps?: WhatsAppShareProps;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
interface ShareConfig {
|
|
49
|
-
shareUrl: string;
|
|
50
|
-
getParams: () => { [key: string]: string | number | boolean | undefined };
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
const buildQueryString = (
|
|
54
|
-
params: { [key: string]: string | number | boolean | undefined }
|
|
55
|
-
): string => {
|
|
56
|
-
const validKeys = Object.keys(params).filter(
|
|
57
|
-
key => params[key] !== undefined && params[key] !== ''
|
|
58
|
-
);
|
|
59
|
-
return validKeys.length > 0
|
|
60
|
-
? '?' +
|
|
61
|
-
validKeys
|
|
62
|
-
.map(key => `${key}=${encodeURIComponent(String(params[key]))}`)
|
|
63
|
-
.join('&')
|
|
64
|
-
: '';
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
const SocialShare: React.FC<SocialShareProps> = ({
|
|
68
|
-
url = window.location.href,
|
|
69
|
-
text = '',
|
|
70
|
-
width = 600,
|
|
71
|
-
height = 480,
|
|
72
|
-
isLink = false,
|
|
73
|
-
isBlank = true,
|
|
74
|
-
platforms,
|
|
75
|
-
containerComponent,
|
|
76
|
-
buttonComponent,
|
|
77
|
-
buttonComponents,
|
|
78
|
-
facebookProps = {},
|
|
79
|
-
twitterProps = {},
|
|
80
|
-
emailProps = {},
|
|
81
|
-
whatsappProps = {},
|
|
82
|
-
}) => {
|
|
83
|
-
const shareConfigs: { [key in Platform]: ShareConfig } = {
|
|
84
|
-
fb: {
|
|
85
|
-
shareUrl: 'https://www.facebook.com/sharer/sharer.php',
|
|
86
|
-
getParams: () => ({
|
|
87
|
-
u: url,
|
|
88
|
-
hashtag: facebookProps.hashtag
|
|
89
|
-
? facebookProps.hashtag.startsWith('#')
|
|
90
|
-
? facebookProps.hashtag
|
|
91
|
-
: `#${facebookProps.hashtag}`
|
|
92
|
-
: '',
|
|
93
|
-
quote: text,
|
|
94
|
-
}),
|
|
95
|
-
},
|
|
96
|
-
li: {
|
|
97
|
-
shareUrl: 'https://www.linkedin.com/shareArticle',
|
|
98
|
-
getParams: () => ({
|
|
99
|
-
url,
|
|
100
|
-
}),
|
|
101
|
-
},
|
|
102
|
-
x: {
|
|
103
|
-
shareUrl: 'https://x.com/intent/tweet',
|
|
104
|
-
getParams: () => ({
|
|
105
|
-
text,
|
|
106
|
-
url,
|
|
107
|
-
hashtags: twitterProps.hashtags,
|
|
108
|
-
via: twitterProps.via,
|
|
109
|
-
related: twitterProps.related,
|
|
110
|
-
in_reply_to: twitterProps.inReplyTo,
|
|
111
|
-
}),
|
|
112
|
-
},
|
|
113
|
-
th: {
|
|
114
|
-
shareUrl: 'https://threads.net/intent/post',
|
|
115
|
-
getParams: () => ({
|
|
116
|
-
text: `${text} ${url}`,
|
|
117
|
-
}),
|
|
118
|
-
},
|
|
119
|
-
em: {
|
|
120
|
-
shareUrl: 'mailto:' + (emailProps.to || ''),
|
|
121
|
-
getParams: () => ({
|
|
122
|
-
subject: emailProps.title,
|
|
123
|
-
body: `${text}\n${url}`,
|
|
124
|
-
}),
|
|
125
|
-
},
|
|
126
|
-
wa: {
|
|
127
|
-
shareUrl: whatsappProps.web
|
|
128
|
-
? 'https://web.whatsapp.com/send'
|
|
129
|
-
: 'https://wa.me/',
|
|
130
|
-
getParams: () => ({
|
|
131
|
-
phone: whatsappProps.to,
|
|
132
|
-
text: `${text} ${url}`,
|
|
133
|
-
}),
|
|
134
|
-
},
|
|
135
|
-
tg: {
|
|
136
|
-
shareUrl: 'https://t.me/share',
|
|
137
|
-
getParams: () => ({
|
|
138
|
-
text,
|
|
139
|
-
url,
|
|
140
|
-
}),
|
|
141
|
-
},
|
|
142
|
-
re: {
|
|
143
|
-
shareUrl: 'https://www.reddit.com/submit',
|
|
144
|
-
getParams: () => ({
|
|
145
|
-
url,
|
|
146
|
-
title: text,
|
|
147
|
-
}),
|
|
148
|
-
},
|
|
149
|
-
};
|
|
150
|
-
|
|
151
|
-
const platformLabels: { [key in Platform]: string } = {
|
|
152
|
-
fb: 'Facebook',
|
|
153
|
-
li: 'LinkedIn',
|
|
154
|
-
x: 'X',
|
|
155
|
-
th: 'Threads',
|
|
156
|
-
em: 'Email',
|
|
157
|
-
wa: 'WhatsApp',
|
|
158
|
-
tg: 'Telegram',
|
|
159
|
-
re: 'Reddit',
|
|
160
|
-
};
|
|
161
|
-
|
|
162
|
-
const buildShareUrl = (config: ShareConfig): string => {
|
|
163
|
-
const params = config.getParams();
|
|
164
|
-
const queryString = buildQueryString(params);
|
|
165
|
-
return config.shareUrl + queryString;
|
|
166
|
-
};
|
|
167
|
-
|
|
168
|
-
const openShareWindow = (shareUrl: string): void => {
|
|
169
|
-
if (isLink) {
|
|
170
|
-
if (isBlank) {
|
|
171
|
-
window.open(shareUrl, '_blank');
|
|
172
|
-
} else {
|
|
173
|
-
window.location.href = shareUrl;
|
|
174
|
-
}
|
|
175
|
-
} else {
|
|
176
|
-
const left = window.innerWidth / 2 - width / 2 + window.screenX;
|
|
177
|
-
const top = window.innerHeight / 2 - height / 2 + window.screenY;
|
|
178
|
-
const popParams = `scrollbars=no, width=${width}, height=${height}, top=${top}, left=${left}`;
|
|
179
|
-
const newWindow = window.open(shareUrl, '', popParams);
|
|
180
|
-
if (newWindow) {
|
|
181
|
-
newWindow.focus();
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
};
|
|
185
|
-
|
|
186
|
-
const handleShare = (key: Platform): void => {
|
|
187
|
-
const config = shareConfigs[key];
|
|
188
|
-
if (!config) return;
|
|
189
|
-
const shareUrl = buildShareUrl(config);
|
|
190
|
-
openShareWindow(shareUrl);
|
|
191
|
-
};
|
|
192
|
-
|
|
193
|
-
// Use the provided container component or default to 'div'
|
|
194
|
-
const Container = containerComponent || 'div';
|
|
195
|
-
// Default button component to use if no platform-specific component is provided
|
|
196
|
-
const DefaultButton = buttonComponent || 'button';
|
|
197
|
-
const platformsToShow: Platform[] =
|
|
198
|
-
platforms || (Object.keys(shareConfigs) as Platform[]);
|
|
199
|
-
|
|
200
|
-
return (
|
|
201
|
-
<Container>
|
|
202
|
-
{platformsToShow.map(key => {
|
|
203
|
-
// Use a specific button component if defined for the key
|
|
204
|
-
const Button = (buttonComponents && buttonComponents[key]) || DefaultButton;
|
|
205
|
-
const label = platformLabels[key] || key;
|
|
206
|
-
return (
|
|
207
|
-
<Button
|
|
208
|
-
key={key}
|
|
209
|
-
onClick={() => handleShare(key)}
|
|
210
|
-
title={`Share on ${label}`}
|
|
211
|
-
>
|
|
212
|
-
{label}
|
|
213
|
-
</Button>
|
|
214
|
-
);
|
|
215
|
-
})}
|
|
216
|
-
</Container>
|
|
217
|
-
);
|
|
218
|
-
};
|
|
219
|
-
|
|
220
|
-
export default SocialShare;
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import React from 'react';
|
|
4
|
+
|
|
5
|
+
type Platform = 'fb' | 'li' | 'x' | 'th' | 'em' | 'wa' | 'tg' | 're';
|
|
6
|
+
|
|
7
|
+
interface SocialShareCommonProps {
|
|
8
|
+
url?: string;
|
|
9
|
+
text?: string;
|
|
10
|
+
width?: number;
|
|
11
|
+
height?: number;
|
|
12
|
+
isLink?: boolean;
|
|
13
|
+
isBlank?: boolean;
|
|
14
|
+
platforms?: Platform[];
|
|
15
|
+
containerComponent?: React.ElementType;
|
|
16
|
+
buttonComponent?: React.ElementType;
|
|
17
|
+
buttonComponents?: Partial<Record<Platform, React.ElementType>>;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
interface FacebookShareProps {
|
|
21
|
+
hashtag?: string;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
interface TwitterShareProps {
|
|
25
|
+
hashtags?: string;
|
|
26
|
+
via?: string;
|
|
27
|
+
related?: string;
|
|
28
|
+
inReplyTo?: string;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
interface EmailShareProps {
|
|
32
|
+
title?: string;
|
|
33
|
+
to?: string;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
interface WhatsAppShareProps {
|
|
37
|
+
to?: string;
|
|
38
|
+
web?: boolean;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
interface SocialShareProps extends SocialShareCommonProps {
|
|
42
|
+
facebookProps?: FacebookShareProps;
|
|
43
|
+
twitterProps?: TwitterShareProps;
|
|
44
|
+
emailProps?: EmailShareProps;
|
|
45
|
+
whatsappProps?: WhatsAppShareProps;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
interface ShareConfig {
|
|
49
|
+
shareUrl: string;
|
|
50
|
+
getParams: () => { [key: string]: string | number | boolean | undefined };
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const buildQueryString = (
|
|
54
|
+
params: { [key: string]: string | number | boolean | undefined }
|
|
55
|
+
): string => {
|
|
56
|
+
const validKeys = Object.keys(params).filter(
|
|
57
|
+
key => params[key] !== undefined && params[key] !== ''
|
|
58
|
+
);
|
|
59
|
+
return validKeys.length > 0
|
|
60
|
+
? '?' +
|
|
61
|
+
validKeys
|
|
62
|
+
.map(key => `${key}=${encodeURIComponent(String(params[key]))}`)
|
|
63
|
+
.join('&')
|
|
64
|
+
: '';
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
const SocialShare: React.FC<SocialShareProps> = ({
|
|
68
|
+
url = window.location.href,
|
|
69
|
+
text = '',
|
|
70
|
+
width = 600,
|
|
71
|
+
height = 480,
|
|
72
|
+
isLink = false,
|
|
73
|
+
isBlank = true,
|
|
74
|
+
platforms,
|
|
75
|
+
containerComponent,
|
|
76
|
+
buttonComponent,
|
|
77
|
+
buttonComponents,
|
|
78
|
+
facebookProps = {},
|
|
79
|
+
twitterProps = {},
|
|
80
|
+
emailProps = {},
|
|
81
|
+
whatsappProps = {},
|
|
82
|
+
}) => {
|
|
83
|
+
const shareConfigs: { [key in Platform]: ShareConfig } = {
|
|
84
|
+
fb: {
|
|
85
|
+
shareUrl: 'https://www.facebook.com/sharer/sharer.php',
|
|
86
|
+
getParams: () => ({
|
|
87
|
+
u: url,
|
|
88
|
+
hashtag: facebookProps.hashtag
|
|
89
|
+
? facebookProps.hashtag.startsWith('#')
|
|
90
|
+
? facebookProps.hashtag
|
|
91
|
+
: `#${facebookProps.hashtag}`
|
|
92
|
+
: '',
|
|
93
|
+
quote: text,
|
|
94
|
+
}),
|
|
95
|
+
},
|
|
96
|
+
li: {
|
|
97
|
+
shareUrl: 'https://www.linkedin.com/shareArticle',
|
|
98
|
+
getParams: () => ({
|
|
99
|
+
url,
|
|
100
|
+
}),
|
|
101
|
+
},
|
|
102
|
+
x: {
|
|
103
|
+
shareUrl: 'https://x.com/intent/tweet',
|
|
104
|
+
getParams: () => ({
|
|
105
|
+
text,
|
|
106
|
+
url,
|
|
107
|
+
hashtags: twitterProps.hashtags,
|
|
108
|
+
via: twitterProps.via,
|
|
109
|
+
related: twitterProps.related,
|
|
110
|
+
in_reply_to: twitterProps.inReplyTo,
|
|
111
|
+
}),
|
|
112
|
+
},
|
|
113
|
+
th: {
|
|
114
|
+
shareUrl: 'https://threads.net/intent/post',
|
|
115
|
+
getParams: () => ({
|
|
116
|
+
text: `${text} ${url}`,
|
|
117
|
+
}),
|
|
118
|
+
},
|
|
119
|
+
em: {
|
|
120
|
+
shareUrl: 'mailto:' + (emailProps.to || ''),
|
|
121
|
+
getParams: () => ({
|
|
122
|
+
subject: emailProps.title,
|
|
123
|
+
body: `${text}\n${url}`,
|
|
124
|
+
}),
|
|
125
|
+
},
|
|
126
|
+
wa: {
|
|
127
|
+
shareUrl: whatsappProps.web
|
|
128
|
+
? 'https://web.whatsapp.com/send'
|
|
129
|
+
: 'https://wa.me/',
|
|
130
|
+
getParams: () => ({
|
|
131
|
+
phone: whatsappProps.to,
|
|
132
|
+
text: `${text} ${url}`,
|
|
133
|
+
}),
|
|
134
|
+
},
|
|
135
|
+
tg: {
|
|
136
|
+
shareUrl: 'https://t.me/share',
|
|
137
|
+
getParams: () => ({
|
|
138
|
+
text,
|
|
139
|
+
url,
|
|
140
|
+
}),
|
|
141
|
+
},
|
|
142
|
+
re: {
|
|
143
|
+
shareUrl: 'https://www.reddit.com/submit',
|
|
144
|
+
getParams: () => ({
|
|
145
|
+
url,
|
|
146
|
+
title: text,
|
|
147
|
+
}),
|
|
148
|
+
},
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
const platformLabels: { [key in Platform]: string } = {
|
|
152
|
+
fb: 'Facebook',
|
|
153
|
+
li: 'LinkedIn',
|
|
154
|
+
x: 'X',
|
|
155
|
+
th: 'Threads',
|
|
156
|
+
em: 'Email',
|
|
157
|
+
wa: 'WhatsApp',
|
|
158
|
+
tg: 'Telegram',
|
|
159
|
+
re: 'Reddit',
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
const buildShareUrl = (config: ShareConfig): string => {
|
|
163
|
+
const params = config.getParams();
|
|
164
|
+
const queryString = buildQueryString(params);
|
|
165
|
+
return config.shareUrl + queryString;
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
const openShareWindow = (shareUrl: string): void => {
|
|
169
|
+
if (isLink) {
|
|
170
|
+
if (isBlank) {
|
|
171
|
+
window.open(shareUrl, '_blank');
|
|
172
|
+
} else {
|
|
173
|
+
window.location.href = shareUrl;
|
|
174
|
+
}
|
|
175
|
+
} else {
|
|
176
|
+
const left = window.innerWidth / 2 - width / 2 + window.screenX;
|
|
177
|
+
const top = window.innerHeight / 2 - height / 2 + window.screenY;
|
|
178
|
+
const popParams = `scrollbars=no, width=${width}, height=${height}, top=${top}, left=${left}`;
|
|
179
|
+
const newWindow = window.open(shareUrl, '', popParams);
|
|
180
|
+
if (newWindow) {
|
|
181
|
+
newWindow.focus();
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
const handleShare = (key: Platform): void => {
|
|
187
|
+
const config = shareConfigs[key];
|
|
188
|
+
if (!config) return;
|
|
189
|
+
const shareUrl = buildShareUrl(config);
|
|
190
|
+
openShareWindow(shareUrl);
|
|
191
|
+
};
|
|
192
|
+
|
|
193
|
+
// Use the provided container component or default to 'div'
|
|
194
|
+
const Container = containerComponent || 'div';
|
|
195
|
+
// Default button component to use if no platform-specific component is provided
|
|
196
|
+
const DefaultButton = buttonComponent || 'button';
|
|
197
|
+
const platformsToShow: Platform[] =
|
|
198
|
+
platforms || (Object.keys(shareConfigs) as Platform[]);
|
|
199
|
+
|
|
200
|
+
return (
|
|
201
|
+
<Container>
|
|
202
|
+
{platformsToShow.map(key => {
|
|
203
|
+
// Use a specific button component if defined for the key
|
|
204
|
+
const Button = (buttonComponents && buttonComponents[key]) || DefaultButton;
|
|
205
|
+
const label = platformLabels[key] || key;
|
|
206
|
+
return (
|
|
207
|
+
<Button
|
|
208
|
+
key={key}
|
|
209
|
+
onClick={() => handleShare(key)}
|
|
210
|
+
title={`Share on ${label}`}
|
|
211
|
+
>
|
|
212
|
+
{label}
|
|
213
|
+
</Button>
|
|
214
|
+
);
|
|
215
|
+
})}
|
|
216
|
+
</Container>
|
|
217
|
+
);
|
|
218
|
+
};
|
|
219
|
+
|
|
220
|
+
export default SocialShare;
|
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { componentBuilder } from "./utils";
|
|
3
|
-
import { TypographyComponentProps } from "./props";
|
|
4
|
-
|
|
5
|
-
export const Badge: React.FC<TypographyComponentProps> = (props) =>
|
|
6
|
-
componentBuilder(props, "span", "rounded-full w-fit")
|
|
7
|
-
.withSizes({
|
|
8
|
-
xs: "px-2 py-1 text-xs",
|
|
9
|
-
sm: "px-3 py-1 text-sm",
|
|
10
|
-
md: "px-4 py-2 text-base",
|
|
11
|
-
lg: "px-5 py-2 text-lg",
|
|
12
|
-
xl: "px-6 py-3 text-xl",
|
|
13
|
-
})
|
|
14
|
-
.withAppearance({
|
|
15
|
-
default: "bg-gray-200",
|
|
16
|
-
accent: "bg-gray-200",
|
|
17
|
-
primary: "bg-blue-200",
|
|
18
|
-
secondary: "bg-gray-200",
|
|
19
|
-
tertiary: "bg-gray-200",
|
|
20
|
-
success: "bg-green-200",
|
|
21
|
-
danger: "bg-red-200",
|
|
22
|
-
warning: "bg-yellow-200",
|
|
23
|
-
info: "bg-blue-200"
|
|
24
|
-
}, {})
|
|
25
|
-
.withTypography({
|
|
26
|
-
fontWeight: { semibold: true },
|
|
27
|
-
fontFamily: { mono: true },
|
|
28
|
-
textTransform: { uppercase: true },
|
|
29
|
-
textAppearance: { secondary: true },
|
|
30
|
-
})
|
|
31
|
-
.build();
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { componentBuilder } from "./utils";
|
|
3
|
+
import { TypographyComponentProps } from "./props";
|
|
4
|
+
|
|
5
|
+
export const Badge: React.FC<TypographyComponentProps> = (props) =>
|
|
6
|
+
componentBuilder(props, "span", "rounded-full w-fit")
|
|
7
|
+
.withSizes({
|
|
8
|
+
xs: "px-2 py-1 text-xs",
|
|
9
|
+
sm: "px-3 py-1 text-sm",
|
|
10
|
+
md: "px-4 py-2 text-base",
|
|
11
|
+
lg: "px-5 py-2 text-lg",
|
|
12
|
+
xl: "px-6 py-3 text-xl",
|
|
13
|
+
})
|
|
14
|
+
.withAppearance({
|
|
15
|
+
default: "bg-gray-200",
|
|
16
|
+
accent: "bg-gray-200",
|
|
17
|
+
primary: "bg-blue-200",
|
|
18
|
+
secondary: "bg-gray-200",
|
|
19
|
+
tertiary: "bg-gray-200",
|
|
20
|
+
success: "bg-green-200",
|
|
21
|
+
danger: "bg-red-200",
|
|
22
|
+
warning: "bg-yellow-200",
|
|
23
|
+
info: "bg-blue-200"
|
|
24
|
+
}, {})
|
|
25
|
+
.withTypography({
|
|
26
|
+
fontWeight: { semibold: true },
|
|
27
|
+
fontFamily: { mono: true },
|
|
28
|
+
textTransform: { uppercase: true },
|
|
29
|
+
textAppearance: { secondary: true },
|
|
30
|
+
})
|
|
31
|
+
.build();
|
|
32
32
|
|
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { componentBuilder } from "./utils";
|
|
3
|
-
import { TypographyComponentProps } from "./props";
|
|
4
|
-
|
|
5
|
-
export const Chip: React.FC<TypographyComponentProps> = (props) =>
|
|
6
|
-
componentBuilder(props, "span", "rounded-full w-fit h-fit border")
|
|
7
|
-
.withSizes({
|
|
8
|
-
xs: "px-1 py-1 rounded-sm text-xs",
|
|
9
|
-
sm: "px-2 py-1 rounded-md text-sm",
|
|
10
|
-
md: "px-2 py-1 rounded-lg text-base",
|
|
11
|
-
lg: "px-3 py-2 rounded-xl text-lg",
|
|
12
|
-
xl: "px-4 py-3 rounded-2xl text-xl",
|
|
13
|
-
})
|
|
14
|
-
.withAppearance({
|
|
15
|
-
default: "bg-gray-100",
|
|
16
|
-
accent: "bg-gray-200",
|
|
17
|
-
primary: "bg-blue-200",
|
|
18
|
-
secondary: "bg-gray-200",
|
|
19
|
-
tertiary: "bg-gray-200",
|
|
20
|
-
success: "bg-green-200",
|
|
21
|
-
danger: "bg-red-200",
|
|
22
|
-
warning: "bg-yellow-200",
|
|
23
|
-
info: "bg-blue-200"
|
|
24
|
-
}, {})
|
|
25
|
-
.withTypography({
|
|
26
|
-
fontFamily: { mono: true },
|
|
27
|
-
textAppearance: { secondary: true },
|
|
28
|
-
})
|
|
29
|
-
.build();
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { componentBuilder } from "./utils";
|
|
3
|
+
import { TypographyComponentProps } from "./props";
|
|
4
|
+
|
|
5
|
+
export const Chip: React.FC<TypographyComponentProps> = (props) =>
|
|
6
|
+
componentBuilder(props, "span", "rounded-full w-fit h-fit border")
|
|
7
|
+
.withSizes({
|
|
8
|
+
xs: "px-1 py-1 rounded-sm text-xs",
|
|
9
|
+
sm: "px-2 py-1 rounded-md text-sm",
|
|
10
|
+
md: "px-2 py-1 rounded-lg text-base",
|
|
11
|
+
lg: "px-3 py-2 rounded-xl text-lg",
|
|
12
|
+
xl: "px-4 py-3 rounded-2xl text-xl",
|
|
13
|
+
})
|
|
14
|
+
.withAppearance({
|
|
15
|
+
default: "bg-gray-100",
|
|
16
|
+
accent: "bg-gray-200",
|
|
17
|
+
primary: "bg-blue-200",
|
|
18
|
+
secondary: "bg-gray-200",
|
|
19
|
+
tertiary: "bg-gray-200",
|
|
20
|
+
success: "bg-green-200",
|
|
21
|
+
danger: "bg-red-200",
|
|
22
|
+
warning: "bg-yellow-200",
|
|
23
|
+
info: "bg-blue-200"
|
|
24
|
+
}, {})
|
|
25
|
+
.withTypography({
|
|
26
|
+
fontFamily: { mono: true },
|
|
27
|
+
textAppearance: { secondary: true },
|
|
28
|
+
})
|
|
29
|
+
.build();
|