File tree Expand file tree Collapse file tree 9 files changed +28
-15
lines changed
Expand file tree Collapse file tree 9 files changed +28
-15
lines changed Original file line number Diff line number Diff line change 11<script setup lang="ts">
2- defineProps <{
3- /** Show the back button on small screens */
4- backOnSmallScreen? : boolean
5- /** Show the back button on both small and big screens */
6- back? : boolean
2+ const { back = false } = defineProps <{
3+ /**
4+ * Should we show a back button?
5+ * Note: this will be forced to false on xl screens to avoid duplicating the sidebar's back button.
6+ */
7+ back? : boolean | ' small-only'
78 /** Do not applying overflow hidden to let use floatable components in title */
89 noOverflowHidden? : boolean
910}>()
@@ -22,6 +23,17 @@ const containerClass = computed(() => {
2223
2324 return ' lg:sticky lg:top-0'
2425})
26+
27+ const showBackButton = computed (() => {
28+ switch (back ) {
29+ case ' small-only' :
30+ return isSmallOrMediumScreen .value
31+ case true :
32+ return ! isExtraLargeScreen .value
33+ default :
34+ return false
35+ }
36+ })
2537 </script >
2638
2739<template >
@@ -38,8 +50,8 @@ const containerClass = computed(() => {
3850 <div flex justify-between gap-2 min-h-53px px5 py1 :class =" { 'xl:hidden': $route.name !== 'tag' }" class =" native:xl:flex" border =" b base" >
3951 <div flex gap-2 items-center :overflow-hidden =" !noOverflowHidden ? '' : false" w-full >
4052 <button
41- v-if =" backOnSmallScreen || back "
42- btn-text flex items-center ms =" -3" p-3 xl:hidden
53+ v-if =" showBackButton "
54+ btn-text flex items-center ms =" -3" p-3
4355 :aria-label =" $t('nav.back')"
4456 @click =" $router.go(-1)"
4557 >
Original file line number Diff line number Diff line change @@ -3,5 +3,6 @@ import { breakpointsTailwind } from '@vueuse/core'
33export const breakpoints = useBreakpoints ( breakpointsTailwind )
44
55export const isSmallScreen = breakpoints . smallerOrEqual ( 'sm' )
6+ export const isSmallOrMediumScreen = breakpoints . smaller ( 'lg' )
67export const isMediumOrLargeScreen = breakpoints . between ( 'sm' , 'xl' )
7- export const isExtraLargeScreen = breakpoints . smallerOrEqual ( 'xl' )
8+ export const isExtraLargeScreen = breakpoints . greaterOrEqual ( 'xl' )
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ function handleShowCommit() {
1717 </script >
1818
1919<template >
20- <MainContent back-on- small-screen >
20+ <MainContent back = " small-only " >
2121 <template #title >
2222 <div text-lg font-bold flex items-center gap-2 @click =" $scrollToTop" >
2323 <span >{{ $t('settings.about.label') }}</span >
Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ useHydratedHead({
77 </script >
88
99<template >
10- <MainContent back-on- small-screen >
10+ <MainContent back = " small-only " >
1111 <template #title >
1212 <div text-lg font-bold flex items-center gap-2 @click =" $scrollToTop" >
1313 <span >{{ $t('settings.interface.label') }}</span >
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ const status = computed(() => {
1515 </script >
1616
1717<template >
18- <MainContent back-on- small-screen >
18+ <MainContent back = " small-only " >
1919 <template #title >
2020 <div text-lg font-bold flex items-center gap-2 @click =" $scrollToTop" >
2121 <span >{{ $t('settings.language.label') }}</span >
Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ useHydratedHead({
1212 </script >
1313
1414<template >
15- <MainContent back-on- small-screen >
15+ <MainContent back = " small-only " >
1616 <template #title >
1717 <div text-lg font-bold flex items-center gap-2 @click =" $scrollToTop" >
1818 <span >{{ $t('settings.notifications.label') }}</span >
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ const userSettings = useUserSettings()
99 </script >
1010
1111<template >
12- <MainContent back-on- small-screen >
12+ <MainContent back = " small-only " >
1313 <template #title >
1414 <h1 text-lg font-bold flex items-center gap-2 @click =" $scrollToTop" >
1515 {{ $t('settings.preferences.label') }}
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ useHydratedHead({
1111 </script >
1212
1313<template >
14- <MainContent back-on- small-screen >
14+ <MainContent back = " small-only " >
1515 <template #title >
1616 <div text-lg font-bold flex items-center gap-2 @click =" $scrollToTop" >
1717 <span >{{ $t('settings.profile.label') }}</span >
Original file line number Diff line number Diff line change @@ -66,7 +66,7 @@ async function importTokens() {
6666 </script >
6767
6868<template >
69- <MainContent back-on- small-screen >
69+ <MainContent back = " small-only " >
7070 <template #title >
7171 <div text-lg font-bold flex items-center gap-2 @click =" $scrollToTop" >
7272 <span >{{ $t('settings.users.label') }}</span >
You can’t perform that action at this time.
0 commit comments