From 30a5e33d2bd8cfabbbf0abf6b27a65a92e1a0f10 Mon Sep 17 00:00:00 2001 From: mosarabi <149577299+mosarabi@users.noreply.github.com> Date: Fri, 26 Jan 2024 10:30:04 +0100 Subject: [PATCH] Add Drawer component (#248) --- packages/vue3/src/_dev/App.vue | 71 +++--- .../vue3/src/components/Drawer/Drawer.vue | 212 ++++++++++++++++++ packages/vue3/src/components/Drawer/types.ts | 4 + packages/vue3/src/components/Modal/Modal.vue | 27 ++- .../vue3/src/components/Overlay/Overlay.vue | 2 +- packages/vue3/src/components/index.ts | 2 +- 6 files changed, 268 insertions(+), 50 deletions(-) create mode 100644 packages/vue3/src/components/Drawer/Drawer.vue create mode 100644 packages/vue3/src/components/Drawer/types.ts diff --git a/packages/vue3/src/_dev/App.vue b/packages/vue3/src/_dev/App.vue index de309d66..6a77cc7d 100644 --- a/packages/vue3/src/_dev/App.vue +++ b/packages/vue3/src/_dev/App.vue @@ -1,63 +1,48 @@ diff --git a/packages/vue3/src/components/Drawer/Drawer.vue b/packages/vue3/src/components/Drawer/Drawer.vue new file mode 100644 index 00000000..64644765 --- /dev/null +++ b/packages/vue3/src/components/Drawer/Drawer.vue @@ -0,0 +1,212 @@ + + + + + diff --git a/packages/vue3/src/components/Drawer/types.ts b/packages/vue3/src/components/Drawer/types.ts new file mode 100644 index 00000000..64b4f98b --- /dev/null +++ b/packages/vue3/src/components/Drawer/types.ts @@ -0,0 +1,4 @@ +export interface DrawerProps { + visible?: boolean + position?: 'left' | 'right' +} diff --git a/packages/vue3/src/components/Modal/Modal.vue b/packages/vue3/src/components/Modal/Modal.vue index f59c15e6..f5588ff9 100644 --- a/packages/vue3/src/components/Modal/Modal.vue +++ b/packages/vue3/src/components/Modal/Modal.vue @@ -11,12 +11,12 @@ const props = withDefaults(defineProps(), { }); const emit = defineEmits(['update:visible', 'onConfirm']); -const closeModal = () => { +const close = () => { emit('update:visible', false); }; const handleKeypress = (event: KeyboardEvent) => { if (props.visible && event.key === 'Escape') { - closeModal(); + close(); } }; @@ -31,11 +31,11 @@ onUnmounted(() => { {{ confirmLabel }} - + {{ cancelLabel }} @@ -110,6 +110,23 @@ onUnmounted(() => { padding: 20px; overflow-y: auto; font: var(--text-md-regular); + + &::-webkit-scrollbar { + width: 4px; + } + + &::-webkit-scrollbar-track { + background: transparent; + } + + &::-webkit-scrollbar-thumb { + border-radius: 2px; + background-color: var(--brand-500); + } + + &::-webkit-scrollbar-thumb:hover { + background-color: var(--brand-500); + } } } diff --git a/packages/vue3/src/components/Overlay/Overlay.vue b/packages/vue3/src/components/Overlay/Overlay.vue index 73a3d035..16110e4c 100644 --- a/packages/vue3/src/components/Overlay/Overlay.vue +++ b/packages/vue3/src/components/Overlay/Overlay.vue @@ -49,7 +49,7 @@ const emit = defineEmits(['onBackdropClick']); position: relative; z-index: 3; max-width: 100%; - margin: auto; + margin: 0 auto; } } diff --git a/packages/vue3/src/components/index.ts b/packages/vue3/src/components/index.ts index 256230ba..50508e7a 100644 --- a/packages/vue3/src/components/index.ts +++ b/packages/vue3/src/components/index.ts @@ -46,7 +46,6 @@ export { default as SearchInput } from './Search/SearchInput.vue'; export { default as Alert } from './Alert/Alert.vue'; export { default as Toast } from './Toast/Toast.vue'; export { default as ToastContainer } from './ToastContainer/ToastContainer.vue'; -export { toast } from './ToastContainer/toast'; export { default as DraggableItem } from './Draggable/DraggableItem.vue'; export { default as Draggable } from './Draggable/Draggable.vue'; export { default as Radio } from './Radio/Radio.vue'; @@ -63,3 +62,4 @@ export { default as Skeleton } from './Skeleton/Skeleton.vue'; export { default as Spinner } from './Spinner/Spinner.vue'; export { default as MultiSwitch } from './MultiSwitch/MultiSwitch.vue'; export { default as SwitchButton } from './MultiSwitch/SwitchButton.vue'; +export { default as Drawer } from './Drawer/Drawer.vue';