flash.moe/pages/contact.php

50 lines
1.6 KiB
PHP

<?php
namespace Makai;
$router->get('/contact.php', mkiRedirect('/contact'));
$router->get('/contact.html', mkiRedirect('/contact'));
$router->get('/nintendo', mkiRedirect('/contact'));
$router->get('/nintendo.php', mkiRedirect('/contact'));
$router->get('/contact', function() use ($db) {
$contacts = (new Contacts($db))->getAll();
$body = fm_component('header', [
'title' => 'flash.moe / contact',
]);
$body .= <<<HTML
<div class="section">
<div class="section-content">
<div class="section-background"></div>
<h1>Contacts</h1>
</div>
</div>
<div class="socials">
HTML;
foreach($contacts as $contact) {
$body .= '<div class="social social-' . $contact->getName() . '" style="--social-colour: ' . $contact->getColourHex() . '">';
if($contact->hasLink()) {
$body .= '<a href="' . $contact->getLink() . '" class="social-background" target="_blank" rel="noopener"></a>';
} else {
$body .= '<div class="social-background" onclick="fm.selectTextInElement(this.parentNode.querySelector(\'.social-handle\')); fm.copySelectedText();"></div>';
}
$body .= <<<HTML
<div class="social-icon {$contact->getIcon()}"></div>
<div class="social-content">
<div class="social-name">{$contact->getName()}</div>
<div class="social-handle">{$contact->getDisplay()}</div>
</div>
</div>
HTML;
}
$body .= '</div>';
$body .= fm_component('footer');
return $body;
});