feat: add blog category selection and update project section title
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
import { COLLECTION_CONFIGS, PODCAST_LABELS } from "./configs.js";
|
import { BLOG_CATEGORIES, COLLECTION_CONFIGS, PODCAST_LABELS } from "./configs.js";
|
||||||
|
|
||||||
const state = {
|
const state = {
|
||||||
activeTab: "blog",
|
activeTab: "blog",
|
||||||
@@ -136,6 +136,23 @@ function emptyBlogDraft() {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function ensureBlogCategorySelect(selectedCategory = "General") {
|
||||||
|
const options = BLOG_CATEGORIES;
|
||||||
|
const normalizedSelected = String(selectedCategory || "").trim();
|
||||||
|
const hasSelected = options.includes(normalizedSelected);
|
||||||
|
const finalValue = hasSelected ? normalizedSelected : "General";
|
||||||
|
|
||||||
|
el.blogCategory.innerHTML = "";
|
||||||
|
for (const category of options) {
|
||||||
|
const option = document.createElement("option");
|
||||||
|
option.value = category;
|
||||||
|
option.textContent = category;
|
||||||
|
el.blogCategory.appendChild(option);
|
||||||
|
}
|
||||||
|
|
||||||
|
el.blogCategory.value = finalValue;
|
||||||
|
}
|
||||||
|
|
||||||
function currentBlogDraft() {
|
function currentBlogDraft() {
|
||||||
return {
|
return {
|
||||||
slug: el.blogSlug.value.trim(),
|
slug: el.blogSlug.value.trim(),
|
||||||
@@ -154,7 +171,7 @@ function fillBlogForm(post) {
|
|||||||
const draft = post || emptyBlogDraft();
|
const draft = post || emptyBlogDraft();
|
||||||
el.blogSlug.value = draft.slug || "";
|
el.blogSlug.value = draft.slug || "";
|
||||||
el.blogTitle.value = draft.title || "";
|
el.blogTitle.value = draft.title || "";
|
||||||
el.blogCategory.value = draft.category || "General";
|
ensureBlogCategorySelect(draft.category || "General");
|
||||||
el.blogDate.value = draft.date || "";
|
el.blogDate.value = draft.date || "";
|
||||||
el.blogReadTime.value = draft.readTime || "";
|
el.blogReadTime.value = draft.readTime || "";
|
||||||
el.blogAuthor.value = draft.author || "Poyraz Avsever";
|
el.blogAuthor.value = draft.author || "Poyraz Avsever";
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
|
|
||||||
|
export const BLOG_CATEGORIES = ["Frontend", "UX", "Yazilim", "TypeScript", "Testing", "General"];
|
||||||
|
|
||||||
export const COLLECTION_CONFIGS = {
|
export const COLLECTION_CONFIGS = {
|
||||||
announcement: {
|
announcement: {
|
||||||
label: "Announcement",
|
label: "Announcement",
|
||||||
|
|||||||
@@ -66,7 +66,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<label for="blog-category">Category</label>
|
<label for="blog-category">Category</label>
|
||||||
<input id="blog-category" placeholder="React" />
|
<select id="blog-category"></select>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<label for="blog-date">Date</label>
|
<label for="blog-date">Date</label>
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ export async function ProjectsContent() {
|
|||||||
|
|
||||||
<ProjectSection title="Mobil Uygulamalar" items={MOBILE_APPS} />
|
<ProjectSection title="Mobil Uygulamalar" items={MOBILE_APPS} />
|
||||||
<ProjectSection title="Web Uygulamaları" items={WEB_APPS} />
|
<ProjectSection title="Web Uygulamaları" items={WEB_APPS} />
|
||||||
<ProjectSection title="Açık Kaynak Araçlar" items={FIGMA_TEMPLATES} />
|
<ProjectSection title="Figma Tasarımları" items={FIGMA_TEMPLATES} />
|
||||||
|
|
||||||
<section className="space-y-2">
|
<section className="space-y-2">
|
||||||
<Typography variant="large" className="text-base">
|
<Typography variant="large" className="text-base">
|
||||||
|
|||||||
Reference in New Issue
Block a user