chore: improve mobile responsiveness on environment selector (#3100)

This commit is contained in:
Liyas Thomas
2023-06-02 20:26:18 +05:30
committed by GitHub
parent 05e32ef9e4
commit abc7b4b6f3
2 changed files with 21 additions and 10 deletions

View File

@@ -11,13 +11,14 @@
class="bg-transparent border-b border-dividerLight select-wrapper" class="bg-transparent border-b border-dividerLight select-wrapper"
> >
<HoppButtonSecondary <HoppButtonSecondary
v-if="selectedEnv.type !== 'NO_ENV_SELECTED'" :icon="IconLayers"
:label="selectedEnv.name" :label="
class="flex-1 !justify-start pr-8 rounded-none" mdAndLarger
/> ? selectedEnv.type !== 'NO_ENV_SELECTED'
<HoppButtonSecondary ? selectedEnv.name
v-else : `${t('environment.select')}`
:label="`${t('environment.select')}`" : ''
"
class="flex-1 !justify-start pr-8 rounded-none" class="flex-1 !justify-start pr-8 rounded-none"
/> />
</span> </span>
@@ -58,6 +59,7 @@
<HoppSmartItem <HoppSmartItem
v-for="(gen, index) in myEnvironments" v-for="(gen, index) in myEnvironments"
:key="`gen-${index}`" :key="`gen-${index}`"
:icon="IconLayers"
:label="gen.name" :label="gen.name"
:info-icon="index === selectedEnv.index ? IconCheck : undefined" :info-icon="index === selectedEnv.index ? IconCheck : undefined"
:active-info-icon="index === selectedEnv.index" :active-info-icon="index === selectedEnv.index"
@@ -99,6 +101,7 @@
<HoppSmartItem <HoppSmartItem
v-for="(gen, index) in teamEnvironmentList" v-for="(gen, index) in teamEnvironmentList"
:key="`gen-team-${index}`" :key="`gen-team-${index}`"
:icon="IconLayers"
:label="gen.environment.name" :label="gen.environment.name"
:info-icon=" :info-icon="
gen.id === selectedEnv.teamEnvID ? IconCheck : undefined gen.id === selectedEnv.teamEnvID ? IconCheck : undefined
@@ -148,6 +151,7 @@
<script lang="ts" setup> <script lang="ts" setup>
import { computed, ref, watch } from "vue" import { computed, ref, watch } from "vue"
import IconCheck from "~icons/lucide/check" import IconCheck from "~icons/lucide/check"
import IconLayers from "~icons/lucide/layers"
import { TippyComponent } from "vue-tippy" import { TippyComponent } from "vue-tippy"
import { useI18n } from "~/composables/i18n" import { useI18n } from "~/composables/i18n"
import { GQLError } from "~/helpers/backend/GQLClient" import { GQLError } from "~/helpers/backend/GQLClient"
@@ -160,6 +164,10 @@ import {
import { workspaceStatus$ } from "~/newstore/workspace" import { workspaceStatus$ } from "~/newstore/workspace"
import TeamEnvironmentAdapter from "~/helpers/teams/TeamEnvironmentAdapter" import TeamEnvironmentAdapter from "~/helpers/teams/TeamEnvironmentAdapter"
import { useColorMode } from "@composables/theming" import { useColorMode } from "@composables/theming"
import { breakpointsTailwind, useBreakpoints } from "@vueuse/core"
const breakpoints = useBreakpoints(breakpointsTailwind)
const mdAndLarger = breakpoints.greater("md")
const t = useI18n() const t = useI18n()

View File

@@ -100,7 +100,7 @@
</div> </div>
</div> </div>
<div v-if="hasActions" class="w-64"> <div v-if="hasActions" :class="mdAndLarger ? 'w-64' : 'w-16'">
<slot name="actions" /> <slot name="actions" />
</div> </div>
@@ -115,7 +115,7 @@
}" }"
:style="[ :style="[
`--thumb-width: ${scrollThumb.width}px`, `--thumb-width: ${scrollThumb.width}px`,
`width: calc(100% - ${hasActions ? '19rem' : '3rem'})`, `width: calc(100% - ${hasActions ? mdAndLarger ? '19rem' : '7rem' : '3rem'})`,
]" ]"
id="myRange" id="myRange"
/> />
@@ -144,7 +144,7 @@ import {
nextTick, nextTick,
useSlots, useSlots,
} from "vue" } from "vue"
import { useElementSize } from "@vueuse/core" import { breakpointsTailwind, useBreakpoints, useElementSize } from "@vueuse/core"
import type { Slot } from "vue" import type { Slot } from "vue"
import draggable from "vuedraggable-es" import draggable from "vuedraggable-es"
import { HoppUIPluginOptions, HOPP_UI_OPTIONS } from "./../../index" import { HoppUIPluginOptions, HOPP_UI_OPTIONS } from "./../../index"
@@ -167,6 +167,9 @@ export type TabProvider = {
removeTabEntry: (tabID: string) => void removeTabEntry: (tabID: string) => void
} }
const breakpoints = useBreakpoints(breakpointsTailwind)
const mdAndLarger = breakpoints.greater("md")
const { t } = inject<HoppUIPluginOptions>(HOPP_UI_OPTIONS) ?? {} const { t } = inject<HoppUIPluginOptions>(HOPP_UI_OPTIONS) ?? {}
const props = withDefaults( const props = withDefaults(