mirror of
https://github.com/ArthurDanjou/artsite.git
synced 2026-01-14 18:59:59 +01:00
Refactor: Extract project color mappings to composable
Co-authored-by: ArthurDanjou <29738535+ArthurDanjou@users.noreply.github.com>
This commit is contained in:
21
app/composables/projects.ts
Normal file
21
app/composables/projects.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
export function useProjectColors() {
|
||||
const statusColors: Record<string, string> = {
|
||||
'active': 'green',
|
||||
'completed': 'blue',
|
||||
'archived': 'gray',
|
||||
'in-progress': 'amber'
|
||||
}
|
||||
|
||||
const typeColors: Record<string, string> = {
|
||||
'Personal Project': 'purple',
|
||||
'Academic Project': 'sky',
|
||||
'Infrastructure Project': 'emerald',
|
||||
'Internship Project': 'orange',
|
||||
'Research Project': 'blue'
|
||||
}
|
||||
|
||||
return {
|
||||
statusColors,
|
||||
typeColors
|
||||
}
|
||||
}
|
||||
@@ -30,19 +30,7 @@ useSeoMeta({
|
||||
twitterCard: 'summary_large_image'
|
||||
})
|
||||
|
||||
const statusColors: Record<string, string> = {
|
||||
'active': 'green',
|
||||
'completed': 'blue',
|
||||
'archived': 'gray',
|
||||
'in-progress': 'amber'
|
||||
}
|
||||
|
||||
const typeColors: Record<string, string> = {
|
||||
'Personal Project': 'purple',
|
||||
'Academic Project': 'sky',
|
||||
'Infrastructure Project': 'emerald',
|
||||
'Internship Project': 'orange'
|
||||
}
|
||||
const { statusColors, typeColors } = useProjectColors()
|
||||
|
||||
const formattedDate = computed(() => {
|
||||
if (!project.value?.publishedAt) return null
|
||||
|
||||
@@ -41,19 +41,7 @@ const filteredProjects = computed(() => {
|
||||
})
|
||||
})
|
||||
|
||||
const statusColors: Record<string, string> = {
|
||||
'active': 'green',
|
||||
'completed': 'blue',
|
||||
'archived': 'gray',
|
||||
'in-progress': 'amber'
|
||||
}
|
||||
|
||||
const typeColors: Record<string, string> = {
|
||||
'Personal Project': 'purple',
|
||||
'Academic Project': 'sky',
|
||||
'Infrastructure Project': 'emerald',
|
||||
'Internship Project': 'orange'
|
||||
}
|
||||
const { statusColors, typeColors } = useProjectColors()
|
||||
|
||||
function toggleTag(tag: string) {
|
||||
const index = selectedTags.value.indexOf(tag)
|
||||
|
||||
Reference in New Issue
Block a user