Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Responsive explore page menu #1316

Merged
merged 5 commits into from
Feb 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
124 changes: 99 additions & 25 deletions src/views/Explore/Container.vue
Original file line number Diff line number Diff line change
@@ -1,21 +1,37 @@
<template>
<div class="explore-container">
<div class="explore-tabs-container">
<s-tabs class="explore-tabs" type="rounded" :value="pageName" @input="handleTabChange">
<s-tab v-for="tab in tabs" :key="tab.name" :name="tab.name" :label="tab.label"> </s-tab>
</s-tabs>
</div>

<div class="container container--explore" v-loading="parentLoading">
<generic-page-header :title="pageTitle" class="page-header-title--explore">
<div class="explore-container-dropdown s-flex">
<s-dropdown
popper-class="explore-container-dropdown__dropdown-menu"
type="button"
button-type="link"
placement="bottom-start"
trigger="click"
@select="handleTabChange"
>
<h3 class="explore-container-dropdown__selected">{{ pageTitle }}</h3>
<template #menu>
<s-dropdown-item
v-for="{ name, label, icon } in tabs"
class="explore-container-dropdown__item"
:class="{ selected: name === pageName }"
:key="name"
:value="name"
:icon="icon"
>
{{ label }}
</s-dropdown-item>
</template>
</s-dropdown>
<search-input
autofocus
class="explore-search"
v-model="exploreQuery"
:placeholder="t('searchText')"
@clear="resetSearch"
/>
</generic-page-header>
</div>

<div v-if="switcherAvailable" class="switcher">
<s-switch v-model="isAccountItemsOnly" />
Expand Down Expand Up @@ -68,16 +84,31 @@ export default class ExploreContainer extends Mixins(mixins.LoadingMixin, Transl
this.isAccountItems = value;
}

get tabs(): Array<{ name: string; label: string }> {
get tabs(): Array<{ name: string; label: string; icon: string }> {
return [
PageNames.ExploreFarming,
PageNames.ExplorePools,
PageNames.ExploreStaking,
PageNames.ExploreTokens,
PageNames.ExploreBooks,
].map((name) => ({
name,
label: this.t(`pageTitle.${name}`),
{
name: PageNames.ExploreFarming,
icon: 'various-toy-horse-24',
},
{
name: PageNames.ExplorePools,
icon: 'basic-drop-24',
},
{
name: PageNames.ExploreStaking,
icon: 'basic-layers-24',
},
{
name: PageNames.ExploreTokens,
icon: 'file-file-text-24',
},
{
name: PageNames.ExploreBooks,
icon: 'music-CD-24',
},
].map((el) => ({
...el,
label: this.t(`pageTitle.${el.name}`),
}));
}

Expand All @@ -99,6 +130,7 @@ export default class ExploreContainer extends Mixins(mixins.LoadingMixin, Transl
}

handleTabChange(name: string): void {
if (this.pageName === name) return;
router.push({ name });
}

Expand All @@ -109,9 +141,36 @@ export default class ExploreContainer extends Mixins(mixins.LoadingMixin, Transl
</script>

<style lang="scss">
.explore-tabs {
.el-tabs__header {
margin: 0 auto;
$icon-size: 28px;

.el-dropdown-menu.el-popper.explore-container-dropdown {
&__dropdown-menu {
background-color: var(--s-color-utility-body);
border-color: var(--s-color-base-border-secondary);
.popper__arrow {
display: none;
}
.explore-container-dropdown__item {
i {
color: var(--s-color-base-content-tertiary);
font-size: $icon-size;
}
&:not(.is-disabled):not(.selected) {
&:hover,
&:focus {
&,
& i {
color: var(--s-color-base-content-secondary);
}
}
}
&.selected {
&,
& i {
color: var(--s-color-theme-accent);
}
}
}
}
}
</style>
Expand All @@ -136,6 +195,26 @@ $search-input-width: 290px;
display: flex;
flex-flow: column nowrap;
align-items: center;

&-dropdown {
justify-content: space-between;
align-items: center;

&__selected {
font-weight: 300;
letter-spacing: var(--s-letter-spacing-mini);
}

&__item {
min-width: 150px;
line-height: 3;
font-weight: 300;
font-size: var(--s-font-size-small);
color: var(--s-color-base-content-secondary);
display: flex;
align-items: center;
}
}
}

&-search {
Expand All @@ -151,11 +230,6 @@ $search-input-width: 290px;
}
}

.page-header-title--explore {
justify-content: space-between;
align-items: center;
}

.switcher {
display: flex;
align-items: center;
Expand Down