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

API to override favorite emojis #323

Open
spiffytech opened this issue Mar 10, 2023 · 8 comments
Open

API to override favorite emojis #323

spiffytech opened this issue Mar 10, 2023 · 8 comments
Labels
enhancement New feature or request

Comments

@spiffytech
Copy link

I'd like to display favorites based on application data from outside emoji-picker-element.

Could we get a method on Database that clears the favorites counts and replaces them with the provided data?

@spiffytech
Copy link
Author

I thought about just asking for CSS to hide the favorites bar so I could display my own. That'd suit more use cases, but I'm not sure how I'd get the items in my custom favorites bar to line up with the emoji picker's columns.

@nolanlawson
Copy link
Owner

Interesting, so you want to manage all the favorites yourself? Not just the default favorites? How are you planning to determine the list – is it hardcoded?

Getting them to line up would be very tricky; there is code in emoji-picker-element to calculate the scrollbar width and account for that on platforms that show it (Windows, Linux).

@nolanlawson nolanlawson added the enhancement New feature or request label Mar 11, 2023
@spiffytech
Copy link
Author

spiffytech commented Mar 11, 2023

It would be dynamic.

I'm using the picker to apply emoji as content tags. I'd like to display favorites based on the tags presently attached to the user's data, including changes made on other devices. That'd also automatically factor in changes in emoji usage over time as old content gets removed.

@nolanlawson
Copy link
Owner

I see, so would it be acceptable to you to have an API something like this?

const picker = new Picker({
  favorites: ['😅', '😺', '🪵', '🤪', '👍️', '👏', '⚽️', '🎯']
})

or:

const picker = document.querySelector('emoji-picker')
picker.favorites = ['😅', '😺', '🪵', '🤪', '👍️', '👏', '⚽️', '🎯']

Basically the API would let you pass in a list of 8 emoji that you want to show in the favorites bar. You can update it yourself based on whatever criteria you want.

I guess we could also have an HTML attribute version, but it may be awkward since it would have to be a string.

@spiffytech
Copy link
Author

Yeah, that would take care of what I need.

I like the second code snippet; it'd be easy to have SolidJS grab me a reference to the picker element.

@zehawki
Copy link

zehawki commented Dec 12, 2023

I came here looking exactly for this, and to ask for an addition:

  1. Favorites bar can be treated as a "reactions bar", so a prop with favorites=[] is perfect.
  2. Allow for placement above like this:

image

@nolanlawson
Copy link
Owner

Placing above might look kind of weird – the grid is supposed to be aligned with the favorites bar (note in your screenshot the gap on the right to account for the scrollbar).

@zehawki
Copy link

zehawki commented Dec 13, 2023

I suggest placing the fav bar above by default, since it declutters the UI. As it stands, one would not know its a fav bar, but if its placed above, with a bottom-border to separate - then the user knows that its a special bar.

Then it can be used in multiple ways based on some prop setting:

  1. a hard coded fav bar, which can be set by the dev based on his/her purpose
  2. or it can become a "recently used" strip that is computed by this library
  3. or it can become a "frequently used" strip that is computed by this library

the grid is supposed to be aligned with the favorites bar (note in your screenshot the gap on the right to account for the scrollbar).

Thats just a bit of flex centering...

image

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

3 participants