mirror of
https://gitlab.com/PronounsPage/PronounsPage.git
synced 2025-08-05 12:07:22 -04:00
36 lines
1.1 KiB
Vue
36 lines
1.1 KiB
Vue
<script setup lang="ts">
|
|
import type { Dataset } from '~/components/Chart.vue';
|
|
|
|
const props = defineProps<{
|
|
name: string;
|
|
data: Dataset[] | Dataset;
|
|
init?: 'daily' | 'cumulative';
|
|
header?: string;
|
|
}>();
|
|
|
|
const mode = ref(props.init);
|
|
</script>
|
|
|
|
<template>
|
|
<div class="card">
|
|
<div class="card-header">
|
|
<p v-if="header" class="h6 d-inline-block me-3">
|
|
<strong>{{ header }}</strong>
|
|
</p>
|
|
<div
|
|
v-for="(desc, m) in { '': 'Hide chart', 'daily': 'Daily change chart', 'cumulative': 'Cumulative chart' }"
|
|
class="form-check form-check-inline"
|
|
>
|
|
<label class="form-check-label">
|
|
<input v-model="mode" class="form-check-input" type="radio" :value="m">
|
|
{{ desc }}
|
|
</label>
|
|
</div>
|
|
</div>
|
|
<div v-if="mode" class="card-body">
|
|
<Chart v-show="mode === 'daily'" :data="data" :label="`new ${name} per day`" />
|
|
<Chart v-show="mode === 'cumulative'" :data="data" :label="`cumulative ${name}`" cumulative />
|
|
</div>
|
|
</div>
|
|
</template>
|