Closed madeindjs closed 1 month ago
We discuss about generalizing the way we manage this sort of state. We will try to use EmptinessLabel to encapsulate the behavior.
We would work with this layout
Hello @FabienArcellier & @ramedina86 ,
I'm trying to implement a general behavior to handle empty state for CoreText & CoreMessage . As @FabienArcellier pointed, we might want to have a general way to do this.
I succeded to implement a EmptinessState
component who does the job (https://github.com/writer/writer-framework/pull/482/commits/5ef475be9fd4be7a72d79fc6e063005a22ac0606) but it takes some space in preview mode (as we still render an empty comp).
Screencast from 2024-07-16 00-24-36.webm
I saw empty state of sidebar / Header / etc.. use a different logic. It uses ChildlessPlaceholder
through ComponentProxy.
So I wonder if we want the same mechanism or if it's a bit overkill for the need and the v-if
is enough (https://github.com/writer/writer-framework/pull/482/commits/ba05e5045367a18b69ba6b10f82df38438dd6af3)
WDTY?
Hello @FabienArcellier & @ramedina86 ,
I'm trying to implement a general behavior to handle empty state for CoreText & CoreMessage . As @FabienArcellier pointed, we might want to have a general way to do this.
I succeded to implement a
EmptinessState
component who does the job (5ef475b) but it takes some space in preview mode (as we still render an empty comp).Screencast.from.2024-07-16.00-24-36.webm I saw empty state of sidebar / Header / etc.. use a different logic. It uses
ChildlessPlaceholder
through ComponentProxy.So I wonder if we want the same mechanism or if it's a bit overkill for the need and the
v-if
is enough (ba05e50)WDTY?
For the empty state of sidebar / Header / etc
, I would stick to the current logic. The v-if looks fine.
@madeindjs Those are two different things
Childless placeholder: Automatically applied to any component that can contain children but doesn't
The other one (what you've called EmptinessState
) should be used for when rendering the component would yield undesirable results due to lack of configuration/content.
Simply hide the
CoreText
usingv-if
in preview mode if the value isemptyText
. We still display the component in edit mode.Screencast from 2024-06-29 14-37-01.webm