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

[Features] Remove delay #34

Open
silverbackdan opened this issue Jan 21, 2024 · 4 comments
Open

[Features] Remove delay #34

silverbackdan opened this issue Jan 21, 2024 · 4 comments
Labels
enhancement New feature or request

Comments

@silverbackdan
Copy link

Hi, firstly nice little package thank you.

I created this Modal/Dialog but it comes up with a type error when I use it

<script setup lang="ts">
import { computed, ref } from 'vue'
import DialogBox, { type ActionButton } from '#cwa/runtime/templates/components/core/DialogBox.vue'

const props = withDefaults(defineProps<{
  title: string,
  content: string
}>(), {
  title: 'No Title Set',
  content: 'No Content Set'
})

const emit = defineEmits(['confirm', 'cancel'])
const open = ref(true)

const buttons = computed<ActionButton[]>(() => {
  return [
    {
      label: 'Ok',
      color: 'blue',
      buttonClass: 'cwa-min-w-[120px]',
      callbackFn: () => (emit('confirm'))
    },
    {
      label: 'Cancel',
      color: 'grey',
      callbackFn: () => (emit('cancel'))
    }
  ]
})
</script>

<template>
  <DialogBox v-model="open" :title="title" :buttons="buttons">
    <div v-html="props.content" />
  </DialogBox>
</template>

It's fine though, it works and I ignore the typescript error - any tips on what needs to change would be good. I think this follows your guide of what needs to be emitted.

I also have functionality on my dialogs for a transition - I'll adjust my page to set open to false and then emit cancel after, but I did think it'd be quite nice to just have a configurable delay on closing the dialog.

@silverbackdan
Copy link
Author

I would ideally like it so the callback could happen immediately but we just have a delay in removing the component, it'd work nicer if it could work. Thanks again for your work.

@harmyderoman harmyderoman added the enhancement New feature or request label Jan 23, 2024
@harmyderoman
Copy link
Owner

I am not sure what type of error you get but I guess it's this #31

@harmyderoman harmyderoman changed the title [Features] Remove delay + fix typing [Features] Remove delay Jan 23, 2024
@silverbackdan
Copy link
Author

Yes I think for the typescript it'd be a dupe of that. No problem, sorry for the delay in replying, I hadn't seen your comment. What are your thoughts on a remove delay?

@harmyderoman
Copy link
Owner

@silverbackdan I think it's a good idea!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants