Initial commit: PRAutoBlogger v0.1.0 with frontend posts widget

This commit is contained in:
Terence Ong
2026-04-10 23:33:42 +07:00
parent 68c6f67bcf
commit 88d674d679
65 changed files with 2178 additions and 1084 deletions

349
assets/css/posts-widget.css Normal file
View File

@@ -0,0 +1,349 @@
/**
* PRAutoBlogger Posts Widget — Frontend Styles
*
* Uses CSS custom properties from the Peptide Starter theme so the widget
* automatically adapts to light/dark mode via data-theme on <html>.
*
* Theme variable mapping:
* --color-text-primary → headings, titles
* --color-text-secondary → body text, excerpts
* --color-text-tertiary → muted text (dates, reading time)
* --color-bg-primary → page background
* --color-bg-secondary → card background
* --color-bg-tertiary → card hover, placeholder backgrounds
* --color-border-default → card borders, dividers
* --color-border-subtle → lighter borders
* --color-brand-primary → accent (links, hover states, focus rings)
* --radius-md → card border radius (8px)
* --transition-normal → hover/focus transitions (200ms)
*
* All classes prefixed with `prab-` to avoid collisions with theme/plugins.
*
* @see includes/frontend/class-posts-widget.php — PHP class that enqueues this.
* @see assets/js/posts-widget.js — React component that uses these classes.
* @see peptide-starter/style.css — Theme CSS with variable definitions.
*/
/* ===== Widget Container ===== */
.prab-posts-widget {
max-width: 1100px;
margin: 0 auto;
padding: var(--spacing-4xl, 80px) var(--spacing-md, 16px);
}
.prab-widget-header {
text-align: center;
margin-bottom: var(--spacing-2xl, 48px);
}
.prab-widget-header h2 {
font-size: var(--text-h2, 30px);
font-weight: var(--text-h2-weight, 700);
line-height: var(--text-h2-lh, 1.25);
letter-spacing: var(--text-h2-ls, -0.015em);
color: var(--color-text-primary, #f9fafb);
margin-bottom: var(--spacing-sm, 8px);
}
.prab-widget-header p {
font-size: var(--text-body-lg, 15px);
color: var(--color-text-secondary, #94a3b8);
margin: 0;
}
/* ===== Grid Layout ===== */
.prab-posts-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
gap: var(--spacing-lg, 24px);
}
/* ===== Post Card ===== */
.prab-post-card {
background: var(--color-bg-secondary, #1f2937);
border: 1px solid var(--color-border-default, #374151);
border-radius: var(--radius-md, 8px);
overflow: hidden;
transition: border-color var(--transition-normal, 200ms ease-out),
transform var(--transition-normal, 200ms ease-out),
box-shadow var(--transition-normal, 200ms ease-out);
display: flex;
flex-direction: column;
text-decoration: none;
color: inherit;
}
.prab-post-card:hover {
border-color: var(--color-text-tertiary, #9ca3af);
transform: translateY(-2px);
box-shadow: var(--shadow-lg, 0 10px 15px rgba(0, 0, 0, 0.1));
}
.prab-post-card:focus-visible {
outline: var(--focus-width, 2px) solid var(--focus-color, var(--color-brand-primary, #3b82f6));
outline-offset: var(--focus-offset, 2px);
box-shadow: var(--focus-shadow, 0 0 0 4px rgba(59, 130, 246, 0.15));
}
/* Featured image area */
.prab-post-image {
width: 100%;
height: 180px;
background: var(--color-bg-tertiary, #374151);
position: relative;
overflow: hidden;
}
.prab-post-image img {
width: 100%;
height: 100%;
object-fit: cover;
transition: transform var(--transition-slow, 300ms ease-in-out);
}
.prab-post-card:hover .prab-post-image img {
transform: scale(1.03);
}
/* Placeholder for posts without featured images */
.prab-post-image--placeholder {
display: flex;
align-items: center;
justify-content: center;
}
.prab-post-image--placeholder svg {
width: 48px;
height: 48px;
opacity: 0.15;
color: var(--color-text-primary, #f9fafb);
}
/* Card body */
.prab-post-body {
padding: var(--spacing-md, 16px) var(--spacing-lg, 24px) var(--spacing-lg, 24px);
flex: 1;
display: flex;
flex-direction: column;
}
/* Category badge + date row */
.prab-post-meta {
display: flex;
align-items: center;
gap: var(--spacing-sm, 8px);
margin-bottom: var(--spacing-md, 16px);
flex-wrap: wrap;
}
.prab-badge {
display: inline-flex;
align-items: center;
padding: 3px 10px;
border-radius: var(--radius-sm, 4px);
font-size: var(--text-label, 11px);
font-weight: var(--text-label-weight, 500);
letter-spacing: 0.04em;
text-transform: uppercase;
}
/* Category badge colors — these are semantic and stay consistent in both modes */
.prab-badge--guides { color: var(--color-status-success, #10b981); background: rgba(16, 185, 129, 0.12); }
.prab-badge--solutions { color: #8b5cf6; background: rgba(139, 92, 246, 0.12); }
.prab-badge--comparisons { color: var(--color-status-warning, #f59e0b); background: rgba(245, 158, 11, 0.12); }
.prab-badge--articles { color: var(--color-brand-primary, #3b82f6); background: rgba(59, 130, 246, 0.12); }
.prab-badge--default { color: var(--color-text-tertiary, #9ca3af); background: rgba(148, 163, 184, 0.12); }
.prab-post-date {
font-size: var(--text-body-sm, 12px);
color: var(--color-text-tertiary, #9ca3af);
}
/* Title */
.prab-post-title {
font-size: var(--text-h5, 17px);
font-weight: var(--text-h5-weight, 700);
line-height: var(--text-h5-lh, 1.4);
color: var(--color-text-primary, #f9fafb);
margin-bottom: var(--spacing-sm, 8px);
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
transition: color var(--transition-normal, 200ms ease-out);
}
.prab-post-card:hover .prab-post-title {
color: var(--color-brand-primary, #3b82f6);
}
/* Excerpt */
.prab-post-excerpt {
font-size: var(--text-body-md, 13px);
color: var(--color-text-secondary, #d1d5db);
line-height: 1.6;
display: -webkit-box;
-webkit-line-clamp: 3;
-webkit-box-orient: vertical;
overflow: hidden;
flex: 1;
margin: 0;
}
/* Footer: reading time + arrow */
.prab-post-footer {
display: flex;
align-items: center;
justify-content: space-between;
margin-top: var(--spacing-md, 16px);
padding-top: var(--spacing-md, 16px);
border-top: 1px solid var(--color-border-default, #374151);
}
.prab-reading-time {
font-size: var(--text-body-sm, 12px);
color: var(--color-text-tertiary, #9ca3af);
display: flex;
align-items: center;
gap: 5px;
}
.prab-reading-time svg {
width: 14px;
height: 14px;
opacity: 0.7;
}
.prab-read-more {
font-size: var(--text-body-md, 13px);
font-weight: 500;
color: var(--color-brand-primary, #3b82f6);
display: flex;
align-items: center;
gap: 4px;
transition: gap var(--transition-normal, 200ms ease-out);
}
.prab-post-card:hover .prab-read-more {
gap: 8px;
}
.prab-read-more svg {
width: 16px;
height: 16px;
}
/* ===== View All Link ===== */
.prab-view-all {
text-align: center;
margin-top: var(--spacing-2xl, 48px);
}
.prab-view-all a {
display: inline-flex;
align-items: center;
gap: var(--spacing-sm, 8px);
padding: var(--spacing-md, 16px) var(--spacing-xl, 32px);
background: transparent;
border: 1px solid var(--color-border-default, #374151);
border-radius: var(--radius-md, 8px);
color: var(--color-text-primary, #f9fafb);
font-size: var(--text-body-md, 13px);
font-weight: 500;
text-decoration: none;
transition: border-color var(--transition-normal, 200ms ease-out),
background var(--transition-normal, 200ms ease-out);
}
.prab-view-all a:hover {
border-color: var(--color-brand-primary, #3b82f6);
background: rgba(59, 130, 246, 0.08);
}
.prab-view-all a:focus-visible {
outline: var(--focus-width, 2px) solid var(--focus-color, var(--color-brand-primary, #3b82f6));
outline-offset: var(--focus-offset, 2px);
box-shadow: var(--focus-shadow, 0 0 0 4px rgba(59, 130, 246, 0.15));
}
/* ===== Loading Skeleton ===== */
.prab-skeleton {
background: linear-gradient(
90deg,
var(--color-bg-secondary, #1f2937) 25%,
var(--color-bg-tertiary, #374151) 50%,
var(--color-bg-secondary, #1f2937) 75%
);
background-size: 200% 100%;
animation: prab-shimmer 1.5s infinite;
border-radius: var(--radius-sm, 4px);
}
@keyframes prab-shimmer {
0% { background-position: 200% 0; }
100% { background-position: -200% 0; }
}
.prab-skeleton-image { height: 180px; border-radius: var(--radius-md, 8px) var(--radius-md, 8px) 0 0; }
.prab-skeleton-badge { width: 60px; height: 20px; }
.prab-skeleton-title { height: 22px; width: 85%; margin-bottom: 8px; }
.prab-skeleton-title-2 { height: 22px; width: 60%; margin-bottom: 12px; }
.prab-skeleton-text { height: 16px; width: 100%; margin-bottom: 6px; }
.prab-skeleton-text-2 { height: 16px; width: 75%; }
/* ===== Empty State ===== */
.prab-empty-state {
text-align: center;
padding: var(--spacing-4xl, 80px) var(--spacing-md, 16px);
background: var(--color-bg-secondary, #1f2937);
border: 1px solid var(--color-border-default, #374151);
border-radius: var(--radius-md, 8px);
}
.prab-empty-state svg {
width: 64px;
height: 64px;
color: var(--color-text-tertiary, #9ca3af);
margin-bottom: var(--spacing-md, 16px);
opacity: 0.5;
}
.prab-empty-state h3 {
font-size: var(--text-h4, 20px);
font-weight: var(--text-h4-weight, 600);
color: var(--color-text-primary, #f9fafb);
margin-bottom: var(--spacing-sm, 8px);
}
.prab-empty-state p {
font-size: var(--text-body-md, 13px);
color: var(--color-text-secondary, #d1d5db);
margin: 0;
}
/* ===== Error State ===== */
.prab-error-state {
text-align: center;
padding: var(--spacing-2xl, 48px) var(--spacing-md, 16px);
color: var(--color-text-secondary, #d1d5db);
font-size: var(--text-body-md, 13px);
}
/* ===== Responsive ===== */
@media (max-width: 479px) {
.prab-posts-grid {
grid-template-columns: 1fr;
}
.prab-widget-header h2 {
font-size: var(--text-h3, 24px);
}
.prab-posts-widget {
padding: var(--spacing-2xl, 48px) var(--spacing-md, 16px);
}
}
@media (min-width: 480px) and (max-width: 767px) {
.prab-posts-grid {
grid-template-columns: 1fr;
}
}