Added routing system (/user/@ and /@) + custom css

This commit is contained in:
Bofh 2021-11-25 13:26:50 +01:00
parent 077d030757
commit f243b08ec9
6 changed files with 289 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
.*.swp

17
public/.htaccess Normal file
View File

@ -0,0 +1,17 @@
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews -Indexes
</IfModule>
RewriteEngine On
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>

169
public/css/custom.css Normal file
View File

@ -0,0 +1,169 @@
/* Mobile first queries */
/* Larger than mobile */
@media (min-width: 400px) {}
/* Larger than phablet */
@media (min-width: 550px) {}
/* Larger than tablet */
@media (min-width: 750px) {}
/* Larger than desktop */
@media (min-width: 1000px) {}
/* Larger than Desktop HD */
@media (min-width: 1200px) {}
/* Shared
*/
.button {
border-radius: 100px;
}
/* Sections
*/
.section {
padding: 8rem 0 7rem;
text-align: center;
}
.section-heading,
.section-description {
margin-bottom: 1.2rem;
}
/* Hero
*/
.phones {
position: relative;
}
.phone {
position: relative;
max-width: 80%;
margin: 3rem auto -12rem;
}
.phone + .phone {
display: none;
}
/* Values
*/
.values {
background-image: url(https://getskeleton.com/examples/landing/images/values-bg.jpg);
background-size: cover;
color: #fff;
padding-bottom: 5rem;
}
.value-multiplier {
margin-bottom: .5rem;
color: #11DFC7;
}
.value-heading {
margin-bottom: .3rem;
}
.value-description {
opacity: .8;
font-weight: 300;
}
/* Help
*/
.get-help {
border-bottom: 1px solid #ddd;
}
/* Categories
*/
.categories {
background-image: url(https://getskeleton.com/examples/landing/images/values-bg.jpg);
background-size: cover;
color: #fff;
}
.categories .section-description {
margin-bottom: 4rem;
}
/* Bigger than 550 */
@media (min-width: 550px) {
.section {
padding: 12rem 0 11rem;
}
.hero {
padding-bottom: 12rem;
text-align: left;
height: 165px;
}
.phone {
position: absolute;
top: -7rem;
right: 3rem;
max-height: 362px;
z-index: 3;
}
.phone + .phone {
top: -6rem;
display: block;
max-width: 73.8%;
right: 0;
z-index: 2;
max-height: 338px;
}
.hero-heading {
font-size: 2.4rem;
}
}
/* Bigger than 750 */
@media (min-width: 750px) {
.hero {
height: 190px;
}
.hero-heading {
font-size: 2.6rem;
}
.section {
padding: 14rem 0 15rem;
}
.hero {
padding: 16rem 0 14rem;
}
.section-description {
max-width: 60%;
margin-left: auto;
margin-right: auto;
}
.phone {
top: -14rem;
right: 5rem;
max-height: 510px;
}
.phone + .phone {
top: -12rem;
max-height: 472px;
}
.categories {
padding: 15rem 0 8rem;
}
}
/* Bigger than 1000 */
@media (min-width: 1000px) {
.section {
padding: 20rem 0 19rem;
}
.hero {
padding: 22rem 0;
}
.hero-heading {
font-size: 3.0rem;
}
.phone {
top: -16rem;
max-height: 615px;
}
.phone + .phone {
top: -14rem;
max-height: 570px;
}
}

74
public/index.php Normal file
View File

@ -0,0 +1,74 @@
<?php require '/src/base.php' ?>
<?php
if (str_starts_with($_SERVER['REQUEST_URI'], '/@')) {
require 'user/index.php'; die;
}
$p = [
'title' => 'RealFan - Your Way'
];
?>
<?php require '/src/views/head.php' ?>
<div class="section hero">
<div class="container">
<div class="row">
<div class="one-half column">
<h4 class="hero-heading"><?php l('home.hero', 'You are a <b>Real Fan</b> when you want your content creators to get the highest cut.') ?></h4>
<a class="button button-primary" href="/signup"><?php l('home.register', 'Sign up') ?></a>
</div>
<div class="one-half column phones">
<img class="phone" src="https://getskeleton.com/examples/landing/images/iphone.png">
<img class="phone" src="https://getskeleton.com/examples/landing/images/iphone.png">
</div>
</div>
</div>
</div>
<div class="section values">
<div class="container">
<div class="row">
<div class="one-third column value">
<h2 class="value-multiplier">67%</h2>
<h5 class="value-heading">Purchase Increase</h5>
<p class="value-description">Percentage of users more likely to purchase on mobile friendly site.</p>
</div>
<div class="one-third column value">
<h2 class="value-multiplier">90%</h2>
<h5 class="value-heading">Multi-device Users</h5>
<p class="value-description">Most of the world accesses the internet on multiple devices.</p>
</div>
<div class="one-third column value">
<h2 class="value-multiplier">66%</h2>
<h5 class="value-heading">Sad Users</h5>
<p class="value-description">Percentage of users that are frustrated with page load times.</p>
</div>
</div>
</div>
</div>
<div class="section get-help">
<div class="container">
<h3 class="section-heading">Need help getting started?</h3>
<p class="section-description">Skeleton is an amazingly easy place to start with responsive development. If you want to learn more, just visit the documentation!</p>
<a class="button button-primary" href="http://getskeleton.com">View Skeleton Docs</a>
</div>
</div>
<div class="section categories">
<div class="container">
<h3 class="section-heading">Responsive Images</h3>
<p class="section-description">Skeleton images sit easily in grid with .u-max-full-width class. I suggest exploring solution to serving different images based on device size.</p>
<div class="row">
<div class="one-half column category">
<img class="u-max-full-width" src="images/placeholder.png">
</div>
<div class="one-half column category">
<img class="u-max-full-width" src="images/placeholder.png">
</div>
</div>
</div>
</div>
<?php require '/src/views/foot.php' ?>

1
public/user/.htaccess Symbolic link
View File

@ -0,0 +1 @@
../.htaccess

27
public/user/index.php Normal file
View File

@ -0,0 +1,27 @@
<?php require_once '/src/base.php' ?>
<?php
# process URI
$path = trim($_SERVER['REDIRECT_URL'], '/');
$args = explode('/', $path);
# no args is very unlikely, but still
if (count($args) === 0) {
die('Unexpected error');
}
# support path if /user/@* instead of /@*
if (strtolower($args[0]) === 'user') {
$args = array_splice($args, 1);
}
# first arg => Fediverse ID
$fediverse_id = $args[0];
if (!preg_match('/^@[a-zA-Z0-9_]+@[a-z0-9\-\.]+$/', $fediverse_id)) {
die('The given arguments are not correct');
}
$args = array_splice($args, 1);
# show arguments
var_dump($fediverse_id);
var_dump($args);