Skip to content

Commit

Permalink
separate flex example from main demo page
Browse files Browse the repository at this point in the history
  • Loading branch information
GuyR committed Aug 15, 2016
1 parent ae07daa commit f11fc07
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 8 deletions.
18 changes: 18 additions & 0 deletions example/firstComp/firstComp.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,29 @@
define(['react', 'lodash', './demoText', './firstComp.rt'], function (React, _, demoText, template) {
'use strict';

function getParameterByName(name) {
var url = window.location.href;
name = name.replace(/[\[\]]/g, '\\$&');
var regex = new RegExp('[?&]' + name + '(=([^&#]*)|&|#|$)'),
results = regex.exec(url);
if (!results) {
return null;
}
if (!results[2]) {
return false;
}
return decodeURIComponent(results[2].replace(/\+/g, ' '));
}


return React.createClass({
displayName: 'firstComp',
getText: function () {
return demoText.text;
},
isFlexExample: function () {
return getParameterByName('flex');
},
render: template
});
});
10 changes: 5 additions & 5 deletions example/firstComp/firstComp.rt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<rt-require dependency="customScroll" as="customScroll"/>
<div class="example-wrapper">
<div class="container native-scroll">
<div rt-if="!this.isFlexExample()" key="native-example" class="container native-scroll">
<label class="side-title">Native Scroll</label>

<div class="panel">
Expand All @@ -13,7 +13,7 @@
</div>

</div>
<div class="container custom-scroll-example">
<div rt-if="!this.isFlexExample()" key="cool-example" class="container custom-scroll-example">
<label class="side-title">Custom Scroll</label>

<div class="panel">
Expand All @@ -27,7 +27,7 @@
</customScroll>
</div>
</div>
<div class="container custom-scroll-example">
<div rt-if="!this.isFlexExample()" key="crazy-example" class="container custom-scroll-example">
<label class="side-title">Crazy Designer</label>

<div class="panel crazy-scroll">
Expand All @@ -41,8 +41,8 @@
</customScroll>
</div>
</div>
<div class="container example-flex-wrapper">
<label class="side-title">Flex Scroll</label>
<div rt-if="this.isFlexExample()" key="flex-example" class="container example-flex-wrapper">
<label class="side-title">With CSS Flex</label>

<div class="panel flex-scroll">
<div class="panel-header">
Expand Down
16 changes: 14 additions & 2 deletions example/firstComp/firstComp.rt.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion src/test/customScroll.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,6 @@ describe('custom scroll', function () {
expect(customScrollbarStyle.left).toEqual('3px');
expect(innerContainerStyle.marginLeft).toEqual('-20px');
expect(contentWrapperStyle.marginLeft).toEqual('20px');

});
});

Expand Down

0 comments on commit f11fc07

Please sign in to comment.