fix: Show add/import/export buttons in mobile view (#9761)

This commit is contained in:
Sivin Varghese
2024-07-25 14:08:32 +05:30
committed by GitHub
parent e9d47d31c7
commit 239c61095a
2 changed files with 121 additions and 122 deletions

View File

@@ -3,7 +3,11 @@
class="bg-white border-b dark:bg-slate-900 border-slate-50 dark:border-slate-800" class="bg-white border-b dark:bg-slate-900 border-slate-50 dark:border-slate-800"
> >
<div class="flex justify-between w-full px-4 py-2"> <div class="flex justify-between w-full px-4 py-2">
<div class="flex items-center justify-center max-w-full min-w-[6.25rem]"> <div class="flex flex-col items-center w-full gap-2 md:flex-row">
<div class="flex justify-between w-full gap-2">
<div
class="flex items-center justify-center max-w-full min-w-[6.25rem]"
>
<woot-sidemenu-icon /> <woot-sidemenu-icon />
<h1 <h1
class="m-0 mx-2 my-0 overflow-hidden text-xl text-slate-900 dark:text-slate-100 whitespace-nowrap text-ellipsis" class="m-0 mx-2 my-0 overflow-hidden text-xl text-slate-900 dark:text-slate-100 whitespace-nowrap text-ellipsis"
@@ -11,9 +15,8 @@
{{ headerTitle }} {{ headerTitle }}
</h1> </h1>
</div> </div>
<div class="flex gap-2">
<div <div
class="max-w-[400px] min-w-[150px] flex items-center relative mx-2 search-wrap" class="max-w-[400px] min-w-[100px] flex items-center relative mx-2"
> >
<div class="flex items-center absolute h-full left-2.5"> <div class="flex items-center absolute h-full left-2.5">
<fluent-icon <fluent-icon
@@ -24,23 +27,25 @@
<input <input
type="text" type="text"
:placeholder="$t('CONTACTS_PAGE.SEARCH_INPUT_PLACEHOLDER')" :placeholder="$t('CONTACTS_PAGE.SEARCH_INPUT_PLACEHOLDER')"
class="contact-search border-slate-100 dark:border-slate-600" class="!pl-9 !pr-[3.75rem] !text-sm !w-full !h-[2.375rem] !m-0 border-slate-100 dark:border-slate-600"
:value="searchQuery" :value="searchQuery"
@keyup.enter="submitSearch" @keyup.enter="submitSearch"
@input="inputSearch" @input="inputSearch"
/> />
<woot-button <woot-button
:is-loading="false" :is-loading="false"
class="clear" class="absolute h-8 px-2 py-0 ml-2 transition-transform duration-100 ease-linear clear right-1"
:class-names="searchButtonClass" :class-names="searchButtonClass"
@click="submitSearch" @click="submitSearch"
> >
{{ $t('CONTACTS_PAGE.SEARCH_BUTTON') }} {{ $t('CONTACTS_PAGE.SEARCH_BUTTON') }}
</woot-button> </woot-button>
</div> </div>
</div>
<div class="flex gap-1">
<div v-if="hasActiveSegments" class="flex gap-2"> <div v-if="hasActiveSegments" class="flex gap-2">
<woot-button <woot-button
class="clear" class="clear [&>span]:hidden xs:[&>span]:block"
color-scheme="secondary" color-scheme="secondary"
icon="edit" icon="edit"
@click="onToggleEditSegmentsModal" @click="onToggleEditSegmentsModal"
@@ -48,7 +53,7 @@
{{ $t('CONTACTS_PAGE.FILTER_CONTACTS_EDIT') }} {{ $t('CONTACTS_PAGE.FILTER_CONTACTS_EDIT') }}
</woot-button> </woot-button>
<woot-button <woot-button
class="clear" class="clear [&>span]:hidden xs:[&>span]:block"
color-scheme="alert" color-scheme="alert"
icon="delete" icon="delete"
@click="onToggleDeleteSegmentsModal" @click="onToggleDeleteSegmentsModal"
@@ -62,7 +67,7 @@
class="absolute w-2 h-2 rounded-full top-1 right-3 bg-slate-500 dark:bg-slate-500" class="absolute w-2 h-2 rounded-full top-1 right-3 bg-slate-500 dark:bg-slate-500"
/> />
<woot-button <woot-button
class="clear" class="clear [&>span]:hidden xs:[&>span]:block"
color-scheme="secondary" color-scheme="secondary"
data-testid="create-new-contact" data-testid="create-new-contact"
icon="filter" icon="filter"
@@ -74,7 +79,7 @@
<woot-button <woot-button
v-if="hasAppliedFilters && !hasActiveSegments" v-if="hasAppliedFilters && !hasActiveSegments"
class="clear" class="clear [&>span]:hidden xs:[&>span]:block"
color-scheme="alert" color-scheme="alert"
variant="clear" variant="clear"
icon="save" icon="save"
@@ -83,7 +88,7 @@
{{ $t('CONTACTS_PAGE.FILTER_CONTACTS_SAVE') }} {{ $t('CONTACTS_PAGE.FILTER_CONTACTS_SAVE') }}
</woot-button> </woot-button>
<woot-button <woot-button
class="clear" class="clear [&>span]:hidden xs:[&>span]:block"
color-scheme="success" color-scheme="success"
icon="person-add" icon="person-add"
data-testid="create-new-contact" data-testid="create-new-contact"
@@ -96,7 +101,7 @@
v-if="isAdmin" v-if="isAdmin"
color-scheme="info" color-scheme="info"
icon="upload" icon="upload"
class="clear" class="clear [&>span]:hidden xs:[&>span]:block"
@click="toggleImport" @click="toggleImport"
> >
{{ $t('IMPORT_CONTACTS.BUTTON_LABEL') }} {{ $t('IMPORT_CONTACTS.BUTTON_LABEL') }}
@@ -106,13 +111,14 @@
v-if="isAdmin" v-if="isAdmin"
color-scheme="info" color-scheme="info"
icon="download" icon="download"
class="clear" class="clear [&>span]:hidden xs:[&>span]:block"
@click="submitExport" @click="submitExport"
> >
{{ $t('EXPORT_CONTACTS.BUTTON_LABEL') }} {{ $t('EXPORT_CONTACTS.BUTTON_LABEL') }}
</woot-button> </woot-button>
</div> </div>
</div> </div>
</div>
<woot-confirm-modal <woot-confirm-modal
ref="confirmExportContactsDialog" ref="confirmExportContactsDialog"
:title="$t('EXPORT_CONTACTS.CONFIRM.TITLE')" :title="$t('EXPORT_CONTACTS.CONFIRM.TITLE')"
@@ -156,7 +162,9 @@ export default {
}, },
computed: { computed: {
searchButtonClass() { searchButtonClass() {
return this.searchQuery !== '' ? 'show' : ''; return this.searchQuery !== ''
? 'opacity-100 translate-x-0 visible'
: '-translate-x-px opacity-0 invisible';
}, },
...mapGetters({ ...mapGetters({
getAppliedContactFilters: 'contacts/getAppliedContactFilters', getAppliedContactFilters: 'contacts/getAppliedContactFilters',
@@ -209,20 +217,3 @@ export default {
}, },
}; };
</script> </script>
<style lang="scss" scoped>
.search-wrap {
.contact-search {
@apply pl-9 pr-[3.75rem] text-sm w-full h-[2.375rem] m-0;
}
.button {
transition: transform 100ms linear;
@apply ml-2 h-8 right-1 absolute py-0 px-2 opacity-0 -translate-x-px invisible;
}
.button.show {
@apply opacity-100 translate-x-0 visible;
}
}
</style>

View File

@@ -20,6 +20,14 @@ module.exports = {
interDisplay: ['Inter Display', ...defaultTheme.fontFamily.sans], interDisplay: ['Inter Display', ...defaultTheme.fontFamily.sans],
}, },
}, },
screens: {
xs: '480px',
sm: '640px',
md: '768px',
lg: '1024px',
xl: '1280px',
'2xl': '1536px',
},
fontSize: { fontSize: {
...defaultTheme.fontSize, ...defaultTheme.fontSize,
xxs: '0.625rem', xxs: '0.625rem',