mirror of
https://github.com/status-im/react-native.git
synced 2025-01-27 17:54:48 +00:00
[Docs] Remove Transforms from sidebar, add to Style
This commit is contained in:
parent
731d4a0610
commit
debd5b0942
@ -95,7 +95,8 @@ var List = React.createClass({
|
|||||||
|
|
||||||
You can checkout latest support of CSS Properties in following Links.
|
You can checkout latest support of CSS Properties in following Links.
|
||||||
|
|
||||||
- [View Properties](http://facebook.github.io/react-native/docs/view.html#style)
|
- [View Properties](/react-native/docs/view.html#style)
|
||||||
- [Image Properties](http://facebook.github.io/react-native/docs/image.html#style)
|
- [Image Properties](/react-native/docs/image.html#style)
|
||||||
- [Text Properties](http://facebook.github.io/react-native/docs/text.html#style)
|
- [Text Properties](/react-native/docs/text.html#style)
|
||||||
- [Flex Properties](http://facebook.github.io/react-native/docs/flexbox.html#content)
|
- [Flex Properties](/react-native/docs/flexbox.html#content)
|
||||||
|
- [Transform Properties](/react-native/docs/transforms.html#content)
|
||||||
|
@ -69,7 +69,10 @@ function execute() {
|
|||||||
try { value = JSON.parse(value); } catch(e) { }
|
try { value = JSON.parse(value); } catch(e) { }
|
||||||
metadata[key] = value;
|
metadata[key] = value;
|
||||||
}
|
}
|
||||||
metadatas.files.push(metadata);
|
|
||||||
|
if (metadata.sidebar !== false) {
|
||||||
|
metadatas.files.push(metadata);
|
||||||
|
}
|
||||||
|
|
||||||
if (metadata.permalink.match(/^https?:/)) {
|
if (metadata.permalink.match(/^https?:/)) {
|
||||||
return;
|
return;
|
||||||
|
@ -44,6 +44,33 @@ function getExample(componentName) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Hide a component from the sidebar by making it return false from
|
||||||
|
// this function
|
||||||
|
function shouldDisplayInSidebar(componentName) {
|
||||||
|
if (componentName === 'Transforms') {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getNextComponent(i) {
|
||||||
|
var next;
|
||||||
|
var filepath = all[i];
|
||||||
|
|
||||||
|
if (all[i + 1]) {
|
||||||
|
var nextComponentName = getNameFromPath(all[i + 1]);
|
||||||
|
|
||||||
|
if (shouldDisplayInSidebar(nextComponentName)) {
|
||||||
|
return slugify(nextComponentName);
|
||||||
|
} else {
|
||||||
|
return getNextComponent(i + 1);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return 'network';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function componentsToMarkdown(type, json, filepath, i, styles) {
|
function componentsToMarkdown(type, json, filepath, i, styles) {
|
||||||
var componentName = getNameFromPath(filepath);
|
var componentName = getNameFromPath(filepath);
|
||||||
|
|
||||||
@ -59,16 +86,19 @@ function componentsToMarkdown(type, json, filepath, i, styles) {
|
|||||||
}
|
}
|
||||||
json.example = getExample(componentName);
|
json.example = getExample(componentName);
|
||||||
|
|
||||||
|
// Put Flexbox into the Polyfills category
|
||||||
|
var category = (type === 'style' ? 'Polyfills' : type + 's');
|
||||||
|
var next = getNextComponent(i);
|
||||||
|
|
||||||
var res = [
|
var res = [
|
||||||
'---',
|
'---',
|
||||||
'id: ' + slugify(componentName),
|
'id: ' + slugify(componentName),
|
||||||
'title: ' + componentName,
|
'title: ' + componentName,
|
||||||
'layout: autodocs',
|
'layout: autodocs',
|
||||||
'category: ' + (type === 'style' ? 'Polyfills' : type + 's'),
|
'category: ' + category,
|
||||||
'permalink: docs/' + slugify(componentName) + '.html',
|
'permalink: docs/' + slugify(componentName) + '.html',
|
||||||
'next: ' + (all[i + 1] ?
|
'next: ' + next,
|
||||||
slugify(getNameFromPath(all[i + 1])) :
|
'sidebar: ' + shouldDisplayInSidebar(componentName),
|
||||||
'network'),
|
|
||||||
'---',
|
'---',
|
||||||
JSON.stringify(json, null, 2),
|
JSON.stringify(json, null, 2),
|
||||||
].filter(function(line) { return line; }).join('\n');
|
].filter(function(line) { return line; }).join('\n');
|
||||||
@ -107,16 +137,13 @@ function renderStyle(filepath) {
|
|||||||
[docgen.handlers.propTypeHandler]
|
[docgen.handlers.propTypeHandler]
|
||||||
);
|
);
|
||||||
|
|
||||||
// Remove deprecated style props
|
// Remove deprecated transform props from docs
|
||||||
if (filepath === "../Libraries/StyleSheet/TransformPropTypes.js") {
|
if (filepath === "../Libraries/StyleSheet/TransformPropTypes.js") {
|
||||||
['rotation', 'scaleX', 'scaleY', 'translateX', 'translateY'].forEach(function(key) {
|
['rotation', 'scaleX', 'scaleY', 'translateX', 'translateY'].forEach(function(key) {
|
||||||
delete json['props'][key];
|
delete json['props'][key];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// console.log(json);
|
|
||||||
|
|
||||||
return componentsToMarkdown('style', json, filepath, n++);
|
return componentsToMarkdown('style', json, filepath, n++);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ glob('src/**/*.*', function(er, files) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (response.statusCode != 200) {
|
if (response.statusCode != 200) {
|
||||||
reject(new Error('Status ' + response.statusCode + ':\n' + body));
|
reject(new Error('Status ' + response.statusCode + ':\n' + body));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
mkdirp.sync(targetFile.replace(new RegExp('/[^/]*$'), ''));
|
mkdirp.sync(targetFile.replace(new RegExp('/[^/]*$'), ''));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user