You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@age.apache.org by hb...@apache.org on 2022/09/06 05:30:28 UTC
[age-website] 01/02: Remove contact pages
This is an automated email from the ASF dual-hosted git repository.
hbshin pushed a commit to branch new-web
in repository https://gitbox.apache.org/repos/asf/age-website.git
commit 6b56868af480fb3e3f09b3e6e3e5a942131acd6d
Author: Hanbyeol Shin / David Shin / 신한별 <76...@users.noreply.github.com>
AuthorDate: Tue Sep 6 14:30:03 2022 +0900
Remove contact pages
---
src/pages/contact/examples.js | 50 -----------------
src/pages/contact/file-upload.js | 108 ------------------------------------
src/pages/contact/index.js | 115 ---------------------------------------
src/pages/contact/thanks.js | 16 ------
4 files changed, 289 deletions(-)
diff --git a/src/pages/contact/examples.js b/src/pages/contact/examples.js
deleted file mode 100644
index 322d28e..0000000
--- a/src/pages/contact/examples.js
+++ /dev/null
@@ -1,50 +0,0 @@
-import * as React from "react";
-import Link from "gatsby-link";
-import Layout from "../../components/Layout";
-
-export default class Index extends React.Component {
- render() {
- return (
- <Layout>
- <section className="section">
- <div className="container">
- <div className="content">
- <h1>Hi people</h1>
- <p>
- This is an example site integrating Netlify’s form handling with
- Gatsby
- </p>
- <ul>
- <li>
- <Link to="/contact">Basic contact form</Link>
- </li>
- <li>
- <Link to="/contact/file-upload/">Form with file upload</Link>
- </li>
- </ul>
-
- <h2>Troubleshooting</h2>
- <h3>Forms stop working after upgrading to Gatsby v2</h3>
- <p>
- This can be caused by the offline-plugin.{" "}
- <a href="https://github.com/gatsbyjs/gatsby/issues/7997#issuecomment-419749232">
- Workaround
- </a>{" "}
- is to use <code>?no-cache=1</code> in the POST url to prevent
- the service worker from handling form submissions
- </p>
- <h3>Adding reCAPTCHA</h3>
- <p>
- If you are planning to add reCAPTCHA please go to{" "}
- <a href="https://github.com/imorente/gatsby-netlify-form-example">
- imorente/gatsby-netlify-form-example
- </a>{" "}
- for a working example.
- </p>
- </div>
- </div>
- </section>
- </Layout>
- );
- }
-}
diff --git a/src/pages/contact/file-upload.js b/src/pages/contact/file-upload.js
deleted file mode 100644
index ac92afd..0000000
--- a/src/pages/contact/file-upload.js
+++ /dev/null
@@ -1,108 +0,0 @@
-import * as React from "react";
-import { navigate } from "gatsby-link";
-import Layout from "../../components/Layout";
-
-function encode(data) {
- const formData = new FormData();
-
- for (const key of Object.keys(data)) {
- formData.append(key, data[key]);
- }
-
- return formData;
-}
-
-export default class Contact extends React.Component {
- constructor(props) {
- super(props);
- this.state = {};
- }
-
- handleChange = (e) => {
- this.setState({ [e.target.name]: e.target.value });
- };
-
- handleAttachment = (e) => {
- this.setState({ [e.target.name]: e.target.files[0] });
- };
-
- handleSubmit = (e) => {
- e.preventDefault();
- const form = e.target;
- fetch("/", {
- method: "POST",
- body: encode({
- "form-name": form.getAttribute("name"),
- ...this.state,
- }),
- })
- .then(() => navigate(form.getAttribute("action")))
- .catch((error) => alert(error));
- };
-
- render() {
- return (
- <Layout>
- <section className="section">
- <div className="container">
- <div className="content">
- <h1>File Upload</h1>
- <form
- name="file-upload"
- method="post"
- action="/contact/thanks/"
- data-netlify="true"
- data-netlify-honeypot="bot-field"
- onSubmit={this.handleSubmit}
- >
- {/* The `form-name` hidden field is required to support form submissions without JavaScript */}
- <input type="hidden" name="form-name" value="file-upload" />
- <div hidden>
- <label>
- Don’t fill this out:{" "}
- <input name="bot-field" onChange={this.handleChange} />
- </label>
- </div>
- <div className="field">
- <label className="label" htmlFor={"name"}>
- Your name
- </label>
- <div className="control">
- <input
- className="input"
- type={"text"}
- name={"name"}
- onChange={this.handleChange}
- id={"name"}
- required={true}
- />
- </div>
- </div>
- <div className="field">
- <div className="file">
- <label className="file-label">
- <input
- className="file-input"
- type="file"
- name="attachment"
- onChange={this.handleAttachment}
- />
- <span className="file-cta">
- <span className="file-label">Choose a file…</span>
- </span>
- </label>
- </div>
- </div>
- <div className="field">
- <button className="button is-link" type="submit">
- Send
- </button>
- </div>
- </form>
- </div>
- </div>
- </section>
- </Layout>
- );
- }
-}
diff --git a/src/pages/contact/index.js b/src/pages/contact/index.js
deleted file mode 100644
index a36e38c..0000000
--- a/src/pages/contact/index.js
+++ /dev/null
@@ -1,115 +0,0 @@
-import * as React from "react";
-import { navigate } from "gatsby-link";
-import Layout from "../../components/Layout";
-
-function encode(data) {
- return Object.keys(data)
- .map((key) => encodeURIComponent(key) + "=" + encodeURIComponent(data[key]))
- .join("&");
-}
-
-export default class Index extends React.Component {
- constructor(props) {
- super(props);
- this.state = { isValidated: false };
- }
-
- handleChange = (e) => {
- this.setState({ [e.target.name]: e.target.value });
- };
-
- handleSubmit = (e) => {
- e.preventDefault();
- const form = e.target;
- fetch("/", {
- method: "POST",
- headers: { "Content-Type": "application/x-www-form-urlencoded" },
- body: encode({
- "form-name": form.getAttribute("name"),
- ...this.state,
- }),
- })
- .then(() => navigate(form.getAttribute("action")))
- .catch((error) => alert(error));
- };
-
- render() {
- return (
- <Layout>
- <section className="section">
- <div className="container">
- <div className="content">
- <h1>Contact</h1>
- <form
- name="contact"
- method="post"
- action="/contact/thanks/"
- data-netlify="true"
- data-netlify-honeypot="bot-field"
- onSubmit={this.handleSubmit}
- >
- {/* The `form-name` hidden field is required to support form submissions without JavaScript */}
- <input type="hidden" name="form-name" value="contact" />
- <div hidden>
- <label>
- Don’t fill this out:{" "}
- <input name="bot-field" onChange={this.handleChange} />
- </label>
- </div>
- <div className="field">
- <label className="label" htmlFor={"name"}>
- Your name
- </label>
- <div className="control">
- <input
- className="input"
- type={"text"}
- name={"name"}
- onChange={this.handleChange}
- id={"name"}
- required={true}
- />
- </div>
- </div>
- <div className="field">
- <label className="label" htmlFor={"email"}>
- Email
- </label>
- <div className="control">
- <input
- className="input"
- type={"email"}
- name={"email"}
- onChange={this.handleChange}
- id={"email"}
- required={true}
- />
- </div>
- </div>
- <div className="field">
- <label className="label" htmlFor={"message"}>
- Message
- </label>
- <div className="control">
- <textarea
- className="textarea"
- name={"message"}
- onChange={this.handleChange}
- id={"message"}
- required={true}
- />
- </div>
- </div>
- <div className="field">
- <button className="button is-link" type="submit">
- Send
- </button>
- </div>
- </form>
- </div>
- </div>
- </section>
- </Layout>
- );
- }
-}
diff --git a/src/pages/contact/thanks.js b/src/pages/contact/thanks.js
deleted file mode 100644
index d51ae88..0000000
--- a/src/pages/contact/thanks.js
+++ /dev/null
@@ -1,16 +0,0 @@
-import React from "react";
-import Layout from "../../components/Layout";
-
-// eslint-disable-next-line
-export default () => (
- <Layout>
- <section className="section">
- <div className="container">
- <div className="content">
- <h1>Thank you!</h1>
- <p>This is a custom thank you page for form submissions</p>
- </div>
- </div>
- </section>
- </Layout>
-);