JSFiddle - React, Tailwind, and code Playground
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>PikiDiary Widget</title>
<style>
body {
font-family: Arial, sans-serif;
background-color: #f4f4f4;
margin: 0;
padding: 20px;
}
.widget-container {
max-width: 500px;
margin: 0 auto;
background-color: #fff;
border-radius: 8px;
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
overflow: hidden;
}
.widget-header {
background-color: #007bff;
color: #fff;
padding: 10px 20px;
font-size: 1.5em;
text-align: center;
}
.post {
border-bottom: 1px solid #ddd;
padding: 15px 20px;
}
.post:last-child {
border-bottom: none;
}
.post-content {
font-size: 1em;
margin-bottom: 10px;
}
.post-timestamp {
font-size: 0.85em;
color: #666;
}
</style>
</head>
<body>
<div class="widget-container">
<div class="widget-header">PikiDiary Posts</div>
<div id="posts-container">
<!-- Posts will be dynamically added here -->
</div>
</div>
<script>
// Fetch posts from the API
fetch('https://pikidiary.lol/api/posts/jax')
.then(response => response.json())
.then(data => {
const postsContainer = document.getElementById('posts-container');
data.forEach(post => {
// Create a post element
const postElement = document.createElement('div');
postElement.classList.add('post');
// Add content to the post element
postElement.innerHTML = `
<div...