Skip to content

Commit

Permalink
Change some default playground styling
Browse files Browse the repository at this point in the history
Reviewed By: danielbuechele

Differential Revision: D6977989

fbshipit-source-id: 64975685490b8a2230d4effc8791c028b680d2b7
  • Loading branch information
Emil Sjölander authored and facebook-github-bot committed Feb 13, 2018
1 parent a6b7e34 commit 4b7efb7
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 27 deletions.
2 changes: 1 addition & 1 deletion website/src/components/Playground/YogaNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ export default class YogaNode extends Component<Props, State> {
className={`YogaNode ${isFocused ? 'focused' : ''} ${className || ''} ${
this.state.visible ? '' : 'invisible'
}`}
style={{left, top, width, height}}
style={path.length == 0 ? {width, height} : {left, top, width, height}}
onDoubleClick={this.onDoubleClick}
onClick={this.onClick}>
{label && <div className="label">{label}</div>}
Expand Down
8 changes: 8 additions & 0 deletions website/src/components/Playground/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
}

.Playground {
display: flex;
flex-grow: 1;
position: relative;
width: 100%;
Expand All @@ -41,3 +42,10 @@
background-size: 10px 10px, 10px 10px, 100px 100px, 100px 100px, 100px 100px,
100px 100px, 100px 100px, 100px 100px;
}


.Playground > .YogaNode {
margin: auto;
position: static;
align-self: center;
}
29 changes: 3 additions & 26 deletions website/src/components/Playground/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,21 +54,9 @@ export default class Playground extends Component<Props, State> {

static defaultProps = {
layoutDefinition: LayoutRecord({
width: 700,
height: 400,
justifyContent: yoga.JUSTIFY_SPACE_BETWEEN,
alignItems: yoga.ALIGN_FLEX_START,
children: List([LayoutRecord(), LayoutRecord()]),
padding: PositionRecord({
left: '10',
top: '10',
right: '10',
bottom: '10',
}),
margin: PositionRecord({
left: '30',
top: '30',
}),
width: 500,
height: 500,
children: List([LayoutRecord(), LayoutRecord(), LayoutRecord()]),
}),
direction: yoga.DIRECTION_LTR,
maxDepth: 3,
Expand Down Expand Up @@ -248,13 +236,6 @@ export default class Playground extends Component<Props, State> {
ref={ref => {
this._containerRef = ref;
}}>
{/* <Toolbar
onShowCode={
!this.state.showCode
? () => this.setState({selectedNodePath: null, showCode: true})
: undefined
}
/> */}
<YogaNode
layoutDefinition={layoutDefinition}
selectedNodePath={selectedNodePath}
Expand Down Expand Up @@ -296,10 +277,6 @@ export default class Playground extends Component<Props, State> {
width={500}
visible={this.state.showCode}
onClose={() => this.setState({showCode: false})}>
{/* <Code
layoutDefinition={layoutDefinition}
direction={this.state.direction}
/> */}
</Sidebar>
{this.props.persist && <URLShortener />}
</div>
Expand Down

0 comments on commit 4b7efb7

Please sign in to comment.