Skip to content
Repos

DevPlaceApp

C++ 826 B22 lines Opens in site

Directory Raw Download

#include "screens/post/PostContentView.hpp"

#include "screens/components/Box.hpp"
#include "screens/post/PressProxyView.hpp"
#include "ui/Markdown.hpp"

namespace dp {

using namespace ui;

ViewPtr PostContentView(const std::optional<std::string>& topic, const std::optional<std::string>& title,
                        const std::string& content, const PostEnvironment& env) {
  std::vector<ViewPtr> parts;
  if (topic) parts.push_back(CapsuleLabel(*topic));
  if (title) {
    parts.push_back(TappableSelectableText(MarkdownView(*title, FontSpec::title().size)->maxWidth(Alignment::leading()), *title, env));
  }
  parts.push_back(TappableSelectableText(MarkdownView(content)->maxWidth(Alignment::leading()), content, env));
  return VStack(parts, 8, HAlign::Leading)->maxWidth(Alignment::leading());
}

}  // namespace dp
17.0ms