design: pop more color

This commit is contained in:
Julien Calixte
2024-12-07 13:28:34 +01:00
parent 5f9a154f8c
commit ddc27e2c1f
5 changed files with 69 additions and 21 deletions

View File

@@ -0,0 +1,45 @@
<script setup lang="ts">
import fontColorContrast from 'font-color-contrast'
import { getHex } from 'pastel-color'
import { useGitHubLogin } from '@/hooks/useGitHubLogin.hook'
import { useFavoriteRepos } from '@/modules/repo/hooks/useFavoriteRepos.hook'
const { username } = useGitHubLogin()
const { savedFavoriteRepos } = useFavoriteRepos()
const getStyle = (repo: string) => {
const backgroundColor = getHex(repo)
return { backgroundColor, color: fontColorContrast(backgroundColor) }
}
</script>
<template>
<section v-if="savedFavoriteRepos.length" class="repo-list">
<router-link
v-for="favoriteRepo in savedFavoriteRepos"
:key="favoriteRepo._id"
:to="{
name: 'FluxNoteView',
params: {
user: username,
repo: favoriteRepo.name
}
}"
class="button"
:style="getStyle(`${username}${favoriteRepo.name}`)"
>
{{ favoriteRepo.name }}
</router-link>
</section>
</template>
<style scoped lang="scss">
.repo-list {
a {
border: 0;
width: 100px;
height: 80px;
}
}
</style>