Skip to content

Commit

Permalink
Add contact page
Browse files Browse the repository at this point in the history
  • Loading branch information
falkodev committed Oct 15, 2024
1 parent d0de2f7 commit 74e7248
Show file tree
Hide file tree
Showing 5 changed files with 108 additions and 0 deletions.
1 change: 1 addition & 0 deletions server/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ require('apostrophe')({
'book-page': {},
'book-preview-widget': {},
'highlight-items-widget': {},
'contact-page': {},
donate: {},
'donate-page': {},
newsletter: {},
Expand Down
4 changes: 4 additions & 0 deletions server/modules/@apostrophecms/page/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ module.exports = {
name: 'author-page',
label: 'Author',
},
{
name: 'contact-page',
label: 'Contact',
},
],
park: [
{
Expand Down
50 changes: 50 additions & 0 deletions server/modules/contact-page/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
module.exports = {
extend: '@apostrophecms/page-type',
fields: {
add: {
heading: {
type: 'string',
},
paragraph: {
type: 'string',
textarea: true,
},
form: {
type: 'object',
fields: {
add: {
nameLabel: {
type: 'string',
},
emailLabel: {
type: 'string',
},
messageLabel: {
type: 'string',
},
},
},
},
},
group: {
basics: {
label: 'Basics',
fields: ['title', 'heading', 'paragraph', 'form'],
},
},
},
methods (self) {
return {
indexPage (req) {
self.setTemplate(req, 'index')
},
showPage (req) {
req.notFound = true
},
// dispatchAll () {
// self.dispatch('/', self.indexPage)
// self.dispatch('/:slug', self.showPage)
// },
}
},
}
19 changes: 19 additions & 0 deletions server/modules/contact-page/ui/src/index.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
.pdl-contact {
display: flex;

.pdl-contact__wrapper {
display: flex;
flex-direction: column;
align-items: start;
justify-content: center;
}
.pdl-contact__heading {
font-size: 113px;
font-weight: 450;
margin-top: 50px;
margin-left: 32px;
margin-bottom: 48px;
letter-spacing: -1px;
text-align: left;
}
}
34 changes: 34 additions & 0 deletions server/modules/contact-page/views/page.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{% extends "layout.html" %}
{% block title %}{{ data.page.title }}{% endblock %}

{% block main %}
<section class="pdl-contact">
<div class="pdl-contact__wrapper">
<h1 class="pdl-contact__heading">
{{ data.page.heading }}
</h1>
<div class="pdl-contact__paragraph">
{{ data.page.paragraph | safe }}
</div>
</div>

<div class="pdl-contact__wrapper">
<form class="pdl-contact__form" action="/contact" method="post">
<div class="pdl-contact__form-group">
<label for="name" class="pdl-contact__label">Name</label>
<input type="text" id="name" name="name" class="pdl-contact__input" required>
</div>
<div class="pdl-contact__form-group">
<label for="email" class="pdl-contact__label">Email</label>
<input type="email" id="email" name="email" class="pdl-contact__input" required>
</div>
<div class="pdl-contact__form-group">
<label for="message" class="pdl-contact__label">Message</label>
<textarea id="message" name="message" class="pdl-contact__textarea" required></textarea>
</div>
<button type="submit" class="pdl-contact__button">Send</button>
</form>
</div>
</section>
{% endblock %}

0 comments on commit 74e7248

Please sign in to comment.