Skip to content

Commit 77abc8f

Browse files
JoelMarceyMorgan Pretty
authored andcommitted
Move Component Embedded Simulator next to its example
Summary: Right now the embedded simulator is always at the top right corner. This can be confusing as to what code is associated with the simulation. So, move the simulator next to its actual code. This has the added benefit of allowing us to use the React Native Web Player for the simpler examples in the components. Closes facebook#8384 Differential Revision: D3479056 Pulled By: bestander fbshipit-source-id: f400d8387ec771b94d5e798c1e955b25f9a0f1bf
1 parent 5730e0c commit 77abc8f

File tree

2 files changed

+34
-22
lines changed

2 files changed

+34
-22
lines changed

website/layout/AutodocsLayout.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -775,7 +775,7 @@ var EmbeddedSimulator = React.createClass({
775775
: <img alt="Run example in simulator" width="170" height="356" src="img/uiexplorer_main_ios.png" />;
776776

777777
return (
778-
<div className="column-left">
778+
<div className="embedded-simulator">
779779
<p><a className="modal-button-open"><strong>Run this example</strong></a></p>
780780
<div className="modal-button-open modal-button-open-img">
781781
{imagePreview}
@@ -855,9 +855,12 @@ var Autodocs = React.createClass({
855855
path={example.path}
856856
metadata={metadata}
857857
/>
858-
<Prism>
859-
{example.content.replace(/^[\s\S]*?\*\//, '').trim()}
860-
</Prism>
858+
<div className="example-container">
859+
<Prism>
860+
{example.content.replace(/^[\s\S]*?\*\//, '').trim()}
861+
</Prism>
862+
<EmbeddedSimulator shouldRender={metadata.runnable} metadata={metadata} />
863+
</div>
861864
</div>
862865
);
863866
},
@@ -901,9 +904,6 @@ var Autodocs = React.createClass({
901904
{metadata.next && <a className="docs-next" href={'docs/' + metadata.next + '.html#content'}>Next &rarr;</a>}
902905
</div>
903906
</div>
904-
905-
<EmbeddedSimulator shouldRender={metadata.runnable} metadata={metadata} />
906-
907907
</section>
908908
</Site>
909909
);

website/src/react-native/css/react-native.css

Lines changed: 27 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,33 @@ html * {
125125
rendering-intent: auto;
126126
}
127127

128+
.example-container {
129+
position: relative;
130+
}
131+
132+
.embedded-simulator, .embedded-simulator * {
133+
box-sizing: border-box;
134+
}
135+
136+
.embedded-simulator p {
137+
text-align: center;
138+
color: #999;
139+
}
140+
141+
.embedded-simulator {
142+
width: 210px;
143+
position: absolute;
144+
right: -200px;
145+
top: 0;
146+
}
147+
148+
@media screen and (max-width: 680px) {
149+
.embedded-simulator {
150+
position: relative;
151+
right: 0;
152+
}
153+
}
154+
128155
.prism {
129156
white-space: pre-wrap;
130157
font-family: 'source-code-pro', Menlo, 'Courier New', Consolas, monospace;
@@ -1027,21 +1054,6 @@ small code, li code, p code {
10271054
text-decoration: none !important;
10281055
}
10291056

1030-
.column-left, .column-left * {
1031-
box-sizing: border-box;
1032-
}
1033-
1034-
.column-left p {
1035-
text-align: center;
1036-
color: #999;
1037-
}
1038-
1039-
.column-left {
1040-
float: left;
1041-
padding: 20px;
1042-
width: 210px;
1043-
}
1044-
10451057
/* Modal */
10461058
.modal-backdrop {
10471059
background: rgba(0,0,0,.4);

0 commit comments

Comments
 (0)