Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@
"doctrine/data-fixtures": "^2.2",
"doctrine/doctrine-fixtures-bundle": "^4.3",
"dotkernel/dot-cache": "^4.0",
"dotkernel/dot-dependency-injection": "^1.4",
"dotkernel/dot-errorhandler": "^5.0.0",
"dotkernel/dot-mail": "^5.4",
"dotkernel/dot-response-header": "^3.6",
"laminas/laminas-component-installer": "^3.5.0",
"laminas/laminas-config-aggregator": "^1.17.0",
Expand Down
5 changes: 2 additions & 3 deletions config/autoload/local.php.dist
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,12 @@ return [
'sitemap' => [
'path' => realpath(__DIR__ . '/../../public/sitemap.xml'),
],
// `dotkernel-packages-oss-lifecycle` is intentionally absent: it has a dedicated handler
// and is routed in Light\App\RoutesDelegator. Re-adding it here registers the path twice.
// `dotkernel-packages-oss-lifecycle` and `contact` are intentionally absent: they have dedicated
// handlers and are routed in Light\App\RoutesDelegator. Re-adding them here registers the path twice.
'routes' => [
'page' => [
// Linked from the footer on every page, so this route must stay registered.
'about' => 'about',
'contact' => 'contact',
'api' => 'api',
'admin' => 'admin',
'queue' => 'queue',
Expand Down
39 changes: 39 additions & 0 deletions config/autoload/mail.global.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?php

declare(strict_types=1);

$contactEmail = 'example@mail.com';

return [
'dot_mail' => [
'contact' => [
'message_options' => [
'from' => $contactEmail,
'from_name' => 'Dotkernel',
'to' => [$contactEmail],
'subject' => 'New contact form submission',
'body' => [
'content' => '',
'charset' => 'utf-8',
],
'attachments' => [
'files' => [],
'dir' => [
'iterate' => false,
'path' => 'data/mail/attachments',
'recursive' => false,
],
],
],
'transport' => 'sendmail',
],
'log' => [
'sent' => getcwd() . '/log/mail-sent.log',
],
],
'twig' => [
'globals' => [
'contact_email' => $contactEmail,
],
],
];
2 changes: 2 additions & 0 deletions config/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@
\Mezzio\Twig\ConfigProvider::class,

// Dotkernel packages
\Dot\DependencyInjection\ConfigProvider::class,
\Dot\ErrorHandler\ConfigProvider::class,
\Dot\Log\ConfigProvider::class,
\Dot\Mail\ConfigProvider::class,
\Dot\Cache\ConfigProvider::class,
\Dot\ResponseHeader\ConfigProvider::class,

Expand Down
2 changes: 1 addition & 1 deletion public/css/contact.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion public/js/app.js

Large diffs are not rendered by default.

39 changes: 5 additions & 34 deletions src/App/assets/js/components/_contact.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// Contact page: topic pills and the client-side "message sent" state.
// The form is not wired to a backend yet, so submit only swaps the panels.
(function () {
var form = document.querySelector('[data-contact-form]');
if (!form) {
Expand All @@ -8,41 +6,14 @@

var topicInput = form.querySelector('[data-contact-topic]');
var pills = form.querySelectorAll('[data-topic]');
var sent = document.querySelector('[data-contact-sent]');
var sentTopic = sent.querySelector('[data-contact-sent-topic]');
var reset = sent.querySelector('[data-contact-reset]');

function currentPill() {
return form.querySelector('[data-topic][aria-pressed="true"]');
}

function selectTopic(id) {
pills.forEach(function (pill) {
pill.setAttribute('aria-pressed', String(pill.getAttribute('data-topic') === id));
});
topicInput.value = id;
}

pills.forEach(function (pill) {
pill.addEventListener('click', function () {
selectTopic(pill.getAttribute('data-topic'));
var id = pill.getAttribute('data-topic');
pills.forEach(function (other) {
other.setAttribute('aria-pressed', String(other === pill));
});
topicInput.value = id;
});
});

form.addEventListener('submit', function (event) {
event.preventDefault();
var pill = currentPill();
sentTopic.textContent = pill ? pill.textContent : '';
form.hidden = true;
sent.hidden = false;
sent.querySelector('h2').focus({ preventScroll: true });
});

reset.addEventListener('click', function () {
form.reset();
selectTopic(pills[0].getAttribute('data-topic'));
sent.hidden = true;
form.hidden = false;
form.querySelector('input:not([type="hidden"])').focus();
});
})();
99 changes: 27 additions & 72 deletions src/App/assets/scss/components/_contact.scss
Original file line number Diff line number Diff line change
Expand Up @@ -284,24 +284,38 @@ html[data-theme="dark"] .contact-page {
}
}

.contact-consent {
display: flex;
align-items: flex-start;
gap: 10px;
font-size: 14px;
.contact-error {
margin: 0;
font-size: 13px;
color: var(--rose);
}

.contact-alert {
margin: 0;
padding: 14px 16px;
border-radius: 8px;
border: 1px solid;
font-size: 14.5px;
line-height: 1.55;
color: var(--text-muted);
cursor: pointer;

input {
width: 18px;
height: 18px;
margin: 2px 0 0;
flex-shrink: 0;
accent-color: var(--amber);
a {
color: inherit;
text-decoration: underline;
}
}

.contact-alert-success {
color: var(--teal);
background: var(--teal-dim);
border-color: var(--teal);
}

.contact-alert-error {
color: var(--rose);
background: var(--rose-dim);
border-color: var(--rose);
}

.contact-form-foot {
display: flex;
align-items: center;
Expand All @@ -323,61 +337,6 @@ html[data-theme="dark"] .contact-page {
}
}

.contact-sent {
min-height: 560px;
display: flex;
flex-direction: column;
justify-content: center;
gap: 18px;

&[hidden] {
display: none;
}

h2 {
font-size: 28px;
line-height: 1.2;
}

p {
max-width: 460px;
font-size: 16.5px;
line-height: 1.7;
}

strong {
color: var(--text);
font-weight: 600;
}

.btn {
height: 44px;
padding: 0 18px;
color: var(--text-muted);

&:hover {
border-color: var(--amber);
color: var(--text);
}
}
}

.contact-sent-icon {
width: 48px;
height: 48px;
border-radius: var(--radius);
display: flex;
align-items: center;
justify-content: center;
background: var(--teal-dim);
color: var(--teal);

svg {
width: 22px;
height: 22px;
}
}

/* FAQ */
.contact-faq-layout {
display: grid;
Expand Down Expand Up @@ -488,8 +447,4 @@ html[data-theme="dark"] .contact-page {
justify-content: center;
}
}

.contact-sent {
min-height: 360px;
}
}
Loading
Loading