mirror of
https://github.com/status-im/react-native.git
synced 2025-01-27 01:40:08 +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.
|
||||
|
||||
- [View Properties](http://facebook.github.io/react-native/docs/view.html#style)
|
||||
- [Image Properties](http://facebook.github.io/react-native/docs/image.html#style)
|
||||
- [Text Properties](http://facebook.github.io/react-native/docs/text.html#style)
|
||||
- [Flex Properties](http://facebook.github.io/react-native/docs/flexbox.html#content)
|
||||
- [View Properties](/react-native/docs/view.html#style)
|
||||
- [Image Properties](/react-native/docs/image.html#style)
|
||||
- [Text Properties](/react-native/docs/text.html#style)
|
||||
- [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) { }
|
||||
metadata[key] = value;
|
||||
}
|
||||
metadatas.files.push(metadata);
|
||||
|
||||
if (metadata.sidebar !== false) {
|
||||
metadatas.files.push(metadata);
|
||||
}
|
||||
|
||||
if (metadata.permalink.match(/^https?:/)) {
|
||||
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) {
|
||||
var componentName = getNameFromPath(filepath);
|
||||
|
||||
@ -59,16 +86,19 @@ function componentsToMarkdown(type, json, filepath, i, styles) {
|
||||
}
|
||||
json.example = getExample(componentName);
|
||||
|
||||
// Put Flexbox into the Polyfills category
|
||||
var category = (type === 'style' ? 'Polyfills' : type + 's');
|
||||
var next = getNextComponent(i);
|
||||
|
||||
var res = [
|
||||
'---',
|
||||
'id: ' + slugify(componentName),
|
||||
'title: ' + componentName,
|
||||
'layout: autodocs',
|
||||
'category: ' + (type === 'style' ? 'Polyfills' : type + 's'),
|
||||
'category: ' + category,
|
||||
'permalink: docs/' + slugify(componentName) + '.html',
|
||||
'next: ' + (all[i + 1] ?
|
||||
slugify(getNameFromPath(all[i + 1])) :
|
||||
'network'),
|
||||
'next: ' + next,
|
||||
'sidebar: ' + shouldDisplayInSidebar(componentName),
|
||||
'---',
|
||||
JSON.stringify(json, null, 2),
|
||||
].filter(function(line) { return line; }).join('\n');
|
||||
@ -107,16 +137,13 @@ function renderStyle(filepath) {
|
||||
[docgen.handlers.propTypeHandler]
|
||||
);
|
||||
|
||||
// Remove deprecated style props
|
||||
// Remove deprecated transform props from docs
|
||||
if (filepath === "../Libraries/StyleSheet/TransformPropTypes.js") {
|
||||
['rotation', 'scaleX', 'scaleY', 'translateX', 'translateY'].forEach(function(key) {
|
||||
delete json['props'][key];
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// console.log(json);
|
||||
|
||||
return componentsToMarkdown('style', json, filepath, n++);
|
||||
}
|
||||
|
||||
|
@ -36,7 +36,7 @@ glob('src/**/*.*', function(er, files) {
|
||||
return;
|
||||
}
|
||||
if (response.statusCode != 200) {
|
||||
reject(new Error('Status ' + response.statusCode + ':\n' + body));
|
||||
reject(new Error('Status ' + response.statusCode + ':\n' + body));
|
||||
return;
|
||||
}
|
||||
mkdirp.sync(targetFile.replace(new RegExp('/[^/]*$'), ''));
|
||||
|
Loading…
x
Reference in New Issue
Block a user