Stylistyka komponentów statystyk

This commit is contained in:
2022-12-20 16:41:42 +01:00
parent be53b9c7fb
commit 6da586d08a
5 changed files with 36 additions and 20 deletions
+17 -6
View File
@@ -4,7 +4,7 @@
<button <button
v-for="tab in data.tabs" v-for="tab in data.tabs"
class="btn--filled" class="btn--filled"
:data-selected="tab.name == store.currentStatsTab" :data-selected="tab.name == store.currentStatsTab && areStatsOpen"
:data-inactive="tab.inactive" :data-inactive="tab.inactive"
@click="onTabButtonClick(tab.name)" @click="onTabButtonClick(tab.name)"
> >
@@ -12,7 +12,7 @@
</button> </button>
</div> </div>
<div class="stats-tab"> <div class="stats-tab" v-show="areStatsOpen">
<keep-alive> <keep-alive>
<JournalDailyStats v-if="store.currentStatsTab == 'daily'" ref="dailyStatsComp" /> <JournalDailyStats v-if="store.currentStatsTab == 'daily'" ref="dailyStatsComp" />
<JournalDriverStats v-else-if="store.currentStatsTab == 'driver'" /> <JournalDriverStats v-else-if="store.currentStatsTab == 'driver'" />
@@ -35,6 +35,9 @@ type TStatTab = 'daily' | 'driver';
const store = useStore(); const store = useStore();
const dailyStatsComp: Ref<InstanceType<typeof JournalDailyStats> | null> = ref(null); const dailyStatsComp: Ref<InstanceType<typeof JournalDailyStats> | null> = ref(null);
const areStatsOpen = ref(true);
const lastClickedTab = ref('');
let data = reactive({ let data = reactive({
tabs: [ tabs: [
{ {
@@ -51,7 +54,12 @@ let data = reactive({
// Methods // Methods
function onTabButtonClick(tab: TStatTab) { function onTabButtonClick(tab: TStatTab) {
if (lastClickedTab.value == tab || !areStatsOpen.value) {
areStatsOpen.value = !areStatsOpen.value;
}
store.currentStatsTab = tab; store.currentStatsTab = tab;
lastClickedTab.value = tab;
} }
onActivated(() => { onActivated(() => {
@@ -65,9 +73,10 @@ onDeactivated(() => {
watch( watch(
computed(() => store.driverStatsData), computed(() => store.driverStatsData),
(statsData) => { (statsData) => {
console.log(statsData);
data.tabs[1].inactive = statsData ? false : true; data.tabs[1].inactive = statsData ? false : true;
lastClickedTab.value = statsData ? 'driver' : 'daily';
if (statsData) areStatsOpen.value = true;
} }
); );
</script> </script>
@@ -77,12 +86,15 @@ watch(
@import '../../styles/variables.scss'; @import '../../styles/variables.scss';
.tabs { .tabs {
position: relative;
display: flex; display: flex;
gap: 0.5em; gap: 0.5em;
margin-bottom: 0.5em;
button { button {
font-weight: bold; font-weight: bold;
border-radius: 0.4em 0.4em 0 0;
padding: 0.5em 0.75em; padding: 0.5em 0.75em;
&[data-inactive='true'] { &[data-inactive='true'] {
@@ -92,7 +104,6 @@ watch(
&[data-selected='true'] { &[data-selected='true'] {
color: $accentCol; color: $accentCol;
} }
} }
} }
</style> </style>
+5
View File
@@ -59,6 +59,11 @@
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
gap: 0.5em;
position: relative;
margin-bottom: 0.5em;
} }
.btn--load-data { .btn--load-data {
+5 -4
View File
@@ -3,14 +3,15 @@
.stats-tab { .stats-tab {
background-color: #1a1a1a; background-color: #1a1a1a;
padding: 1em; border: 1px solid #ffc014;
margin-bottom: 1em;
min-height: 100px; padding: 1em;
display: flex; display: flex;
align-items: flex-end; align-items: flex-end;
border-radius: 0 0 1em 1em; margin-bottom: 0.5em;
width: 100%;
} }
.info-stats { .info-stats {
+5 -7
View File
@@ -2,6 +2,10 @@
@import 'variables.scss'; @import 'variables.scss';
@import 'search_box.scss'; @import 'search_box.scss';
.filters-options {
margin-bottom: 0.5em;
}
h1.option-title { h1.option-title {
position: relative; position: relative;
font-size: 1.1em; font-size: 1.1em;
@@ -42,22 +46,16 @@ h1.option-title {
z-index: 10; z-index: 10;
} }
.filters-options {
position: relative;
margin-bottom: 0.5em;
}
.options_wrapper { .options_wrapper {
position: absolute; position: absolute;
background-color: $bgCol; background-color: $bgCol;
box-shadow: 0 5px 10px 2px #0f0f0f; box-shadow: 0 5px 10px 2px #0f0f0f;
width: 100%; width: 97%;
max-width: 500px; max-width: 500px;
padding: 1em; padding: 1em;
z-index: 100; z-index: 100;
} }
+3 -2
View File
@@ -3,8 +3,6 @@
<JournalHeader /> <JournalHeader />
<div class="journal_wrapper"> <div class="journal_wrapper">
<JournalStats />
<JournalOptions <JournalOptions
@on-search-confirm="searchHistory" @on-search-confirm="searchHistory"
@on-options-reset="resetOptions" @on-options-reset="resetOptions"
@@ -13,6 +11,8 @@
:data-status="dataStatus" :data-status="dataStatus"
/> />
<JournalStats />
<div class="list_wrapper" @scroll="handleScroll"> <div class="list_wrapper" @scroll="handleScroll">
<!-- <transition name="warning" mode="out-in"> --> <!-- <transition name="warning" mode="out-in"> -->
<!-- <div :key="dataStatus"> --> <!-- <div :key="dataStatus"> -->
@@ -286,3 +286,4 @@ export default defineComponent({
<style lang="scss" scoped> <style lang="scss" scoped>
@import '../styles/JournalSection.scss'; @import '../styles/JournalSection.scss';
</style> </style>