Browse Source

removed cookbook prefix from filenames

main
Connor McSheffrey 11 years ago
parent
commit
b18b0c9c9a
  1. 10
      Gruntfile.js
  2. 6
      js/cookbook/cb-02-inline-styles tip.js
  3. 6
      js/cookbook/cb-02-inline-styles.js
  4. 6
      js/cookbook/cb-03-if-else-in-JSX tip.js
  5. 6
      js/cookbook/cb-03-if-else-in-JSX.js
  6. 6
      js/cookbook/cb-06-style-prop-value-px tip.js
  7. 6
      js/cookbook/cb-06-style-prop-value-px.js
  8. 6
      js/cookbook/cb-08-controlled-input-null-value tip.js
  9. 6
      js/cookbook/cb-08-controlled-input-null-value.js

10
Gruntfile.js

@ -52,17 +52,19 @@ module.exports = function(grunt) {
componentNameCamelCase = componentName; componentNameCamelCase = componentName;
componentNameUpperCase = componentName.toUpperCase().replace(/[\. ,:-]+/g, "_"); componentNameUpperCase = componentName.toUpperCase().replace(/[\. ,:-]+/g, "_").slice(6);
componentNameCamelCase = componentNameCamelCase.replace(/-([a-z])/g, function (g) { return g[1].toUpperCase() });
componentNameCamelCase = componentNameCamelCase.replace(/-([a-z])/g, function (g) { return g[1].toUpperCase() }).slice(5);
// Add code sample to live edit // Add code sample to live edit
liveEditJS = '/**\n * @jsx React.DOM\n */\n\n var ' + componentNameUpperCase + '_COMPONENT = "' + matchedJS + '";\n React.renderComponent(\n ReactPlayground( {codeText:' + componentNameUpperCase + '_COMPONENT} ),\n document.getElementById("' + componentNameCamelCase + 'Example")\n );' liveEditJS = '/**\n * @jsx React.DOM\n */\n\n var ' + componentNameUpperCase + '_COMPONENT = "' + matchedJS + '";\n React.renderComponent(\n ReactPlayground( {codeText:' + componentNameUpperCase + '_COMPONENT} ),\n document.getElementById("' + componentNameCamelCase + '")\n );'
console.log(componentName); console.log(componentName);
writeToLiveSampleJS(liveEditJS, componentName); writeToLiveSampleJS(liveEditJS, componentName);
writeToHTML(markdown, componentName); // writeToHTML(markdown, componentName);
} }
grunt.registerTask('makeLiveSamples', 'Create live edit JS file for code samples in React Cookbook entries', function() { grunt.registerTask('makeLiveSamples', 'Create live edit JS file for code samples in React Cookbook entries', function() {

6
js/cookbook/cb-02-inline-styles tip.js

@ -2,7 +2,7 @@
* @jsx React.DOM * @jsx React.DOM
*/ */
var CB_02-INLINE-STYLES TIP_COMPONENT = " var INLINE_STYLES_TIP_COMPONENT = "
/** @jsx React.DOM */ /** @jsx React.DOM */
var divStyle = { var divStyle = {
@ -14,6 +14,6 @@ var divStyle = {
React.renderComponent(<div style={divStyle}>Hello World!</div>, mountNode); React.renderComponent(<div style={divStyle}>Hello World!</div>, mountNode);
"; ";
React.renderComponent( React.renderComponent(
ReactPlayground( {codeText:CB_02-INLINE-STYLES TIP_COMPONENT} ), ReactPlayground( {codeText:INLINE_STYLES_TIP_COMPONENT} ),
document.getElementById("cb-02InlineStyles tipExample") document.getElementById("InlineStyles tip")
); );

6
js/cookbook/cb-02-inline-styles.js

@ -2,7 +2,7 @@
* @jsx React.DOM * @jsx React.DOM
*/ */
var CB_02-INLINE-STYLES_COMPONENT = " var INLINE_STYLES_COMPONENT = "
/** @jsx React.DOM */ /** @jsx React.DOM */
var divStyle = { var divStyle = {
@ -14,6 +14,6 @@ var divStyle = {
React.renderComponent(<div style={divStyle}>Hello World!</div>, mountNode); React.renderComponent(<div style={divStyle}>Hello World!</div>, mountNode);
"; ";
React.renderComponent( React.renderComponent(
ReactPlayground( {codeText:CB_02-INLINE-STYLES_COMPONENT} ), ReactPlayground( {codeText:INLINE_STYLES_COMPONENT} ),
document.getElementById("cb-02InlineStylesExample") document.getElementById("InlineStyles")
); );

6
js/cookbook/cb-03-if-else-in-JSX tip.js

@ -2,7 +2,7 @@
* @jsx React.DOM * @jsx React.DOM
*/ */
var CB_03-IF-ELSE-IN-JSX TIP_COMPONENT = " var IF_ELSE_IN_JSX_TIP_COMPONENT = "
/** @jsx React.DOM */ /** @jsx React.DOM */
// this // this
@ -11,6 +11,6 @@ React.renderComponent(<div id="msg">Hello World!</div>, mountNode);
React.renderComponent(React.DOM.div({id:"msg"}, "Hello World!"), mountNode); React.renderComponent(React.DOM.div({id:"msg"}, "Hello World!"), mountNode);
"; ";
React.renderComponent( React.renderComponent(
ReactPlayground( {codeText:CB_03-IF-ELSE-IN-JSX TIP_COMPONENT} ), ReactPlayground( {codeText:IF_ELSE_IN_JSX_TIP_COMPONENT} ),
document.getElementById("cb-03IfElseIn-JSX tipExample") document.getElementById("IfElseIn-JSX tip")
); );

6
js/cookbook/cb-03-if-else-in-JSX.js

@ -2,7 +2,7 @@
* @jsx React.DOM * @jsx React.DOM
*/ */
var CB_03-IF-ELSE-IN-JSX_COMPONENT = " var IF_ELSE_IN_JSX_COMPONENT = "
/** @jsx React.DOM */ /** @jsx React.DOM */
// this // this
@ -11,6 +11,6 @@ React.renderComponent(<div id="msg">Hello World!</div>, mountNode);
React.renderComponent(React.DOM.div({id:"msg"}, "Hello World!"), mountNode); React.renderComponent(React.DOM.div({id:"msg"}, "Hello World!"), mountNode);
"; ";
React.renderComponent( React.renderComponent(
ReactPlayground( {codeText:CB_03-IF-ELSE-IN-JSX_COMPONENT} ), ReactPlayground( {codeText:IF_ELSE_IN_JSX_COMPONENT} ),
document.getElementById("cb-03IfElseIn-JSXExample") document.getElementById("IfElseIn-JSX")
); );

6
js/cookbook/cb-06-style-prop-value-px tip.js

@ -2,13 +2,13 @@
* @jsx React.DOM * @jsx React.DOM
*/ */
var CB_06-STYLE-PROP-VALUE-PX TIP_COMPONENT = " var STYLE_PROP_VALUE_PX_TIP_COMPONENT = "
/** @jsx React.DOM */ /** @jsx React.DOM */
var divStyle = {height: 10}; // rendered as "height:10px" var divStyle = {height: 10}; // rendered as "height:10px"
React.renderComponent(<div style={divStyle}>Hello World!</div>, mountNode); React.renderComponent(<div style={divStyle}>Hello World!</div>, mountNode);
"; ";
React.renderComponent( React.renderComponent(
ReactPlayground( {codeText:CB_06-STYLE-PROP-VALUE-PX TIP_COMPONENT} ), ReactPlayground( {codeText:STYLE_PROP_VALUE_PX_TIP_COMPONENT} ),
document.getElementById("cb-06StylePropValuePx tipExample") document.getElementById("StylePropValuePx tip")
); );

6
js/cookbook/cb-06-style-prop-value-px.js

@ -2,13 +2,13 @@
* @jsx React.DOM * @jsx React.DOM
*/ */
var CB_06-STYLE-PROP-VALUE-PX_COMPONENT = " var STYLE_PROP_VALUE_PX_COMPONENT = "
/** @jsx React.DOM */ /** @jsx React.DOM */
var divStyle = {height: 10}; // rendered as "height:10px" var divStyle = {height: 10}; // rendered as "height:10px"
React.renderComponent(<div style={divStyle}>Hello World!</div>, mountNode); React.renderComponent(<div style={divStyle}>Hello World!</div>, mountNode);
"; ";
React.renderComponent( React.renderComponent(
ReactPlayground( {codeText:CB_06-STYLE-PROP-VALUE-PX_COMPONENT} ), ReactPlayground( {codeText:STYLE_PROP_VALUE_PX_COMPONENT} ),
document.getElementById("cb-06StylePropValuePxExample") document.getElementById("StylePropValuePx")
); );

6
js/cookbook/cb-08-controlled-input-null-value tip.js

@ -2,7 +2,7 @@
* @jsx React.DOM * @jsx React.DOM
*/ */
var CB_08-CONTROLLED-INPUT-NULL-VALUE TIP_COMPONENT = " var CONTROLLED_INPUT_NULL_VALUE_TIP_COMPONENT = "
/** @jsx React.DOM */ /** @jsx React.DOM */
React.renderComponent(<input value="hi" />, mountNode); React.renderComponent(<input value="hi" />, mountNode);
@ -12,6 +12,6 @@ setTimeout(function() {
}, 2000); }, 2000);
"; ";
React.renderComponent( React.renderComponent(
ReactPlayground( {codeText:CB_08-CONTROLLED-INPUT-NULL-VALUE TIP_COMPONENT} ), ReactPlayground( {codeText:CONTROLLED_INPUT_NULL_VALUE_TIP_COMPONENT} ),
document.getElementById("cb-08ControlledInputNullValue tipExample") document.getElementById("ControlledInputNullValue tip")
); );

6
js/cookbook/cb-08-controlled-input-null-value.js

@ -2,7 +2,7 @@
* @jsx React.DOM * @jsx React.DOM
*/ */
var CB_08-CONTROLLED-INPUT-NULL-VALUE_COMPONENT = " var CONTROLLED_INPUT_NULL_VALUE_COMPONENT = "
/** @jsx React.DOM */ /** @jsx React.DOM */
React.renderComponent(<input value="hi" />, mountNode); React.renderComponent(<input value="hi" />, mountNode);
@ -12,6 +12,6 @@ setTimeout(function() {
}, 2000); }, 2000);
"; ";
React.renderComponent( React.renderComponent(
ReactPlayground( {codeText:CB_08-CONTROLLED-INPUT-NULL-VALUE_COMPONENT} ), ReactPlayground( {codeText:CONTROLLED_INPUT_NULL_VALUE_COMPONENT} ),
document.getElementById("cb-08ControlledInputNullValueExample") document.getElementById("ControlledInputNullValue")
); );
Loading…
Cancel
Save