2023-05-08 10:44:12 +00:00
|
|
|
<template>
|
2023-05-08 13:57:45 +00:00
|
|
|
<div class="list-repos flex-col gap-1rem">
|
2023-05-08 10:44:12 +00:00
|
|
|
<FetchRepositories
|
2023-05-08 13:57:45 +00:00
|
|
|
v-if="props.user !== ''"
|
2023-05-08 10:44:12 +00:00
|
|
|
:sort-by="props.sortBy"
|
|
|
|
:user="props.user"
|
|
|
|
:limit="props.limit"
|
2024-06-20 07:27:59 +00:00
|
|
|
@loaded="(response: GithubRepo[]) => (repos = response)"
|
2023-05-08 13:57:45 +00:00
|
|
|
>
|
|
|
|
<GithubRepository
|
|
|
|
:data="repo"
|
|
|
|
type="repositories"
|
|
|
|
v-for="repo in repos"
|
|
|
|
/>
|
|
|
|
</FetchRepositories>
|
|
|
|
<slot v-else />
|
2023-05-08 10:44:12 +00:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
|
import FetchRepositories from './FetchRepositories.vue';
|
|
|
|
import GithubRepository from './GithubRepository.vue';
|
|
|
|
|
|
|
|
import { PropType, Ref, ref } from 'vue';
|
2024-06-20 07:27:59 +00:00
|
|
|
import { GithubRepo } from '../../types/github';
|
2023-05-08 10:44:12 +00:00
|
|
|
|
|
|
|
const props = defineProps({
|
|
|
|
sortBy: {
|
|
|
|
default: 'none',
|
|
|
|
required: false,
|
|
|
|
type: String as PropType<'stars' | 'forks' | 'pushed_at'>,
|
|
|
|
},
|
|
|
|
user: {
|
|
|
|
default: '',
|
|
|
|
required: false,
|
|
|
|
type: String,
|
|
|
|
},
|
|
|
|
limit: {
|
|
|
|
default: 5,
|
|
|
|
required: false,
|
|
|
|
type: Number,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
const repos: Ref<GithubRepo[]> = ref(null);
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="less">
|
|
|
|
@import '../../styles/classes.less';
|
|
|
|
|
|
|
|
.list-repos {
|
|
|
|
margin: 2rem auto;
|
|
|
|
}
|
|
|
|
</style>
|