Skip to content

Commit

Permalink
Avoid creating empty <SlotContainer>s
Browse files Browse the repository at this point in the history
  • Loading branch information
MattiasBuelens committed Mar 18, 2024
1 parent 267df87 commit 4d66610
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions react/src/DefaultUI.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,10 @@ export const DefaultUI = (props: DefaultUIProps) => {
return (
<RawDefaultUI {...otherProps} ref={setUi}>
<PlayerContext.Provider value={player}>
<SlotContainer slot="title">{title}</SlotContainer>
<SlotContainer slot="top-control-bar">{topControlBar}</SlotContainer>
<SlotContainer slot="bottom-control-bar">{bottomControlBar}</SlotContainer>
<SlotContainer slot="menu">{menu}</SlotContainer>
{title && <SlotContainer slot="title">{title}</SlotContainer>}
{topControlBar && <SlotContainer slot="top-control-bar">{topControlBar}</SlotContainer>}
{bottomControlBar && <SlotContainer slot="bottom-control-bar">{bottomControlBar}</SlotContainer>}
{menu && <SlotContainer slot="menu">{menu}</SlotContainer>}
</PlayerContext.Provider>
</RawDefaultUI>
);
Expand Down
12 changes: 6 additions & 6 deletions react/src/UIContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -133,13 +133,13 @@ export const UIContainer = (props: UIContainerProps) => {
return (
<RawUIContainer {...otherProps} ref={setUi}>
<PlayerContext.Provider value={player}>
<SlotContainer slot="top-chrome">{topChrome}</SlotContainer>
<SlotContainer slot="middle-chrome">{middleChrome}</SlotContainer>
<SlotContainer slot="centered-chrome">{centeredChrome}</SlotContainer>
<SlotContainer slot="centered-loading">{centeredLoading}</SlotContainer>
{topChrome && <SlotContainer slot="top-chrome">{topChrome}</SlotContainer>}
{middleChrome && <SlotContainer slot="middle-chrome">{middleChrome}</SlotContainer>}
{centeredChrome && <SlotContainer slot="centered-chrome">{centeredChrome}</SlotContainer>}
{centeredLoading && <SlotContainer slot="centered-loading">{centeredLoading}</SlotContainer>}
{bottomChrome}
<SlotContainer slot="menu">{menu}</SlotContainer>
<SlotContainer slot="error">{error}</SlotContainer>
{menu && <SlotContainer slot="menu">{menu}</SlotContainer>}
{error && <SlotContainer slot="error">{error}</SlotContainer>}
</PlayerContext.Provider>
</RawUIContainer>
);
Expand Down

0 comments on commit 4d66610

Please sign in to comment.