The collapsible element. (#294)

This commit is contained in:
Arthur Sonzogni
2022-01-02 15:48:56 +01:00
committed by GitHub
parent 071d2bc92b
commit fc92f52b4c
7 changed files with 134 additions and 17 deletions

View File

@@ -9,10 +9,10 @@
namespace ftxui {
Component Maybe(Component child, bool* show) {
Component Maybe(Component child, const bool* show) {
class Impl : public ComponentBase {
public:
Impl(bool* show) : show_(show) {}
Impl(const bool* show) : show_(show) {}
private:
Element Render() override {
@@ -25,7 +25,7 @@ Component Maybe(Component child, bool* show) {
return *show_ && ComponentBase::OnEvent(event);
}
bool* show_;
const bool* show_;
};
auto maybe = Make<Impl>(show);