Skip to content

Commit

Permalink
close pipelin feed sidebar on outside click
Browse files Browse the repository at this point in the history
  • Loading branch information
xoxys committed Aug 25, 2023
1 parent c4e28e3 commit 54d237b
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 0 deletions.
1 change: 1 addition & 0 deletions web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"dependencies": {
"@intlify/unplugin-vue-i18n": "^0.10.1",
"@kyvg/vue3-notification": "^2.9.1",
"@vueuse/components": "^10.4.0",
"@vueuse/core": "^9.13.0",
"ansi_up": "^5.2.1",
"dayjs": "^1.11.9",
Expand Down
43 changes: 43 additions & 0 deletions web/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions web/src/components/pipeline-feed/PipelineFeedSidebar.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<template>
<aside
v-if="isOpen"
v-on-click-outside="close"
class="flex flex-col z-50 overflow-y-auto items-center bg-wp-background-100 dark:bg-wp-background-200 border-wp-background-400"
:aria-label="$t('pipeline_feed')"
>
Expand All @@ -21,9 +22,12 @@
</template>

<script lang="ts" setup>
import { vOnClickOutside } from '@vueuse/components';
import PipelineFeedItem from '~/components/pipeline-feed/PipelineFeedItem.vue';
import usePipelineFeed from '~/compositions/usePipelineFeed';
const pipelineFeed = usePipelineFeed();
const { isOpen, sortedPipelines } = pipelineFeed;
const { close } = pipelineFeed;
</script>
5 changes: 5 additions & 0 deletions web/src/compositions/usePipelineFeed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,16 @@ export default () => {
setUserConfig('isPipelineFeedOpen', !userConfig.value.isPipelineFeedOpen);
}

function close() {
setUserConfig('isPipelineFeedOpen', false);
}

const sortedPipelines = toRef(pipelineStore, 'pipelineFeed');
const activePipelines = toRef(pipelineStore, 'activePipelines');

return {
toggle,
close,
isOpen,
sortedPipelines,
activePipelines,
Expand Down

0 comments on commit 54d237b

Please sign in to comment.