feat: public notes directly to list
This commit is contained in:
@@ -1,21 +1,27 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import fontColorContrast from 'font-color-contrast'
|
import fontColorContrast from "font-color-contrast"
|
||||||
import { getHex } from 'pastel-color'
|
import { getHex } from "pastel-color"
|
||||||
|
|
||||||
import { useGitHubLogin } from '@/hooks/useGitHubLogin.hook'
|
import { useGitHubLogin } from "@/hooks/useGitHubLogin.hook"
|
||||||
import { useFavoriteRepos } from '@/modules/repo/hooks/useFavoriteRepos.hook'
|
import { useFavoriteRepos } from "@/modules/repo/hooks/useFavoriteRepos.hook"
|
||||||
|
|
||||||
const { username } = useGitHubLogin()
|
const { username } = useGitHubLogin()
|
||||||
const { savedFavoriteRepos } = useFavoriteRepos()
|
const { savedFavoriteRepos } = useFavoriteRepos()
|
||||||
|
|
||||||
const getStyle = (repo: string) => {
|
const getStyle = (seed: string) => {
|
||||||
const backgroundColor = getHex(repo)
|
const backgroundColor = getHex(seed)
|
||||||
return { backgroundColor, color: fontColorContrast(backgroundColor) }
|
return { backgroundColor, color: fontColorContrast(backgroundColor) }
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<section v-if="savedFavoriteRepos.length" class="repo-list">
|
<section class="repo-list">
|
||||||
|
<router-link
|
||||||
|
:to="{ name: 'PublicNoteListView' }"
|
||||||
|
class="btn"
|
||||||
|
:style="getStyle(``)"
|
||||||
|
>Public notes</router-link
|
||||||
|
>
|
||||||
<router-link
|
<router-link
|
||||||
v-for="favoriteRepo in savedFavoriteRepos"
|
v-for="favoriteRepo in savedFavoriteRepos"
|
||||||
:key="favoriteRepo._id"
|
:key="favoriteRepo._id"
|
||||||
@@ -23,8 +29,8 @@ const getStyle = (repo: string) => {
|
|||||||
name: 'FluxNoteView',
|
name: 'FluxNoteView',
|
||||||
params: {
|
params: {
|
||||||
user: username,
|
user: username,
|
||||||
repo: favoriteRepo.name
|
repo: favoriteRepo.name,
|
||||||
}
|
},
|
||||||
}"
|
}"
|
||||||
class="btn"
|
class="btn"
|
||||||
:style="getStyle(`${favoriteRepo.name}-${username}`)"
|
:style="getStyle(`${favoriteRepo.name}-${username}`)"
|
||||||
@@ -36,6 +42,10 @@ const getStyle = (repo: string) => {
|
|||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
.repo-list {
|
.repo-list {
|
||||||
|
display: flex;
|
||||||
|
gap: 1rem;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
|
||||||
a {
|
a {
|
||||||
border: 0;
|
border: 0;
|
||||||
width: 160px;
|
width: 160px;
|
||||||
|
|||||||
@@ -7,12 +7,6 @@
|
|||||||
|
|
||||||
<repo-list />
|
<repo-list />
|
||||||
|
|
||||||
<p>
|
|
||||||
<router-link :to="{ name: 'PublicNoteListView' }" class="btn"
|
|
||||||
>Public notes</router-link
|
|
||||||
>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<last-visited />
|
<last-visited />
|
||||||
|
|
||||||
<div class="get-started">
|
<div class="get-started">
|
||||||
|
|||||||
Reference in New Issue
Block a user