fix: statcard without colours
This commit is contained in:
parent
e778c746b8
commit
9484692dfa
@ -7,6 +7,9 @@ import type { BlogParsedContent } from "@/shared/types";
|
|||||||
dayjs.extend(utc);
|
dayjs.extend(utc);
|
||||||
dayjs.extend(tz);
|
dayjs.extend(tz);
|
||||||
|
|
||||||
|
// TODO: make queryContent async so it doesn't delay
|
||||||
|
// execution of the template
|
||||||
|
|
||||||
const docs = await queryContent<BlogParsedContent>("/blog")
|
const docs = await queryContent<BlogParsedContent>("/blog")
|
||||||
.sort({ date: 1 })
|
.sort({ date: 1 })
|
||||||
.where({ _draft: false })
|
.where({ _draft: false })
|
||||||
|
@ -6,17 +6,19 @@ import type { GithubCommit, GithubPushEvent } from "@/shared/github";
|
|||||||
import type { Ref } from "vue";
|
import type { Ref } from "vue";
|
||||||
|
|
||||||
const FEED_URL = "https://api.github.com/users/potatoeggy/events";
|
const FEED_URL = "https://api.github.com/users/potatoeggy/events";
|
||||||
|
const imgUrl = ref("");
|
||||||
|
const href = ref("");
|
||||||
|
|
||||||
const results = (await useFetch(FEED_URL)).data as Ref<GithubPushEvent[]>;
|
onMounted(async () => {
|
||||||
|
const results = (await useFetch(FEED_URL, { initialCache: false }))
|
||||||
const latestEvent = results.value.find(
|
.data as Ref<GithubPushEvent[]>;
|
||||||
(event) => event.type === "PushEvent"
|
const latestEvent = results.value.find(
|
||||||
) as GithubPushEvent;
|
(event) => event.type === "PushEvent"
|
||||||
const latestCommit = latestEvent.payload.commits[0];
|
) as GithubPushEvent;
|
||||||
const imgUrl = `https://opengraph.githubassets.com/hash/${latestEvent.repo.name}/commit/${latestCommit.sha}`;
|
const latestCommit = latestEvent.payload.commits[0];
|
||||||
const href = `https://github.com/${latestEvent.repo.name}/commit/${latestCommit.sha}`;
|
imgUrl.value = `https://opengraph.githubassets.com/hash/${latestEvent.repo.name}/commit/${latestCommit.sha}`;
|
||||||
|
href.value = `https://github.com/${latestEvent.repo.name}/commit/${latestCommit.sha}`;
|
||||||
const [title, description] = latestCommit.message.split("\n\n");
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@ -35,6 +37,7 @@ const [title, description] = latestCommit.message.split("\n\n");
|
|||||||
<p v-if="description">{{ description }}</p>
|
<p v-if="description">{{ description }}</p>
|
||||||
</div>
|
</div>
|
||||||
-->
|
-->
|
||||||
|
<noscript> Enable JavaScript to see the latest commit! </noscript>
|
||||||
</HomeStatBox>
|
</HomeStatBox>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
@ -22,12 +22,22 @@ const {
|
|||||||
}>();
|
}>();
|
||||||
|
|
||||||
const padding = clearstyles ? "0" : "1rem";
|
const padding = clearstyles ? "0" : "1rem";
|
||||||
const height = forceheight ?? "auto";
|
const height = forceheight ?? "100%";
|
||||||
|
|
||||||
|
// v-bind DOES NOT WORK on initial render
|
||||||
|
// so unfortunately we have to use the old way
|
||||||
|
|
||||||
|
const cssVars = {
|
||||||
|
"--padding": padding,
|
||||||
|
"--height": height,
|
||||||
|
"--color": color,
|
||||||
|
"--darkcolor": darkcolor,
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<a class="no-underline inline-block flex" :href="href">
|
<a class="no-underline inline-block flex flex-col items-stretch" :href="href">
|
||||||
<div class="container box">
|
<div class="container box" :style="cssVars">
|
||||||
<p class="m-0 w-full title">{{ title }}</p>
|
<p class="m-0 w-full title">{{ title }}</p>
|
||||||
<div class="main-content">
|
<div class="main-content">
|
||||||
<slot />
|
<slot />
|
||||||
@ -43,8 +53,8 @@ const height = forceheight ?? "auto";
|
|||||||
* mobile
|
* mobile
|
||||||
*/
|
*/
|
||||||
width: 28rem;
|
width: 28rem;
|
||||||
height: v-bind(height);
|
height: var(--height);
|
||||||
border: 0.5rem solid v-bind(color);
|
border: 0.5rem solid var(--color);
|
||||||
border-radius: 0.5rem;
|
border-radius: 0.5rem;
|
||||||
transition: transform 0.2s ease;
|
transition: transform 0.2s ease;
|
||||||
box-shadow: 0 0.1rem 0.5rem 0 gray;
|
box-shadow: 0 0.1rem 0.5rem 0 gray;
|
||||||
@ -61,17 +71,17 @@ html.dark .container {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.main-content {
|
.main-content {
|
||||||
padding: v-bind(padding);
|
padding: var(--padding);
|
||||||
padding-top: 0;
|
padding-top: 0;
|
||||||
overflow-wrap: break-word;
|
overflow-wrap: break-word;
|
||||||
}
|
}
|
||||||
|
|
||||||
.title {
|
.title {
|
||||||
background: v-bind(color);
|
background: var(--color);
|
||||||
}
|
}
|
||||||
|
|
||||||
html.dark .title {
|
html.dark .title {
|
||||||
background: v-bind(darkcolor);
|
background: var(--dark-color);
|
||||||
}
|
}
|
||||||
|
|
||||||
@media screen and (max-width: 600px) {
|
@media screen and (max-width: 600px) {
|
||||||
|
@ -9,7 +9,9 @@ useTitle("Home");
|
|||||||
<main class="flex flex-col items-center justify-around gap-8">
|
<main class="flex flex-col items-center justify-around gap-8">
|
||||||
<h1>Welcome!</h1>
|
<h1>Welcome!</h1>
|
||||||
<p>What are you here to see?</p>
|
<p>What are you here to see?</p>
|
||||||
<div class="flex justify-around items-stretch w-full flex-wrap gap-y-10">
|
<div
|
||||||
|
class="flex justify-around items-stretch w-full flex-wrap gap-x-8 gap-y-10"
|
||||||
|
>
|
||||||
<BlogStatBox />
|
<BlogStatBox />
|
||||||
<StoryStatBox />
|
<StoryStatBox />
|
||||||
<CommitStatBox />
|
<CommitStatBox />
|
||||||
|
Loading…
Reference in New Issue
Block a user