diff --git a/src/pages/NewsDetail.jsx b/src/pages/NewsDetail.jsx index 4c25fc3..ea374df 100644 --- a/src/pages/NewsDetail.jsx +++ b/src/pages/NewsDetail.jsx @@ -3,6 +3,13 @@ import { useParams, Link } from 'react-router-dom'; import { wpApi } from '../api/wordpress'; +// Helper to handle raw markdown formatting if present +const formatContent = (htmlContent) => { + if (!htmlContent) return ''; + // Replace **text** with text (Basic bold support) + return htmlContent.replace(/\*\*(.*?)\*\*/g, '$1'); +}; + const NewsDetail = () => { const { slug } = useParams(); const [post, setPost] = useState(null); @@ -81,7 +88,7 @@ const NewsDetail = () => { {/* Content */}
{/* Footer / Navigation */} diff --git a/src/styles/main.css b/src/styles/main.css index 6569423..1d681a0 100644 --- a/src/styles/main.css +++ b/src/styles/main.css @@ -1327,7 +1327,7 @@ img { .news-article { background-color: var(--white); - max-width: 800px; + max-width: 1200px; width: 100%; margin: 0 20px; padding: 3rem; @@ -1374,6 +1374,16 @@ img { border-radius: 0.75rem; overflow: hidden; box-shadow: var(--shadow); + display: flex; + justify-content: center; + background-color: var(--light-gray); + /* Optional: background for transparent images */ +} + +.article-image { + max-width: 100%; + height: auto; + object-fit: contain; } /* ... NewsDetail content styles ... */ @@ -1473,4 +1483,138 @@ img { border-color: var(--primary-color); transform: translateY(-2px); box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1); +} + +/* ========================================= + 6. ARTICLE CONTENT STYLES (WordPress) + ========================================= */ +.article-content { + line-height: 1.8; + color: var(--text-color); + font-size: 1.05rem; +} + +.article-content p { + margin-bottom: 1.5rem; +} + +.article-content h1, +.article-content h2, +.article-content h3, +.article-content h4, +.article-content h5, +.article-content h6 { + margin-top: 2.5rem; + margin-bottom: 1rem; + font-weight: 700; + line-height: 1.3; + color: var(--text-color); +} + +.article-content h1 { + font-size: 2rem; +} + +.article-content h2 { + font-size: 1.75rem; + border-bottom: 2px solid var(--border-color); + padding-bottom: 0.5rem; +} + +.article-content h3 { + font-size: 1.5rem; +} + +.article-content h4 { + font-size: 1.25rem; +} + +.article-content h5 { + font-size: 1.1rem; +} + +.article-content h6 { + font-size: 1rem; +} + +.article-content ul, +.article-content ol { + margin-bottom: 1.5rem; + padding-left: 1.5rem; +} + +.article-content ul { + list-style-type: disc; +} + +.article-content ol { + list-style-type: decimal; +} + +.article-content li { + margin-bottom: 0.5rem; +} + +.article-content strong, +.article-content b { + font-weight: 700; + color: #0f172a; +} + +.article-content a { + color: var(--primary-color); + text-decoration: underline; +} + +.article-content img { + max-width: 100%; + height: auto; + border-radius: 8px; + margin: 2rem 0; + box-shadow: var(--shadow); +} + +.article-content blockquote { + border-left: 4px solid var(--primary-color); + padding: 1rem; + margin: 1.5rem 0; + background-color: var(--light-gray); + border-radius: 0 8px 8px 0; + font-style: italic; +} + +/* Helper Classes for Alignments */ +.article-content .aligncenter { + display: block; + margin: 0 auto 2rem; + text-align: center; +} + +.article-content .alignright { + float: right; + margin-left: 1.5rem; + margin-bottom: 1.5rem; +} + +.article-content .alignleft { + float: left; + margin-right: 1.5rem; + margin-bottom: 1.5rem; +} + +/* Gutenberg Text Alignment */ +.article-content .has-text-align-center { + text-align: center; +} + +.article-content .has-text-align-right { + text-align: right; +} + +.article-content .has-text-align-left { + text-align: left; +} + +.article-content .has-text-align-justify { + text-align: justify; } \ No newline at end of file