[Lona Studio] Implement bottom pane hide/show
dabbott opened this issue · comments
Summary
This button should hide/show the bottom section of the UI, but currently it does nothing!
Let's fix that. Some new users have been pretty confused by why the bottom hasn't been responding...
Proposed Implementation
When the activePanes
change... https://github.com/airbnb/Lona/blob/9ee49dfbb9d3dce6309c90b93c51c6949cf4f214/studio/LonaStudio/Workspace/WorkspaceViewController.swift#L84
We currently ignore the bottom pane: https://github.com/airbnb/Lona/blob/9ee49dfbb9d3dce6309c90b93c51c6949cf4f214/studio/LonaStudio/Workspace/WorkspaceViewController.swift#L301
Instead, we need to hide/show the bottomItem
in the ComponentEditorViewController
: https://github.com/airbnb/Lona/blob/9ee49dfbb9d3dce6309c90b93c51c6949cf4f214/studio/LonaStudio/Workspace/ComponentEditorViewController.swift#L213-L216
The easiest way to do this is probably to expose the bottomItem
as a public or internal variable of the ComponentEditorViewController
, but this isn't a great approach, since then we're exposing implementation details to a parent view controller. If we make bottomItem
a member variable, it should be private.
Instead, let's add a variable var utilitiesViewVisible: Bool
(with a didSet
block) to ComponentEditorViewController
, which we can then update from the WorkspaceViewController
. The WorkspaceViewController
contains an instance of ComponentEditorViewController
we can use: https://github.com/airbnb/Lona/blob/9ee49dfbb9d3dce6309c90b93c51c6949cf4f214/studio/LonaStudio/Workspace/WorkspaceViewController.swift#L127
We'll also need to add/copy something similar to setVisibility
into ComponentEditorViewController
to do the actual hiding/showing.
https://github.com/airbnb/Lona/blob/9ee49dfbb9d3dce6309c90b93c51c6949cf4f214/studio/LonaStudio/Workspace/WorkspaceViewController.swift#L305-L315
For bonus points, also update the splitter https://github.com/airbnb/Lona/blob/9ee49dfbb9d3dce6309c90b93c51c6949cf4f214/studio/LonaStudio/Workspace/ComponentEditorViewController.swift#L151 to have a thickness of 0 when the bottom pane is hidden: https://github.com/airbnb/Lona/blob/9ee49dfbb9d3dce6309c90b93c51c6949cf4f214/studio/LonaStudio/Workspace/SectionSplitter.swift#L22
I'd recommend starting by setting a breakpoint in activePanes
so you can see how clicking the toolbar button updates this value and take it from there.
I'll take this issue.
This is fixed right?