refactor: improvements made to how banners are to be dismissed (#3656)

This commit is contained in:
Joel Jacob Stephen
2023-12-15 17:08:57 +05:30
committed by GitHub
parent 93082c3816
commit cf8b5975ac
4 changed files with 6 additions and 2 deletions

View File

@@ -14,7 +14,7 @@
</span>
</div>
<icon-lucide-x
v-if="dismissible"
v-if="banner.dismissible"
class="opacity-50 hover:cursor-pointer hover:opacity-100"
@click="emit('dismiss')"
/>

View File

@@ -214,7 +214,7 @@
<AppBanner
v-if="bannerContent"
:banner="bannerContent"
:dismissible="true"
:dismissable="bannerContent.dismissible"
@dismiss="dismissOfflineBanner"
/>
<TeamsModal :show="showTeamsModal" @hide-modal="showTeamsModal = false" />
@@ -295,6 +295,7 @@ const offlineBanner: BannerContent = {
text: (t) => t("helpers.offline"),
alternateText: (t) => t("helpers.offline_short"),
score: BANNER_PRIORITY_HIGH,
dismissible: true,
}
const network = reactive(useNetwork())

View File

@@ -15,6 +15,7 @@ export type BannerContent = {
alternateText?: (t: ReturnType<typeof getI18n>) => string
// Used to determine which banner should be displayed when multiple banners are present
score: number
dismissible?: boolean
}
export type Banner = {

View File

@@ -30,8 +30,10 @@ declare module '@vue/runtime-core' {
HoppSmartTable: typeof import('@hoppscotch/ui')['HoppSmartTable']
HoppSmartTabs: typeof import('@hoppscotch/ui')['HoppSmartTabs']
HoppSmartToggle: typeof import('@hoppscotch/ui')['HoppSmartToggle']
IconLucideArrowLeft: typeof import('~icons/lucide/arrow-left')['default']
IconLucideChevronDown: typeof import('~icons/lucide/chevron-down')['default']
IconLucideInbox: typeof import('~icons/lucide/inbox')['default']
IconLucideUser: typeof import('~icons/lucide/user')['default']
SettingsAuthProvider: typeof import('./components/settings/AuthProvider.vue')['default']
SettingsConfigurations: typeof import('./components/settings/Configurations.vue')['default']
SettingsReset: typeof import('./components/settings/Reset.vue')['default']