@@ -5,127 +5,30 @@ import { Container } from './styles';
55import SocialBar from '../../components/SocialBar' ;
66
77export default function Contact ( ) {
8-
9- const [ inputName , setInputName ] = useState ( "" ) ;
10- const [ inputMail , setInputMail ] = useState ( "" ) ;
11- const [ inputMessage , setInputMessage ] = useState ( "" ) ;
12- const [ messageMaxLength , setMessageMaxLength ] = useState ( 1500 ) ;
13- const [ lockButton , setLockButton ] = useState ( false ) ;
14-
15- function updateMessageMaxLength ( ) {
16- if ( inputName . length + inputMail . length > 400 ) {
17- setMessageMaxLength ( 1500 - ( inputName . length + inputMail . length ) ) ;
18- }
19- else {
20- setMessageMaxLength ( 1500 ) ;
21- }
22- }
23-
24- function handleKeyDown ( event ) {
25- updateMessageMaxLength ( ) ;
26- }
27-
28- function handleNameChange ( event ) {
29- setInputName ( event . target . value ) ;
30- }
31-
32- function handleMailChange ( event ) {
33- setInputMail ( event . target . value ) ;
34- }
35-
36- function handleMessageChange ( event ) {
37- setInputMessage ( event . target . value ) ;
38- }
39-
40- function handleSubmit ( event ) {
41- event . preventDefault ( ) ;
42-
43- const body = {
44- embeds : [
45- {
46- title : inputName ,
47- description : inputMessage ,
48- timestamp : new Date ( ) . toISOString ( ) ,
49- footer : {
50- text : inputMail
51- } ,
52- color : 261247
53- }
54- ] ,
55- content : "@everyone"
56- // content: `**NAME**:\n\`\`\`${inputName}\`\`\`**MAIL**:\n\`\`\`${inputMail}\`\`\`**MESSAGE**:\n\`\`\`${inputMessage}\`\`\``,
57- } ;
58-
59- const xmlhttp = new XMLHttpRequest ( ) ;
60- xmlhttp . open ( "POST" , "https://discordapp.com/api/webhooks/643862830168145920/HcLRUH4Bh8RBj-z340Shr53-lICFl24-SGnkaZdGvvuoJQXYxmjhdOrM8Mi3D9WOD1u5" ) ;
61- xmlhttp . setRequestHeader ( "Content-Type" , "application/json" ) ;
62- xmlhttp . send ( JSON . stringify ( body ) ) ;
63-
64- setLockButton ( true ) ;
65- }
66-
67- return (
68- < Container >
69- < div className = "row" >
70- < div className = "left-content" >
71- < div className = "animated-container" >
72- < h1 > Leave your < span > message</ span > </ h1 >
73- </ div >
74- < img src = { `${ process . env . PUBLIC_URL } /telephone.png` } alt = "telephone" />
75- </ div >
76- < div className = "column" >
77- < SocialBar />
78- < form onSubmit = { handleSubmit } >
79- < div className = "textbox" >
80- < label htmlFor = "name" > Nome</ label >
81- < input
82- required
83- type = "text"
84- pattern = "[a-zA-Z\s]+"
85- value = { inputName }
86- onKeyDown = { handleKeyDown }
87- onChange = { handleNameChange }
88- disabled = { lockButton }
89- />
90- </ div >
91-
92- < div className = "textbox" >
93- < label htmlFor = "mail" > E-mail</ label >
94- < input
95- required
96- type = "email"
97- value = { inputMail }
98- onKeyDown = { handleKeyDown }
99- onChange = { handleMailChange }
100- disabled = { lockButton }
101- />
102- </ div >
103-
104- < div className = "textbox" >
105- < label htmlFor = "msg" > Mensagem</ label >
106- < div className = "textarea-container" >
107- < textarea
108- required
109- maxLength = { messageMaxLength }
110- value = { inputMessage }
111- onChange = { handleMessageChange }
112- disabled = { lockButton }
113- />
114- < span className = "char-counter" > { `${ inputMessage . length } - ${ messageMaxLength } ` } </ span >
115- </ div >
116- </ div >
117-
118- < div className = "submit-button" >
119- < button
120- className = { lockButton ? "locked-button" : "normal-button" }
121- type = "submit"
122- disabled = { lockButton } >
123- { lockButton ? "Mensagem enviada!" : "Enviar mensagem!" }
124- </ button >
125- </ div >
126- </ form >
127- </ div >
128- </ div >
129- </ Container >
130- ) ;
8+ return (
9+ < Container >
10+ < div className = "row" >
11+ < div className = "left-content" >
12+ < div className = "animated-container" >
13+ < h1 >
14+ Join to our < span > community</ span >
15+ </ h1 >
16+ </ div >
17+ < img src = { `${ process . env . PUBLIC_URL } /telephone.png` } alt = "telephone" />
18+ </ div >
19+ < div className = "column" >
20+ < SocialBar />
21+ < iframe
22+ title = "discord"
23+ src = "https://discord.com/widget?id=507953868907479061& theme = dark "
24+ width = "350"
25+ height = "500"
26+ allowtransparency = "true"
27+ frameborder = "0"
28+ sandbox = "allow-popups allow-popups-to-escape-sandbox allow-same-origin allow-scripts"
29+ />
30+ </ div >
31+ </ div >
32+ </ Container >
33+ ) ;
13134}
0 commit comments