-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b8ae417
commit 27f20f1
Showing
14 changed files
with
268 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,7 @@ | ||
export { Status, type AnimeList, type AnimeListEntry } from './types'; | ||
export { | ||
Status, | ||
type AnimeList, | ||
type AnimeListEntry, | ||
type AnimeListEntryStatistic, | ||
type AnimeListStatistics, | ||
} from './types'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
src/resources/js/features/anime/list-statistic/AnimeListStatistic.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<script setup lang="ts"> | ||
import type { AnimeListStatistics } from '@/entities/anime-list'; | ||
import { HoverCard, HoverCardContent, HoverCardTrigger } from '@/shared/ui/hover-card'; | ||
import { Progress } from '@/shared/ui/progress'; | ||
import { | ||
Table, | ||
TableBody, | ||
TableCell, | ||
TableHead, | ||
TableHeader, | ||
TableRow, | ||
} from '@/shared/ui/table'; | ||
type Props = { | ||
animeListStatistic: AnimeListStatistics; | ||
}; | ||
defineProps<Props>(); | ||
</script> | ||
|
||
<template> | ||
<HoverCard :open-delay="50" :close-delay="0"> | ||
<HoverCardTrigger class="cursor-pointer underline decoration-dotted"> | ||
Who added this anime? | ||
</HoverCardTrigger> | ||
<HoverCardContent class="w-96" side="bottom" align="start" :side-offset="5"> | ||
<Table> | ||
<TableHeader> | ||
<TableRow> | ||
<TableHead>Users</TableHead> | ||
<TableHead>Percentage</TableHead> | ||
<TableHead>Status</TableHead> | ||
</TableRow> | ||
</TableHeader> | ||
<TableBody> | ||
<TableRow | ||
v-for="statistic in animeListStatistic" | ||
:key="statistic.status" | ||
> | ||
<TableCell> | ||
{{ statistic.user_count }} | ||
</TableCell> | ||
<TableCell> | ||
<Progress :model-value="statistic.percentage" /> | ||
</TableCell> | ||
<TableCell> | ||
{{ statistic.status }} | ||
</TableCell> | ||
</TableRow> | ||
</TableBody> | ||
</Table> | ||
</HoverCardContent> | ||
</HoverCard> | ||
</template> | ||
|
||
<style scoped></style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default as AnimeListStatistic } from './AnimeListStatistic.vue'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<script setup lang="ts"> | ||
import { | ||
HoverCardRoot, | ||
type HoverCardRootEmits, | ||
type HoverCardRootProps, | ||
useForwardPropsEmits, | ||
} from 'radix-vue'; | ||
const props = defineProps<HoverCardRootProps>(); | ||
const emits = defineEmits<HoverCardRootEmits>(); | ||
const forwarded = useForwardPropsEmits(props, emits); | ||
</script> | ||
|
||
<template> | ||
<HoverCardRoot v-bind="forwarded"> | ||
<slot /> | ||
</HoverCardRoot> | ||
</template> |
44 changes: 44 additions & 0 deletions
44
src/resources/js/shared/ui/hover-card/HoverCardContent.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<script setup lang="ts"> | ||
import { type HTMLAttributes, computed } from 'vue'; | ||
import { | ||
HoverCardContent, | ||
type HoverCardContentProps, | ||
HoverCardPortal, | ||
useForwardProps, | ||
} from 'radix-vue'; | ||
import { cn } from '@/shared/helpers/tailwind'; | ||
const props = withDefaults( | ||
defineProps<HoverCardContentProps & { class?: HTMLAttributes['class'] }>(), | ||
{ | ||
sideOffset: 4, | ||
} | ||
); | ||
const delegatedProps = computed(() => { | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
const { class: _, ...delegated } = props; | ||
return delegated; | ||
}); | ||
const forwardedProps = useForwardProps(delegatedProps); | ||
</script> | ||
|
||
<template> | ||
<HoverCardPortal> | ||
<HoverCardContent | ||
v-bind="forwardedProps" | ||
:class=" | ||
cn( | ||
'z-50 w-64 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2', | ||
props.class | ||
) | ||
" | ||
> | ||
<slot /> | ||
</HoverCardContent> | ||
</HoverCardPortal> | ||
</template> |
11 changes: 11 additions & 0 deletions
11
src/resources/js/shared/ui/hover-card/HoverCardTrigger.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<script setup lang="ts"> | ||
import { HoverCardTrigger, type HoverCardTriggerProps } from 'radix-vue'; | ||
const props = defineProps<HoverCardTriggerProps>(); | ||
</script> | ||
|
||
<template> | ||
<HoverCardTrigger v-bind="props"> | ||
<slot /> | ||
</HoverCardTrigger> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export { default as HoverCard } from './HoverCard.vue'; | ||
export { default as HoverCardContent } from './HoverCardContent.vue'; | ||
export { default as HoverCardTrigger } from './HoverCardTrigger.vue'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<script setup lang="ts"> | ||
import { type HTMLAttributes, computed } from 'vue'; | ||
import { ProgressIndicator, ProgressRoot, type ProgressRootProps } from 'radix-vue'; | ||
import { cn } from '@/shared/helpers/tailwind'; | ||
const props = withDefaults( | ||
defineProps<ProgressRootProps & { class?: HTMLAttributes['class'] }>(), | ||
{ | ||
modelValue: 0, | ||
} | ||
); | ||
const delegatedProps = computed(() => { | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
const { class: _, ...delegated } = props; | ||
return delegated; | ||
}); | ||
</script> | ||
|
||
<template> | ||
<ProgressRoot | ||
v-bind="delegatedProps" | ||
:class=" | ||
cn( | ||
'relative h-4 w-full overflow-hidden rounded-full bg-secondary', | ||
props.class | ||
) | ||
" | ||
> | ||
<ProgressIndicator | ||
class="h-full w-full flex-1 bg-primary transition-all" | ||
:style="`transform: translateX(-${100 - (props.modelValue ?? 0)}%);`" | ||
/> | ||
</ProgressRoot> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default as Progress } from './Progress.vue'; |