This repository was archived by the owner on Oct 4, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 53
/
Copy pathSocialPreviewFormWrapper.js
105 lines (100 loc) · 2.87 KB
/
SocialPreviewFormWrapper.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
import React from "react";
import { SocialMetadataPreviewForm } from "@yoast/social-metadata-forms";
import ExamplesContainer from "./ExamplesContainer";
import { noop } from "lodash";
const replacementVariables = [
{
name: "title",
label: "title",
value: "Title",
description: "This is the title of your post",
},
{
name: "post_type",
label: "post type",
value: "Gallery",
description: "This is the post type of your post",
},
{
name: "sep",
label: "sep",
value: " - ",
description: "A separator that clarifies your search result snippet",
},
{
name: "term404",
label: "Error 404 slug",
value: "Error 404 slug",
description: "The slug which caused the error 404",
},
];
const recommendedReplacementVariables = [
"title",
"post_type",
];
/**
* Creates a callback that shows an alert dialog.
*
* @param {string} message The message that should be shown.
*
* @returns {Function} Callback function.
*/
const selectFileClick = ( message = "YOU CLICKED MY BUTTON!" ) => {
return alert.bind( null, message );
};
/**
* Renders a react Component.
*
* @returns {React.Element} The element.
*/
const SocialPreviewFormWrapper = () =>
<ExamplesContainer>
<h1>Regular Facebook</h1>
<SocialMetadataPreviewForm
socialMediumName="Facebook"
replacementVariables={ replacementVariables }
recommendedReplacementVariables={ recommendedReplacementVariables }
description=""
title="%%title%%%%page%%%%sep%%%%sitename%%"
onSelectImageClick={ selectFileClick( "select image 1" ) }
onRemoveImageClick={ selectFileClick( "remove image 1" ) }
onDescriptionChange={ noop }
onTitleChange={ noop }
imageWarnings={ [] }
imageSelected={ false }
/>
<h1>Regular Twitter with selected image</h1>
<SocialMetadataPreviewForm
socialMediumName="Twitter"
replacementVariables={ replacementVariables }
recommendedReplacementVariables={ recommendedReplacementVariables }
description=""
title="%%title%%%%page%%%%sep%%%%sitename%%"
onSelectImageClick={ selectFileClick( "select image 2" ) }
onRemoveImageClick={ selectFileClick( "remove image 2" ) }
onDescriptionChange={ noop }
onTitleChange={ noop }
imageWarnings={ [] }
imageSelected={ true }
/>
<h1>Twitter with warnings</h1>
<SocialMetadataPreviewForm
socialMediumName="Twitter"
replacementVariables={ replacementVariables }
recommendedReplacementVariables={ recommendedReplacementVariables }
description=""
title="%%title%%%%page%%%%sep%%%%sitename%%"
onSelectImageClick={ selectFileClick( "select image 3" ) }
onRemoveImageClick={ selectFileClick( "remove image 3" ) }
onDescriptionChange={ noop }
onTitleChange={ noop }
imageWarnings={ [
"You destroyed the world!",
"Also, that is not a great image.",
"Something else is wrong too...",
] }
imageSelected={ true }
/>
</ExamplesContainer>
;
export default SocialPreviewFormWrapper;