feat: better repository card
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Lucien Cartier-Tilet 2023-05-08 15:57:45 +02:00
parent 1e738b51b7
commit 1885072da2
Signed by: phundrak
GPG Key ID: BD7789E705CB8DCA
4 changed files with 40 additions and 19 deletions

View File

@ -1,5 +1,6 @@
<template>
<ApiLoader :url="fetchUrl" @dataLoaded="filterRepos" cache-name="repos" />
<slot />
</template>
<script setup lang="ts">

View File

@ -1,22 +1,18 @@
<template>
<div
class="githubRepo flex-row flex-space-between gap-1rem rounded-corners center"
>
<div class="githubRepo flex-col flex-space-between gap-1rem rounded-corners">
<ApiLoader
:cache-name="repoName()"
:url="fetchUrl"
:already-known-data="props.data"
@data-loaded="(repo: GithubRepo) => (repository = repo)"
>
<div class="flex-col info">
<h3>{{ repository.name }}</h3>
<div>
<p>
{{ repository.description }}
</p>
</div>
<h3>{{ repository.name }}</h3>
<div>
<p>
{{ repository.description }}
</p>
</div>
<div class="flex-col flex-start gap-1rem stats">
<div class="flex-row flex-start gap-1rem stats">
<div class="stars">
<Icon name="star" /> {{ repository.stargazers_count }}
</div>
@ -55,9 +51,15 @@ const repository: Ref<GithubRepo> = ref(null);
@import '../../styles/classes.less';
.githubRepo {
width: 35rem;
padding: 3rem;
max-width: 35rem;
padding: 2rem;
background-color: @nord4;
align-self: auto;
h3,
h3:first-child {
margin: 0;
padding: 0;
}
html.dark & {
background-color: @nord3;
@ -69,6 +71,11 @@ const repository: Ref<GithubRepo> = ref(null);
.stats {
width: 4rem;
div {
.flex-row();
gap: 0.3rem;
}
}
}
</style>

View File

@ -1,15 +1,19 @@
<template>
<div v-if="props.user !== ''" class="list-repos flex-col gap-1rem">
<div class="list-repos flex-col gap-1rem">
<FetchRepositories
v-if="props.user !== ''"
:sort-by="props.sortBy"
:user="props.user"
:limit="props.limit"
@data-loaded="(response: GithubRepo[]) => (repos = response)"
/>
<GithubRepository :data="repo" type="repositories" v-for="repo in repos" />
</div>
<div v-else class="list-repos flex-col gap-1rem">
<slot></slot>
>
<GithubRepository
:data="repo"
type="repositories"
v-for="repo in repos"
/>
</FetchRepositories>
<slot v-else />
</div>
</template>

View File

@ -8,6 +8,15 @@ each(range(5), {
display: flex;
}
.flex-inline {
display: inline-flex;
}
.flex-inline-col {
.flex-inline();
flex-direction: column;
}
.flex-col {
.flex();
flex-direction: column;