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

Add slots for UI customization #46

Open
guanzo opened this issue Mar 22, 2020 · 2 comments
Open

Add slots for UI customization #46

guanzo opened this issue Mar 22, 2020 · 2 comments
Labels
enhancement New feature or request T: feature A new feature

Comments

@guanzo
Copy link

guanzo commented Mar 22, 2020

Is your feature request related to a problem? Please describe.
When search results return nothing, the UI is blank

Describe the solution you'd like
Add a slot "noSearchResults" to let us provide a UI for no search results.

Maybe consider adding a few more slots to cover the basics, like an scoped emoji slot.
I'm replacing the default emojis with emojis from twemoji. twemoji does not use unicode, it uses images, which forces vue-users to do v-html.

Potential usage:

<template>
<VEmojiPicker @select="selectEmoji">
    <template #noSearchResults>
        No results...
    </template>
    <template #emoji="slotProps">
        <span v-html="toTwemoji(slotProps.emoji)"/>
    </template>
</VEmojiPicker>
</template>

<script>
import twemoji from 'twemoji'

export default {
    methods: {
        toTwemoji: emoji => twemoji.parse(emoji) // returns <img src="..." />
    }
}
</script>

Awesome library, thanks.

@joaoeudes7
Copy link
Owner

I thought about adding slots in positions like ["beforeCategories", "afterCategories", "afterSearch", "afterEmojis"], soon it would be customizable for everyone, but that may be polluted :/

You could set data of emoji as string with the code of image, see EmojiItem.vue

<template>
  <span :class="['emoji', { 'border': withBorder } ]" :style="styleSize" v-html="emoji.data" />
</template>

This resolve show SVG too :) When I have time I will document it, but I haven't tested it with SVG yet.

Thanks for contributing with the suggestions, so feel free if you want to implement something in code :)

@guanzo
Copy link
Author

guanzo commented Mar 23, 2020

but that may be polluted

Yah I agree. Slots are really, really convenient, but you don't want to overuse them. But I do think this lib should provide the important slots. Whats "important" is up to you, but I don't think it includes the generic "beforeX/afterX" slots.

@joaoeudes7 joaoeudes7 added T: feature A new feature enhancement New feature or request labels May 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request T: feature A new feature
Projects
None yet
Development

No branches or pull requests

2 participants