@wix/ditto-codegen-public 1.0.273 → 1.0.275
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/dist/opencode-tools/batch-read.ts +28 -0
- package/dist/opencode-tools/batch-write.ts +38 -0
- package/dist/opencode-tools/uuid.ts +19 -0
- package/dist/opencode-tools/validate.ts +51 -0
- package/dist/opencode-tools/wds-lookup.ts +134 -0
- package/dist/out.js +392 -102
- package/package.json +2 -2
- package/dist/examples-apps/ai-chatbot/.nvmrc +0 -1
- package/dist/examples-apps/ai-chatbot/README.md +0 -21
- package/dist/examples-apps/ai-chatbot/package-lock.json +0 -7266
- package/dist/examples-apps/ai-chatbot/package.json +0 -35
- package/dist/examples-apps/ai-chatbot/src/dashboard/pages/product/ProductChat.module.css +0 -3
- package/dist/examples-apps/ai-chatbot/src/dashboard/pages/product/ProductChat.tsx +0 -108
- package/dist/examples-apps/ai-chatbot/src/dashboard/pages/product/page.tsx +0 -100
- package/dist/examples-apps/ai-chatbot/src/dashboard/withProviders.tsx +0 -15
- package/dist/examples-apps/ai-chatbot/src/env.d.ts +0 -4
- package/dist/examples-apps/ai-chatbot/src/types.ts +0 -4
- package/dist/examples-apps/ai-chatbot/tsconfig.json +0 -8
- package/dist/examples-apps/ai-chatbot/wix.config.json +0 -5
- package/dist/examples-apps/contact-created-logger/package-lock.json +0 -15102
- package/dist/examples-apps/contact-created-logger/package.json +0 -37
- package/dist/examples-apps/contact-created-logger/src/backend/events/contact-created-logger/event.ts +0 -56
- package/dist/examples-apps/contact-created-logger/tsconfig.json +0 -5
- package/dist/examples-apps/contact-created-logger/wix.config.json +0 -4
- package/dist/examples-apps/coupon-popup/README.md +0 -13
- package/dist/examples-apps/coupon-popup/package.json +0 -43
- package/dist/examples-apps/coupon-popup/src/extensions.ts +0 -12
- package/dist/examples-apps/coupon-popup/src/index.ts +0 -2
- package/dist/examples-apps/coupon-popup/src/site/embedded-scripts/cart-coupon-popup/embedded.html +0 -562
- package/dist/examples-apps/coupon-popup/src/site/embedded-scripts/cart-coupon-popup/extensions.ts +0 -8
- package/dist/examples-apps/coupon-popup/tsconfig.json +0 -10
- package/dist/examples-apps/coupon-popup/wix.config.json +0 -4
- package/dist/examples-apps/custom-element/countdown-widget/components/ColorPickerField.tsx +0 -27
- package/dist/examples-apps/custom-element/countdown-widget/components/FontPickerField.tsx +0 -34
- package/dist/examples-apps/custom-element/countdown-widget/components/Separator.tsx +0 -10
- package/dist/examples-apps/custom-element/countdown-widget/components/TimeBlock.tsx +0 -23
- package/dist/examples-apps/custom-element/countdown-widget/extensions.ts +0 -18
- package/dist/examples-apps/custom-element/countdown-widget/panel.tsx +0 -146
- package/dist/examples-apps/custom-element/countdown-widget/styles.ts +0 -73
- package/dist/examples-apps/custom-element/countdown-widget/utils.ts +0 -46
- package/dist/examples-apps/custom-element/countdown-widget/widget.tsx +0 -97
- package/dist/examples-apps/product-created-logger/package-lock.json +0 -15102
- package/dist/examples-apps/product-created-logger/package.json +0 -37
- package/dist/examples-apps/product-created-logger/src/backend/events/product-created-logger/event.ts +0 -66
- package/dist/examples-apps/product-created-logger/tsconfig.json +0 -5
- package/dist/examples-apps/product-created-logger/wix.config.json +0 -4
- package/dist/examples-apps/react-builder/component.tsx +0 -123
- package/dist/examples-apps/react-builder/components/Badge.tsx +0 -14
- package/dist/examples-apps/react-builder/components/Button.tsx +0 -31
- package/dist/examples-apps/react-builder/components/Counter.tsx +0 -14
- package/dist/examples-apps/react-builder/components/FeaturedImage.tsx +0 -31
- package/dist/examples-apps/react-builder/components/SocialLinks.tsx +0 -61
- package/dist/examples-apps/react-builder/components/Subtitle.tsx +0 -11
- package/dist/examples-apps/react-builder/components/Tags.tsx +0 -25
- package/dist/examples-apps/react-builder/components/Title.tsx +0 -11
- package/dist/examples-apps/react-builder/components/index.ts +0 -8
- package/dist/examples-apps/react-builder/manifest.json +0 -345
- package/dist/examples-apps/react-builder/style.css +0 -197
- package/dist/examples-apps/react-builder/types.ts +0 -70
- package/dist/examples-apps/spis-examples/.nvmrc +0 -1
- package/dist/examples-apps/spis-examples/README.md +0 -21
- package/dist/examples-apps/spis-examples/package-lock.json +0 -6903
- package/dist/examples-apps/spis-examples/package.json +0 -32
- package/dist/examples-apps/spis-examples/src/backend/service-plugins/ecom-additional-fees/additional-fees/plugin.ts +0 -66
- package/dist/examples-apps/spis-examples/src/backend/service-plugins/ecom-discount-triggers/discount-triggers/plugin.ts +0 -42
- package/dist/examples-apps/spis-examples/src/backend/service-plugins/ecom-gift-cards/gift-cards/plugin.ts +0 -38
- package/dist/examples-apps/spis-examples/src/backend/service-plugins/ecom-shipping-rates/shipping-rates/plugin.ts +0 -34
- package/dist/examples-apps/spis-examples/src/backend/service-plugins/ecom-validations/validations/plugin.ts +0 -24
- package/dist/examples-apps/spis-examples/src/env.d.ts +0 -4
- package/dist/examples-apps/spis-examples/tsconfig.json +0 -8
- package/dist/examples-apps/spis-examples/wix.config.json +0 -5
- package/dist/examples-apps/survey-manager/README.md +0 -21
- package/dist/examples-apps/survey-manager/package-lock.json +0 -14252
- package/dist/examples-apps/survey-manager/package.json +0 -36
- package/dist/examples-apps/survey-manager/src/dashboard/pages/apis.ts +0 -116
- package/dist/examples-apps/survey-manager/src/dashboard/pages/components/PageLoader.tsx +0 -23
- package/dist/examples-apps/survey-manager/src/dashboard/pages/components/QuestionModal.tsx +0 -84
- package/dist/examples-apps/survey-manager/src/dashboard/pages/components/QuestionsTable.tsx +0 -139
- package/dist/examples-apps/survey-manager/src/dashboard/pages/components/SurveyPageLayout.tsx +0 -99
- package/dist/examples-apps/survey-manager/src/dashboard/pages/components/SurveyStats.tsx +0 -50
- package/dist/examples-apps/survey-manager/src/dashboard/pages/page.tsx +0 -171
- package/dist/examples-apps/survey-manager/src/dashboard/pages/types.ts +0 -28
- package/dist/examples-apps/survey-manager/tsconfig.json +0 -8
- package/dist/examples-apps/survey-manager/wix.config.json +0 -4
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "my-custom-app",
|
|
3
|
-
"type": "module",
|
|
4
|
-
"version": "1.0.0",
|
|
5
|
-
"scripts": {
|
|
6
|
-
"astro": "astro",
|
|
7
|
-
"dev": "wix dev",
|
|
8
|
-
"build": "wix build",
|
|
9
|
-
"wix": "wix",
|
|
10
|
-
"preview": "wix preview",
|
|
11
|
-
"release": "wix release",
|
|
12
|
-
"generate": "wix generate",
|
|
13
|
-
"env": "wix env"
|
|
14
|
-
},
|
|
15
|
-
"dependencies": {
|
|
16
|
-
"@wix/astro": "^2.12.0",
|
|
17
|
-
"@wix/crm": "^1.0.1071",
|
|
18
|
-
"@wix/dashboard": "^1.3.36",
|
|
19
|
-
"@wix/data": "^1.0.290",
|
|
20
|
-
"@wix/design-system": "^1.111.0",
|
|
21
|
-
"@wix/ecom": "^1.0.1354",
|
|
22
|
-
"@wix/essentials": "^0.1.23",
|
|
23
|
-
"@wix/sdk": "^1.15.23",
|
|
24
|
-
"@wix/stores": "^1.0.533",
|
|
25
|
-
"astro": "^5.8.0",
|
|
26
|
-
"typescript": "^5.8.3"
|
|
27
|
-
},
|
|
28
|
-
"devDependencies": {
|
|
29
|
-
"@astrojs/cloudflare": "^12.5.3",
|
|
30
|
-
"@astrojs/react": "^4.3.0",
|
|
31
|
-
"@types/react": "^18.3.1",
|
|
32
|
-
"@types/react-dom": "^18.3.1",
|
|
33
|
-
"@wix/cli": "^1.1.92",
|
|
34
|
-
"react": "18.3.1",
|
|
35
|
-
"react-dom": "18.3.1"
|
|
36
|
-
}
|
|
37
|
-
}
|
package/dist/examples-apps/product-created-logger/src/backend/events/product-created-logger/event.ts
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { productsV3 } from '@wix/stores';
|
|
2
|
-
import { items } from '@wix/data';
|
|
3
|
-
|
|
4
|
-
export default productsV3.onProductCreated(async (event) => {
|
|
5
|
-
const productIdFromEvent = event.entity?._id;
|
|
6
|
-
try {
|
|
7
|
-
console.log('Product created event triggered:', event);
|
|
8
|
-
|
|
9
|
-
// Extract product information from the event
|
|
10
|
-
const productId = productIdFromEvent;
|
|
11
|
-
|
|
12
|
-
if (!productId) {
|
|
13
|
-
console.error('No product ID found in event');
|
|
14
|
-
return;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
const product = event.entity;
|
|
18
|
-
|
|
19
|
-
// Create detailed creation information
|
|
20
|
-
const creationDetails = {
|
|
21
|
-
productName: product.name || 'Unknown Product',
|
|
22
|
-
productSlug: product.slug,
|
|
23
|
-
visible: product.visible,
|
|
24
|
-
inventory: product.inventory,
|
|
25
|
-
brand: product.brand,
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
// Create log entry in the product-creation-logs collection
|
|
29
|
-
const logEntry = {
|
|
30
|
-
productId: productId,
|
|
31
|
-
changeType: 'PRODUCT_CREATED',
|
|
32
|
-
changedFields: ['CREATED'],
|
|
33
|
-
timestamp: new Date(),
|
|
34
|
-
changeDetails: JSON.stringify(creationDetails, null, 2),
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
// Insert the log entry into the collection
|
|
38
|
-
await items.insert('product-creation-logs', logEntry);
|
|
39
|
-
|
|
40
|
-
console.log('Product creation logged successfully:', {
|
|
41
|
-
productId,
|
|
42
|
-
productName: product.name,
|
|
43
|
-
changedFields: logEntry.changedFields,
|
|
44
|
-
timestamp: logEntry.timestamp,
|
|
45
|
-
});
|
|
46
|
-
} catch (error) {
|
|
47
|
-
console.error('Error processing product creation event:', {
|
|
48
|
-
productId: productIdFromEvent || 'unknown',
|
|
49
|
-
error: error instanceof Error ? error.message : String(error),
|
|
50
|
-
timestamp: new Date(),
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
// Try to log the error to the collection as well
|
|
54
|
-
try {
|
|
55
|
-
await items.insert('product-creation-logs', {
|
|
56
|
-
productId: productIdFromEvent || 'unknown',
|
|
57
|
-
changeType: 'ERROR',
|
|
58
|
-
changedFields: [],
|
|
59
|
-
timestamp: new Date(),
|
|
60
|
-
changeDetails: `Error processing product creation: ${error instanceof Error ? error.message : String(error)}`,
|
|
61
|
-
});
|
|
62
|
-
} catch (logError) {
|
|
63
|
-
console.error('Failed to log error to collection:', logError);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
});
|
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import './style.css';
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
Badge,
|
|
6
|
-
Title,
|
|
7
|
-
Subtitle,
|
|
8
|
-
Tags,
|
|
9
|
-
Counter,
|
|
10
|
-
Button,
|
|
11
|
-
FeaturedImage,
|
|
12
|
-
SocialLinks,
|
|
13
|
-
} from './components';
|
|
14
|
-
|
|
15
|
-
import type {
|
|
16
|
-
Text,
|
|
17
|
-
RichText,
|
|
18
|
-
NumberType,
|
|
19
|
-
BooleanValue,
|
|
20
|
-
WebUrl,
|
|
21
|
-
LocalDate,
|
|
22
|
-
LocalTime,
|
|
23
|
-
Link,
|
|
24
|
-
Image,
|
|
25
|
-
Direction,
|
|
26
|
-
Wix,
|
|
27
|
-
} from './types';
|
|
28
|
-
|
|
29
|
-
interface PerfectExampleProps {
|
|
30
|
-
className: string;
|
|
31
|
-
id: string;
|
|
32
|
-
wix?: Wix;
|
|
33
|
-
direction?: Direction;
|
|
34
|
-
scheduledDate?: LocalDate;
|
|
35
|
-
scheduledTime?: LocalTime;
|
|
36
|
-
elementProps?: {
|
|
37
|
-
badge?: {
|
|
38
|
-
badgeText?: Text;
|
|
39
|
-
};
|
|
40
|
-
title?: {
|
|
41
|
-
titleText?: Text;
|
|
42
|
-
};
|
|
43
|
-
subtitle?: {
|
|
44
|
-
subtitleText?: Text;
|
|
45
|
-
};
|
|
46
|
-
tags?: {
|
|
47
|
-
tagsText?: Text;
|
|
48
|
-
};
|
|
49
|
-
counter?: {
|
|
50
|
-
counterValue?: NumberType;
|
|
51
|
-
counterLabel?: Text;
|
|
52
|
-
};
|
|
53
|
-
button?: {
|
|
54
|
-
buttonText?: Text;
|
|
55
|
-
buttonLink?: Link;
|
|
56
|
-
buttonDisabled?: BooleanValue;
|
|
57
|
-
};
|
|
58
|
-
featuredImage?: {
|
|
59
|
-
image?: Image;
|
|
60
|
-
imageAlt?: Text;
|
|
61
|
-
};
|
|
62
|
-
socialLinks?: {
|
|
63
|
-
facebookUrl?: WebUrl;
|
|
64
|
-
twitterUrl?: WebUrl;
|
|
65
|
-
instagramUrl?: WebUrl;
|
|
66
|
-
};
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
const PerfectExample: React.FC<PerfectExampleProps> = ({
|
|
71
|
-
className,
|
|
72
|
-
id,
|
|
73
|
-
wix,
|
|
74
|
-
direction,
|
|
75
|
-
scheduledDate,
|
|
76
|
-
scheduledTime,
|
|
77
|
-
elementProps,
|
|
78
|
-
}) => {
|
|
79
|
-
const rm = wix?.elementsRemovalState || {};
|
|
80
|
-
|
|
81
|
-
return (
|
|
82
|
-
<div className={`perfect-example ${className}`} id={id} dir={direction}>
|
|
83
|
-
{!rm['badge'] && (
|
|
84
|
-
<Badge className="perfect-example__badge" {...elementProps?.badge} />
|
|
85
|
-
)}
|
|
86
|
-
|
|
87
|
-
{!rm['title'] && (
|
|
88
|
-
<Title className="perfect-example__title" {...elementProps?.title} />
|
|
89
|
-
)}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
{!rm['subtitle'] && (
|
|
93
|
-
<Subtitle className="perfect-example__subtitle" {...elementProps?.subtitle} />
|
|
94
|
-
)}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
{!rm['tags'] && (
|
|
98
|
-
<Tags className="perfect-example__tags" {...elementProps?.tags} />
|
|
99
|
-
)}
|
|
100
|
-
|
|
101
|
-
{!rm['counter'] && (
|
|
102
|
-
<Counter className="perfect-example__counter" {...elementProps?.counter} />
|
|
103
|
-
)}
|
|
104
|
-
|
|
105
|
-
<div className="perfect-example__buttons">
|
|
106
|
-
{!rm['button'] && (
|
|
107
|
-
<Button className="perfect-example__button" {...elementProps?.button} />
|
|
108
|
-
)}
|
|
109
|
-
|
|
110
|
-
</div>
|
|
111
|
-
|
|
112
|
-
{!rm['featuredImage'] && (
|
|
113
|
-
<FeaturedImage className="perfect-example__image" {...elementProps?.featuredImage} />
|
|
114
|
-
)}
|
|
115
|
-
|
|
116
|
-
{!rm['socialLinks'] && (
|
|
117
|
-
<SocialLinks className="perfect-example__social" {...elementProps?.socialLinks} />
|
|
118
|
-
)}
|
|
119
|
-
</div>
|
|
120
|
-
);
|
|
121
|
-
};
|
|
122
|
-
|
|
123
|
-
export default PerfectExample;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { Text } from '../types';
|
|
3
|
-
|
|
4
|
-
interface BadgeComponentProps {
|
|
5
|
-
className: string;
|
|
6
|
-
badgeText?: Text;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export const Badge: React.FC<BadgeComponentProps> = ({ className, badgeText }) => (
|
|
10
|
-
<span className={className}>
|
|
11
|
-
{badgeText || 'New'}
|
|
12
|
-
</span>
|
|
13
|
-
);
|
|
14
|
-
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { Text, Link, BooleanValue } from '../types';
|
|
3
|
-
|
|
4
|
-
interface ButtonComponentProps {
|
|
5
|
-
className: string;
|
|
6
|
-
buttonText?: Text;
|
|
7
|
-
buttonLink?: Link;
|
|
8
|
-
buttonDisabled?: BooleanValue;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export const Button: React.FC<ButtonComponentProps> = ({ className, buttonText, buttonLink, buttonDisabled }) => {
|
|
12
|
-
const handleClick = (e: React.MouseEvent<HTMLAnchorElement>) => {
|
|
13
|
-
if (buttonDisabled || !buttonLink?.href || buttonLink.href === '#') {
|
|
14
|
-
e.preventDefault();
|
|
15
|
-
}
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
return (
|
|
19
|
-
<a
|
|
20
|
-
href={buttonLink?.href || '#'}
|
|
21
|
-
target={buttonLink?.target}
|
|
22
|
-
rel={buttonLink?.rel}
|
|
23
|
-
onClick={handleClick}
|
|
24
|
-
className={className}
|
|
25
|
-
aria-disabled={buttonDisabled}
|
|
26
|
-
style={{ pointerEvents: buttonDisabled ? 'none' : 'auto', opacity: buttonDisabled ? 0.5 : 1 }}
|
|
27
|
-
>
|
|
28
|
-
{buttonText || 'Get Started'}
|
|
29
|
-
</a>
|
|
30
|
-
);
|
|
31
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { NumberType } from '../types';
|
|
3
|
-
|
|
4
|
-
interface CounterComponentProps {
|
|
5
|
-
className: string;
|
|
6
|
-
counterValue?: NumberType;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export const Counter: React.FC<CounterComponentProps> = ({ className, counterValue }) => (
|
|
10
|
-
<div className={className}>
|
|
11
|
-
<span className="perfect-example__counter-value">{counterValue ?? 100}</span>
|
|
12
|
-
</div>
|
|
13
|
-
);
|
|
14
|
-
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { Image, Text } from '../types';
|
|
3
|
-
|
|
4
|
-
interface FeaturedImageComponentProps {
|
|
5
|
-
className: string;
|
|
6
|
-
image?: Image;
|
|
7
|
-
imageAlt?: Text;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export const FeaturedImage: React.FC<FeaturedImageComponentProps> = ({ className, image, imageAlt }) => (
|
|
11
|
-
<div className="perfect-example__image-wrapper">
|
|
12
|
-
{image?.url ? (
|
|
13
|
-
<img
|
|
14
|
-
className={className}
|
|
15
|
-
src={image.url}
|
|
16
|
-
alt={imageAlt || image.alt || 'Featured image'}
|
|
17
|
-
loading="lazy"
|
|
18
|
-
/>
|
|
19
|
-
) : (
|
|
20
|
-
<div className={`${className} perfect-example__image--placeholder`}>
|
|
21
|
-
<svg width="48" height="48" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.5">
|
|
22
|
-
<rect x="3" y="3" width="18" height="18" rx="2" ry="2" />
|
|
23
|
-
<circle cx="8.5" cy="8.5" r="1.5" />
|
|
24
|
-
<polyline points="21 15 16 10 5 21" />
|
|
25
|
-
</svg>
|
|
26
|
-
<span>Add Image</span>
|
|
27
|
-
</div>
|
|
28
|
-
)}
|
|
29
|
-
</div>
|
|
30
|
-
);
|
|
31
|
-
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { WebUrl } from '../types';
|
|
3
|
-
|
|
4
|
-
interface SocialLinksComponentProps {
|
|
5
|
-
className: string;
|
|
6
|
-
facebookUrl?: WebUrl;
|
|
7
|
-
twitterUrl?: WebUrl;
|
|
8
|
-
instagramUrl?: WebUrl;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
const SocialIcon: React.FC<{ type: 'facebook' | 'twitter' | 'instagram' }> = ({ type }) => {
|
|
12
|
-
const paths: Record<string, string> = {
|
|
13
|
-
facebook: 'M18 2h-3a5 5 0 0 0-5 5v3H7v4h3v8h4v-8h3l1-4h-4V7a1 1 0 0 1 1-1h3z',
|
|
14
|
-
twitter: 'M23 3a10.9 10.9 0 0 1-3.14 1.53 4.48 4.48 0 0 0-7.86 3v1A10.66 10.66 0 0 1 3 4s-4 9 5 13a11.64 11.64 0 0 1-7 2c9 5 20 0 20-11.5a4.5 4.5 0 0 0-.08-.83A7.72 7.72 0 0 0 23 3z',
|
|
15
|
-
instagram: 'M16 4H8a4 4 0 0 0-4 4v8a4 4 0 0 0 4 4h8a4 4 0 0 0 4-4V8a4 4 0 0 0-4-4zm-4 11a3 3 0 1 1 0-6 3 3 0 0 1 0 6zm4.5-7.5a1 1 0 1 1 0-2 1 1 0 0 1 0 2z',
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
return (
|
|
19
|
-
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
|
|
20
|
-
<path d={paths[type]} />
|
|
21
|
-
</svg>
|
|
22
|
-
);
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
export const SocialLinks: React.FC<SocialLinksComponentProps> = ({
|
|
26
|
-
className,
|
|
27
|
-
facebookUrl,
|
|
28
|
-
twitterUrl,
|
|
29
|
-
instagramUrl
|
|
30
|
-
}) => {
|
|
31
|
-
const links = [
|
|
32
|
-
{ type: 'facebook' as const, url: facebookUrl },
|
|
33
|
-
{ type: 'twitter' as const, url: twitterUrl },
|
|
34
|
-
{ type: 'instagram' as const, url: instagramUrl },
|
|
35
|
-
].filter(link => link.url);
|
|
36
|
-
|
|
37
|
-
const displayLinks = links.length > 0 ? links : [
|
|
38
|
-
{ type: 'facebook' as const, url: '#' },
|
|
39
|
-
{ type: 'twitter' as const, url: '#' },
|
|
40
|
-
{ type: 'instagram' as const, url: '#' },
|
|
41
|
-
];
|
|
42
|
-
|
|
43
|
-
return (
|
|
44
|
-
<div className={className}>
|
|
45
|
-
{displayLinks.map(({ type, url }) => (
|
|
46
|
-
<a
|
|
47
|
-
key={type}
|
|
48
|
-
href={url || '#'}
|
|
49
|
-
target="_blank"
|
|
50
|
-
rel="noopener noreferrer"
|
|
51
|
-
className="perfect-example__social-link"
|
|
52
|
-
aria-label={type}
|
|
53
|
-
onClick={(e) => { if (!url || url === '#') e.preventDefault(); }}
|
|
54
|
-
>
|
|
55
|
-
<SocialIcon type={type} />
|
|
56
|
-
</a>
|
|
57
|
-
))}
|
|
58
|
-
</div>
|
|
59
|
-
);
|
|
60
|
-
};
|
|
61
|
-
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { Text } from '../types';
|
|
3
|
-
|
|
4
|
-
interface SubtitleComponentProps {
|
|
5
|
-
className: string;
|
|
6
|
-
subtitleText?: Text;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export const Subtitle: React.FC<SubtitleComponentProps> = ({ className, subtitleText }) => (
|
|
10
|
-
<p className={className}>{subtitleText || 'The ultimate React component builder showcase'}</p>
|
|
11
|
-
);
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { Text } from '../types';
|
|
3
|
-
|
|
4
|
-
interface TagsComponentProps {
|
|
5
|
-
className: string;
|
|
6
|
-
tagsText?: Text;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
const DEFAULT_TAGS = 'React, Builder, Wix';
|
|
10
|
-
|
|
11
|
-
export const Tags: React.FC<TagsComponentProps> = ({ className, tagsText }) => {
|
|
12
|
-
const tagsString = tagsText || DEFAULT_TAGS;
|
|
13
|
-
const tags = tagsString.split(',').map(tag => tag.trim()).filter(tag => tag.length > 0);
|
|
14
|
-
|
|
15
|
-
return (
|
|
16
|
-
<div className={className}>
|
|
17
|
-
{tags.map((tag, index) => (
|
|
18
|
-
<span key={index} className="perfect-example__tag">
|
|
19
|
-
{tag}
|
|
20
|
-
</span>
|
|
21
|
-
))}
|
|
22
|
-
</div>
|
|
23
|
-
);
|
|
24
|
-
};
|
|
25
|
-
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { Text } from '../types';
|
|
3
|
-
|
|
4
|
-
interface TitleComponentProps {
|
|
5
|
-
className: string;
|
|
6
|
-
titleText?: Text;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export const Title: React.FC<TitleComponentProps> = ({ className, titleText }) => (
|
|
10
|
-
<h1 className={className}>{titleText || 'Perfect Example'}</h1>
|
|
11
|
-
);
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export { Badge } from './Badge';
|
|
2
|
-
export { Title } from './Title';
|
|
3
|
-
export { Subtitle } from './Subtitle';
|
|
4
|
-
export { Tags } from './Tags';
|
|
5
|
-
export { Counter } from './Counter';
|
|
6
|
-
export { Button } from './Button';
|
|
7
|
-
export { FeaturedImage } from './FeaturedImage';
|
|
8
|
-
export { SocialLinks } from './SocialLinks';
|