Skip to content
Repos

DevPlaceApp

C++ 887 B25 lines Opens in site

Directory Raw Download

#include "screens/reactions/ReactionsBar.hpp"

#include "screens/components/EmojiPicker.hpp"
#include "screens/post/Accessible.hpp"
#include "screens/reactions/ReactionChip.hpp"
#include "screens/reactions/ReactionsStack.hpp"
#include "spec/PostsSpec.hpp"
#include "ui/Controls.hpp"
#include "ui/Palette.hpp"

namespace dp {

using namespace ui;
using spec::PostsLayout;

ViewPtr ReactionsBar(const Reactions& reactions, std::function<void(const std::string&)> onReact) {
  ViewPtr add = Accessible(
      OnTapRect(ReactionChip(Icon("face.smiling", PostsLayout::kAddReactionIcon)->foreground(Palette::fg2()), false),
                [onReact](Rect anchor) { presentEmojiPicker(anchor, onReact); })
          ->id("add-reaction"),
      spec::PostsText::kAddReaction);
  return HStack({ReactionsStack::view(reactions, onReact), add}, PostsLayout::kChipRowSpacing);
}

}  // namespace dp
46.5ms