mirror of
https://github.com/mikedilger/gossip.git
synced 2024-09-29 16:31:18 +00:00
Emoji picker improvements
This commit is contained in:
parent
a188b00ee8
commit
0b6852b53d
41
src/ui/components/mod.rs
Normal file
41
src/ui/components/mod.rs
Normal file
@ -0,0 +1,41 @@
|
||||
use eframe::egui;
|
||||
use egui::{Label, Sense, Ui};
|
||||
|
||||
pub fn emoji_picker(ui: &mut Ui) -> Option<char> {
|
||||
let mut emojis = "😀😁😆😅😂🤣\
|
||||
😕🥺😯😭😍🥰\
|
||||
😊🫡🤔💀🫂👀\
|
||||
❤💜✨🔥⭐⚡\
|
||||
👍🤙🤌🙏🤝🫰\
|
||||
💯🎯✅👑🍆🚩"
|
||||
.chars();
|
||||
|
||||
let mut output: Option<char> = None;
|
||||
|
||||
let mut quit: bool = false;
|
||||
|
||||
loop {
|
||||
ui.vertical(|ui| {
|
||||
ui.horizontal(|ui| {
|
||||
for _ in 0..6 {
|
||||
if let Some(emoji) = emojis.next() {
|
||||
if ui
|
||||
.add(Label::new(emoji.to_string()).sense(Sense::click()))
|
||||
.clicked()
|
||||
{
|
||||
output = Some(emoji);
|
||||
}
|
||||
} else {
|
||||
quit = true;
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
if quit {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
output
|
||||
}
|
@ -230,13 +230,10 @@ fn real_posting_area(app: &mut GossipUi, ctx: &Context, frame: &mut eframe::Fram
|
||||
|
||||
// Emoji picker
|
||||
ui.menu_button(RichText::new("😀▼").size(14.0), |ui| {
|
||||
for emoji in "😀😁😆😅🤣😕😯👀❤💜👍🤙💯🎯🤌🙏🤝🫂⚡🍆".chars()
|
||||
{
|
||||
if ui.button(emoji.to_string()).clicked() {
|
||||
app.draft.push(emoji);
|
||||
}
|
||||
if let Some(emoji) = crate::ui::components::emoji_picker(ui) {
|
||||
app.draft.push(emoji);
|
||||
}
|
||||
});
|
||||
})
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
mod components;
|
||||
mod feed;
|
||||
mod help;
|
||||
mod people;
|
||||
|
Loading…
Reference in New Issue
Block a user