From d6665d7d6fba55f4e4fb9f224ffc67bd7aec3084 Mon Sep 17 00:00:00 2001 From: Yves Gatesoupe Date: Tue, 23 Jun 2020 13:44:10 +0200 Subject: [PATCH] Formulaire de contact --- .eleventy.js | 1 + .gitignore | 2 + src/_data/tokens.json | 2 +- src/_includes/layouts/home.njk | 3 + src/_includes/layouts/page.njk | 8 +- src/_includes/macros/form.njk | 2 +- .../partials/components/contact-form.njk | 64 ++++++++++------ src/_includes/partials/components/sponsor.njk | 3 + src/_includes/partials/global/site-head.njk | 2 +- src/form/contact-form-handler.php | 73 +++++++++++++++++++ src/scss/_config.scss | 2 +- src/scss/components/_button.scss | 17 +++-- src/scss/components/_form.scss | 65 +++++++++++++---- 13 files changed, 192 insertions(+), 52 deletions(-) create mode 100644 src/_includes/partials/components/sponsor.njk create mode 100644 src/form/contact-form-handler.php diff --git a/.eleventy.js b/.eleventy.js index 11182bd..e1bc8b8 100644 --- a/.eleventy.js +++ b/.eleventy.js @@ -35,6 +35,7 @@ module.exports = function(config) { config.addPassthroughCopy('src/admin/previews.js'); config.addPassthroughCopy('node_modules/nunjucks/browser/nunjucks-slim.js'); config.addPassthroughCopy('src/robots.txt'); + config.addPassthroughCopy('src/form'); const now = new Date(); diff --git a/.gitignore b/.gitignore index b6ecb6a..f1b059f 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,8 @@ npm-debug.* *.log *.swp .DS_Store +.vscode +*.code-workspace .sass-cache node_modules dist/* diff --git a/src/_data/tokens.json b/src/_data/tokens.json index 3a51a92..6eb4e25 100644 --- a/src/_data/tokens.json +++ b/src/_data/tokens.json @@ -12,7 +12,7 @@ "colors": { "primary": "#d6f253", "primary-shade": "#102538", - "primary-glare": "#22547c", + "primary-glare": "#f1fcbe", "secondary": "#282156", "highlight": "#d6f253", "light-gray": "#f1f0f7", diff --git a/src/_includes/layouts/home.njk b/src/_includes/layouts/home.njk index b400bf6..e17340f 100644 --- a/src/_includes/layouts/home.njk +++ b/src/_includes/layouts/home.njk @@ -15,5 +15,8 @@ {% include "partials/components/news-list.njk" %} {% include "partials/components/post-list.njk" %} {% include "partials/components/presentation.njk" %} + {% include "partials/components/sponsor.njk" %} + {% include "partials/components/contact-form.njk" %} + {% include "partials/components/sponsor.njk" %} {% endblock %} diff --git a/src/_includes/layouts/page.njk b/src/_includes/layouts/page.njk index c05bc3b..b2e6f50 100644 --- a/src/_includes/layouts/page.njk +++ b/src/_includes/layouts/page.njk @@ -1,17 +1,11 @@ {% extends 'layouts/base.njk' %} -{# Intro content #} -{% set introHeading = title %} - {% block content %}
- {% include "partials/components/intro.njk" %} -
+
{{ content | safe }}
{% endblock %} - -{{ content | safe }} diff --git a/src/_includes/macros/form.njk b/src/_includes/macros/form.njk index 50b81db..88bbd30 100644 --- a/src/_includes/macros/form.njk +++ b/src/_includes/macros/form.njk @@ -177,5 +177,5 @@ {% endmacro %} {% macro button( text ) %} - + {% endmacro %} diff --git a/src/_includes/partials/components/contact-form.njk b/src/_includes/partials/components/contact-form.njk index fade93c..8a577c9 100644 --- a/src/_includes/partials/components/contact-form.njk +++ b/src/_includes/partials/components/contact-form.njk @@ -1,22 +1,44 @@ -{% from "macros/form.njk" import label, field, textarea, button %} +{% from "macros/form.njk" import label, field, select, option, textarea, checkboxes, button %} -
-
    -
  1. - {{ label("What’s your name?", "name") }} - {{ field( "text", "name", { required: true, placeholder: "Katherine Johnson", autocomplete: "name", autocorrect: "off", autocapitalize: "off" } ) }} -
  2. -
  3. - {{ label("What’s your email address?", "email") }} - {{ field( "email", "email", { required: true, placeholder: "katherine@johnson.tld", autocomplete: "email" } ) }} -
  4. -
  5. - {{ label("What’s on your mind?", "message") }} - {{ textarea( "message", { required: true, autocapitalize: "sentences", spellcheck: "true" } ) }} -
  6. - -
- {{ button("Send message") }} -
+
+ +
+

Nous contacter

+
+
    + {#
  1. + {{ label("Prénom", "forename") }} + {{ field( "text", "forename", { required: true, placeholder: "", autocomplete: "name", autocorrect: "off", autocapitalize: "off" } ) }} +
  2. #} +
  3. + {{ label("Nom", "name") }} + {{ field( "text", "name", { required: true, placeholder: "", autocomplete: "name", autocorrect: "off", autocapitalize: "off" } ) }} +
  4. +
  5. + {{ label("Email", "email") }} + {{ field( "email", "email", { required: true, placeholder: "", autocomplete: "email" } ) }} +
  6. +
  7. + {{ label("Je vous contacte pour :", "select") }} + {{ select( "select", [ + {label: "Obtenir un rendez-vous (décrivez votre projet en quelques lignes)", value: "option 1"}, + {label: "Obtenir des précisions sur le statut d’entrepreneur salarié", value: "option 2"}, + {label: "Proposer une mission à un coopérateur", value: "option 3"}, + {label: "Proposer un partenariat", value: "option 4"} + ], { required: true, options_before: [""], options_after: ["Autre demande"] } ) }} +
  8. +
  9. + {{ label("Votre message", "message") }} + {{ textarea( "message", { required: true, autocapitalize: "sentences", spellcheck: "true" } ) }} +
  10. +
  11. + {{ checkboxes("", "field-checkbox-name", [ "Je souhaite être tenu au courant de l’actualité Astrolabe"], { description: "" } ) }} +
  12. + {# #} +
+ {{ button("Envoyer") }} +
+
+
diff --git a/src/_includes/partials/components/sponsor.njk b/src/_includes/partials/components/sponsor.njk new file mode 100644 index 0000000..937b6d4 --- /dev/null +++ b/src/_includes/partials/components/sponsor.njk @@ -0,0 +1,3 @@ +
+
+
diff --git a/src/_includes/partials/global/site-head.njk b/src/_includes/partials/global/site-head.njk index aa1f0b1..ab4e635 100644 --- a/src/_includes/partials/global/site-head.njk +++ b/src/_includes/partials/global/site-head.njk @@ -2,7 +2,7 @@