{
Object.keys(lists)
- .sort((a, b) => sort(config.categoryOrder[a], config.categoryOrder[b]))
- .map((cate, index) => (lists[cate].length ? (
-
(
- {
- const { cateOpend } = this.state;
- cateOpend[index] = !cateOpend[index];
- this.setState({ cateOpend });
- }}
- className="am-demo-category"
- >
-
{appLocale.locale === 'en-US' ? cate : `${config.cateChinese[cate]} ${cate}`}
-
-
- )}
- className={this.state.cateOpend[index] ? 'category-open' : 'category-closed'}
- >
- {
- lists[cate].sort((a, b) => sort(a.title.toLowerCase(), b.title.toLowerCase())).map((item) => {
- const paths = item.filename.split('/');
- if (config.indexDemos.indexOf(paths[1]) > -1) {
- return item.demos.sort((a, b) => a.order > b.order).map(j => (
+ .sort((a, b) => sort(config.categoryOrder[a], config.categoryOrder[b]))
+ .map((cate, index) => (lists[cate].length ? (
+ (
+ {
+ const { cateOpend } = this.state;
+ cateOpend[index] = !cateOpend[index];
+ this.setState({ cateOpend });
+ }}
+ className="am-demo-category"
+ >
+
{appLocale.locale === 'en-US' ? cate : `${config.cateChinese[cate]} ${cate}`}
+
+
+ )}
+ className={this.state.cateOpend[index] ? 'category-open' : 'category-closed'}
+ >
+ {
+ lists[cate].sort((a, b) => sort(a.title.toLowerCase(), b.title.toLowerCase())).map((item) => {
+ const paths = item.filename.split('/');
+ if (config.indexDemos.indexOf(paths[1]) > -1) {
+ return item.demos.sort((a, b) => a.order > b.order).map(j => (
+ location.href = `${rootPath}/${paths[1]}${this.addSearch()}#${
+ paths[1] + config.hashSpliter + j.order
+ }`}
+ >
+ {`${item.title} ${appLocale.locale === 'zh-CN' ? item.subtitle : ''}-${j.title[appLocale.locale]}`}
+
+ ));
+ }
+ return (
location.href = `${rootPath}/${paths[1]}${this.addSearch()}#${
- paths[1] + config.hashSpliter + j.order
- }`}
+ key={`${item.filename}-${cate}`}
+ onClick={() => { location.href = `${rootPath}/${paths[1]}${this.addSearch()}`; }}
>
- {`${item.title} ${appLocale.locale === 'zh-CN' ? item.subtitle : ''}-${j.title[appLocale.locale]}`}
+ {`${item.title} `}
+ {!item.subtitle || appLocale.locale === 'en-US' ? null : item.subtitle}
- ));
- }
- return (
- { location.href = `${rootPath}/${paths[1]}${this.addSearch()}`; }}
- >
- {`${item.title} `}
- {!item.subtitle || appLocale.locale === 'en-US' ? null : item.subtitle}
-
- );
- })
- }
-
- ) : null))
+ );
+ })
+ }
+
+ ) : null))
}
diff --git a/site/utils.jsx b/site/utils.jsx
index b1fab91844..89ad6b33f0 100644
--- a/site/utils.jsx
+++ b/site/utils.jsx
@@ -66,7 +66,7 @@ export function isLocalStorageNameSupported() {
export function collectDocs(docs) {
// locale copy from layout
const locale = (window.localStorage && localStorage.getItem('locale') !== 'en-US') ?
- 'zh-CN' : 'en-US';
+ 'zh-CN' : 'en-US';
const docsList = Object.keys(docs)
.map(key => docs[key])
.map((value) => {