-
-
Save natew/2cb7461eee13e5fef569 to your computer and use it in GitHub Desktop.
React - UI Structural question
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Building a UI interface that is composed of Views. | |
One common interface is a split view. Similar to Mail on iPad, it contains a | |
side view and a main view. | |
1.html is my current solution, but thinking of doing 3.html. | |
Problem with current solution is how would Main manipulate props on Side | |
(necessary for parallax effect when dragging out of Main). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div> | |
<ViewSide></ViewSide> | |
<ViewMain></ViewMain> | |
</div> | |
<!-- | |
Current setup. Properties for both views are setup and then | |
passed into a regular View component. | |
Issue is I'd have to have the user to have to pass the ViewSide ID to | |
the ViewMain, or do something hacky so that ViewMain can manipulate ViewSide | |
when it's being dragged. | |
--> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div> | |
<ViewSide> | |
<!-- side content --> | |
<ViewMain></ViewMain> | |
</ViewSide> | |
</div> | |
<!-- | |
This could work as well, but something about the extra nesting | |
seems wrong to me. | |
--> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<SplitView> | |
<View><!-- side content --></View> | |
<View><!-- main content --></View> | |
</SplitView> | |
<!-- | |
SplitView would only accept two children, and would clone the Views | |
to add specific styling for the side and main views. | |
This has the advantage of giving a higher level controlling component. | |
--> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment