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

Close sidebar on outside clicks #2325

Merged
merged 5 commits into from
Sep 7, 2023
Merged
Show file tree
Hide file tree
Changes from 2 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
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;
xoxys marked this conversation as resolved.
Show resolved Hide resolved
</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