Add back posts #15

Merged
tyler merged 1 commits from Add-back-posts into master 2022-12-23 23:25:07 +00:00
10 changed files with 206 additions and 9 deletions
Showing only changes of commit 2406df4104 - Show all commits

3
.gitmodules vendored Normal file
View File

@ -0,0 +1,3 @@
[submodule "src/site-posts"]
path = src/site-posts
url = git@git.clortox.com:Infrastructure/site-posts.git

View File

@ -37,7 +37,7 @@ class Article {
public function getPostData($postId) { public function getPostData($postId) {
$result = mysqli_query($this->client, 'SELECT * FROM post WHERE ID = ' . $postId); $result = mysqli_query($this->client, 'SELECT * FROM post WHERE ID = ' . $postId);
return mysqli_fetch_all($result); return mysqli_fetch_all($result)[0];
} }
} }

View File

@ -14,7 +14,7 @@ h1, h2, h3, h4 {
color: white; color: white;
} }
p, a, li, tr, td, span, noscript { p, a, li, tr, td, span, noscript, figcaption {
font-family: 'Lekton', Helvetica, Arial, sans-serif; font-family: 'Lekton', Helvetica, Arial, sans-serif;
font-size: 16px; font-size: 16px;
line-height: 25px; line-height: 25px;
@ -50,6 +50,61 @@ button:hover {
margin-top: 25px; margin-top: 25px;
} }
.list-clickable-div {
display: block;
width: calc(100% - 10px - 3px);
height: auto;
text-decoration: underline 0.15em rgba(255,255,255,0);
transition: 300ms;
border: dashed;
border-radius: 5px;
background-color: rgba(0,0,0,0.4);
margin: 5px;
}
.list-clickable-div p {
margin: 15px 5px;
}
.list-clickable-div:hover {
text-decoration: underline 0.15em rgba(255,255,255,1);
background-color: rgba(0,0,0,0.85);
}
.dashed-bottom {
border-bottom: 5px dashed white;
}
.dashed-border {
border: 5px dashed white;
}
.soft-background {
background: rgba(11,11,12, 0.3);
border-radius: 15px;
padding: 10px;
}
figure {
border: 5px dashed white;
padding: 5px;
}
figure img {
max-height: 40vh;
margin-left: auto;
margin-right: auto;
display: block;
}
figcaption {
text-align: center;
margin-top: 0.5em;
}
textarea { textarea {
max-height: 20em; max-height: 20em;

View File

@ -75,12 +75,6 @@
margin-top: -20px; margin-top: -20px;
} }
.soft-background {
background: rgba(11,11,12, 0.3);
border-radius: 15px;
padding: 10px;
}
.index-item { .index-item {
display: grid; display: grid;
align-content: center; align-content: center;

View File

@ -11,7 +11,7 @@
<body> <body>
<?php include 'common/header.php' ?> <?php include 'common/header.php' ?>
<div class="centered top-fade"> <div class="centered top-fade dashed-bottom">
<!--<a class="clickable-div" href="about.php"> --> <!--<a class="clickable-div" href="about.php"> -->
<div class="index-item single-column tagline-link"> <div class="index-item single-column tagline-link">
<h1>Hi, I'm Tyler</h1> <h1>Hi, I'm Tyler</h1>

29
src/posts/catalog.css Normal file
View File

@ -0,0 +1,29 @@
.catalog-div {
min-height: 30vh;
padding-top: 35px;
margin: 15px;
padding-left: 20px;
padding-right: 20px;
}
.link-float {
display: inline-block;
padding-left: 10px;
padding-right: 10px;
}
.inline-title {
display: inline-block;
}
.inline-date {
float: right;
display: inline;
}
.article-list {
min-height: 80%;
padding: 5px;
}

45
src/posts/catalog.php Normal file
View File

@ -0,0 +1,45 @@
<!DOCTYPE html>
<html lang="en">
<head>
<?php include '../common/include.php' ?>
<?php include '../common/article.php' ?>
<title>Tyler Perkins - Home</title>
<link rel="stylesheet" href="catalog.css">
</head>
<body>
<?php include '../common/header.php' ?>
<?php
$articleClient = Article::makeNewClient();
$posts = $articleClient->getAllPosts();
?>
<div class="catalog-div soft-background">
<h2>Post catalog</h2>
<div class="article-list">
<?php
foreach($posts as $post){
if($post == null)
continue;
$id = $post[0];
$author = $post[1];
$created_at = $post[2];
$title = $post[3];
$creation = new DateTime($created_at);
echo '<a class="list-clickable-div link-float" href="/posts/?id=' . $id . '">';
echo '<p class="inline-title">(' . $author . ') ' . $title . '</p>';
echo '<p class="inline-date">' . $creation->format('M j, Y') . '</p>';
echo '</a>';
}
?>
</div>
</div>
<?php include '../common/footer.php' ?>
</body>
</html>

23
src/posts/index.css Normal file
View File

@ -0,0 +1,23 @@
.post-wrapper {
min-height: 60vh;
margin: 15px;
}
.title-head {
min-height: 10vh;
margin-bottom: 35px;
padding-top: 2.75em;
padding-left: 20px;
padding-right: 10px;
padding-bottom: 0.3em;
border-radius: 0px;
}
.article-title {
margin: 5px;
}
.article-author {
margin: 5px;
}

47
src/posts/index.php Normal file
View File

@ -0,0 +1,47 @@
<!DOCTYPE html>
<html lang="en">
<head>
<?php include '../common/include.php' ?>
<?php include '../common/article.php' ?>
<title>Tyler Perkins - Home</title>
<link rel="stylesheet" href="index.css">
</head>
<body>
<?php include '../common/header.php' ?>
<?php
$reqId = $_GET["id"];
$articleClient = Article::makeNewClient();
if($reqId == null || !is_numeric($reqId)){
header('Location: /posts/catalog.php');
die();
}
$post = $articleClient->getPostData($reqId);
if($post == null) {
header('Location: /posts/catalog.php');
die();
}
$title = $post[3];
$author = $post[1];
?>
<div class="title-head soft-background dashed-bottom">
<h2 class="article-title"><?php echo $title ?></h2>
<p class="article-author">Written by <?php echo $author ?></p>
</div>
<div class="post-wrapper soft-background">
<?php
echo file_get_contents('../site-posts/' . $title . '.html');
?>
</div>
<?php include '../common/footer.php' ?>
</body>
</html>

1
src/site-posts Submodule

@ -0,0 +1 @@
Subproject commit b9bfe5dd2e189c28a51f00c5f9facc9415bba911