JosephusPaye / Keen-UI

A lightweight Vue.js UI library with a simple API, inspired by Google's Material Design.
https://josephuspaye.github.io/Keen-UI/
MIT License
4.1k stars 438 forks source link

UiAlert enhancement: Change 'dismissible' to 'persist' (#468) #558

Closed amal-qb closed 1 year ago

amal-qb commented 1 year ago

This PR brings one of the enhancements suggested in #468, which is changing the dismissible prop to persist for the UiAlert component.

amal-qb commented 1 year ago

@JosephusPaye Can you please review this PR?

JosephusPaye commented 1 year ago

Hi @amal-qb,

Thanks for the PR. Unfortately at this point I don't think the cost of this change (making a new release with a breaking change, requiring all users to update their Keen UI code) is worth it.

If you'd like to, you can create a wrapper component in your code that adjusts the API of any of the Keen UI components to suit your usage.

Here's a rough example showing the idea:

<!-- MyUiAlert.vue -->
<template>
  <UiAlert :type="type" :remove-icon="removeIcon" :disable-animation="disableAnimation" :dismissible="!persist" @dismiss="$emit('dismiss')">
    <slot></slot>
  </UiAlert>
</template>

<script>
import { UiAlert } from "keen-ui";

export default {
  name: "MyUiAlert",

  components: {
    UiAlert,
  },

  props: {
    type: String,
    removeIcon: Boolean,
    disableAnimation: Boolean,
    persist: Boolean, // Changed from `dismissible`
  },

  emits: ["dismiss"],
};
</script>