mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
removed cookbook prefix from filenames
This commit is contained in:
+6
-4
@@ -52,17 +52,19 @@ module.exports = function(grunt) {
|
||||
|
||||
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
|
||||
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);
|
||||
|
||||
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() {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* @jsx React.DOM
|
||||
*/
|
||||
|
||||
var CB_02-INLINE-STYLES TIP_COMPONENT = "
|
||||
var INLINE_STYLES_TIP_COMPONENT = "
|
||||
/** @jsx React.DOM */
|
||||
|
||||
var divStyle = {
|
||||
@@ -14,6 +14,6 @@ var divStyle = {
|
||||
React.renderComponent(<div style={divStyle}>Hello World!</div>, mountNode);
|
||||
";
|
||||
React.renderComponent(
|
||||
ReactPlayground( {codeText:CB_02-INLINE-STYLES TIP_COMPONENT} ),
|
||||
document.getElementById("cb-02InlineStyles tipExample")
|
||||
ReactPlayground( {codeText:INLINE_STYLES_TIP_COMPONENT} ),
|
||||
document.getElementById("InlineStyles tip")
|
||||
);
|
||||
@@ -2,7 +2,7 @@
|
||||
* @jsx React.DOM
|
||||
*/
|
||||
|
||||
var CB_02-INLINE-STYLES_COMPONENT = "
|
||||
var INLINE_STYLES_COMPONENT = "
|
||||
/** @jsx React.DOM */
|
||||
|
||||
var divStyle = {
|
||||
@@ -14,6 +14,6 @@ var divStyle = {
|
||||
React.renderComponent(<div style={divStyle}>Hello World!</div>, mountNode);
|
||||
";
|
||||
React.renderComponent(
|
||||
ReactPlayground( {codeText:CB_02-INLINE-STYLES_COMPONENT} ),
|
||||
document.getElementById("cb-02InlineStylesExample")
|
||||
ReactPlayground( {codeText:INLINE_STYLES_COMPONENT} ),
|
||||
document.getElementById("InlineStyles")
|
||||
);
|
||||
@@ -2,7 +2,7 @@
|
||||
* @jsx React.DOM
|
||||
*/
|
||||
|
||||
var CB_03-IF-ELSE-IN-JSX TIP_COMPONENT = "
|
||||
var IF_ELSE_IN_JSX_TIP_COMPONENT = "
|
||||
/** @jsx React.DOM */
|
||||
|
||||
// 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(
|
||||
ReactPlayground( {codeText:CB_03-IF-ELSE-IN-JSX TIP_COMPONENT} ),
|
||||
document.getElementById("cb-03IfElseIn-JSX tipExample")
|
||||
ReactPlayground( {codeText:IF_ELSE_IN_JSX_TIP_COMPONENT} ),
|
||||
document.getElementById("IfElseIn-JSX tip")
|
||||
);
|
||||
@@ -2,7 +2,7 @@
|
||||
* @jsx React.DOM
|
||||
*/
|
||||
|
||||
var CB_03-IF-ELSE-IN-JSX_COMPONENT = "
|
||||
var IF_ELSE_IN_JSX_COMPONENT = "
|
||||
/** @jsx React.DOM */
|
||||
|
||||
// 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(
|
||||
ReactPlayground( {codeText:CB_03-IF-ELSE-IN-JSX_COMPONENT} ),
|
||||
document.getElementById("cb-03IfElseIn-JSXExample")
|
||||
ReactPlayground( {codeText:IF_ELSE_IN_JSX_COMPONENT} ),
|
||||
document.getElementById("IfElseIn-JSX")
|
||||
);
|
||||
@@ -2,13 +2,13 @@
|
||||
* @jsx React.DOM
|
||||
*/
|
||||
|
||||
var CB_06-STYLE-PROP-VALUE-PX TIP_COMPONENT = "
|
||||
var STYLE_PROP_VALUE_PX_TIP_COMPONENT = "
|
||||
/** @jsx React.DOM */
|
||||
|
||||
var divStyle = {height: 10}; // rendered as "height:10px"
|
||||
React.renderComponent(<div style={divStyle}>Hello World!</div>, mountNode);
|
||||
";
|
||||
React.renderComponent(
|
||||
ReactPlayground( {codeText:CB_06-STYLE-PROP-VALUE-PX TIP_COMPONENT} ),
|
||||
document.getElementById("cb-06StylePropValuePx tipExample")
|
||||
ReactPlayground( {codeText:STYLE_PROP_VALUE_PX_TIP_COMPONENT} ),
|
||||
document.getElementById("StylePropValuePx tip")
|
||||
);
|
||||
@@ -2,13 +2,13 @@
|
||||
* @jsx React.DOM
|
||||
*/
|
||||
|
||||
var CB_06-STYLE-PROP-VALUE-PX_COMPONENT = "
|
||||
var STYLE_PROP_VALUE_PX_COMPONENT = "
|
||||
/** @jsx React.DOM */
|
||||
|
||||
var divStyle = {height: 10}; // rendered as "height:10px"
|
||||
React.renderComponent(<div style={divStyle}>Hello World!</div>, mountNode);
|
||||
";
|
||||
React.renderComponent(
|
||||
ReactPlayground( {codeText:CB_06-STYLE-PROP-VALUE-PX_COMPONENT} ),
|
||||
document.getElementById("cb-06StylePropValuePxExample")
|
||||
ReactPlayground( {codeText:STYLE_PROP_VALUE_PX_COMPONENT} ),
|
||||
document.getElementById("StylePropValuePx")
|
||||
);
|
||||
@@ -2,7 +2,7 @@
|
||||
* @jsx React.DOM
|
||||
*/
|
||||
|
||||
var CB_08-CONTROLLED-INPUT-NULL-VALUE TIP_COMPONENT = "
|
||||
var CONTROLLED_INPUT_NULL_VALUE_TIP_COMPONENT = "
|
||||
/** @jsx React.DOM */
|
||||
|
||||
React.renderComponent(<input value="hi" />, mountNode);
|
||||
@@ -12,6 +12,6 @@ setTimeout(function() {
|
||||
}, 2000);
|
||||
";
|
||||
React.renderComponent(
|
||||
ReactPlayground( {codeText:CB_08-CONTROLLED-INPUT-NULL-VALUE TIP_COMPONENT} ),
|
||||
document.getElementById("cb-08ControlledInputNullValue tipExample")
|
||||
ReactPlayground( {codeText:CONTROLLED_INPUT_NULL_VALUE_TIP_COMPONENT} ),
|
||||
document.getElementById("ControlledInputNullValue tip")
|
||||
);
|
||||
@@ -2,7 +2,7 @@
|
||||
* @jsx React.DOM
|
||||
*/
|
||||
|
||||
var CB_08-CONTROLLED-INPUT-NULL-VALUE_COMPONENT = "
|
||||
var CONTROLLED_INPUT_NULL_VALUE_COMPONENT = "
|
||||
/** @jsx React.DOM */
|
||||
|
||||
React.renderComponent(<input value="hi" />, mountNode);
|
||||
@@ -12,6 +12,6 @@ setTimeout(function() {
|
||||
}, 2000);
|
||||
";
|
||||
React.renderComponent(
|
||||
ReactPlayground( {codeText:CB_08-CONTROLLED-INPUT-NULL-VALUE_COMPONENT} ),
|
||||
document.getElementById("cb-08ControlledInputNullValueExample")
|
||||
ReactPlayground( {codeText:CONTROLLED_INPUT_NULL_VALUE_COMPONENT} ),
|
||||
document.getElementById("ControlledInputNullValue")
|
||||
);
|
||||
Reference in New Issue
Block a user