diff --git a/CHANGELOG.md b/CHANGELOG.md index 825a4fb..8bc29a4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). ## [Unreleased] +### Added +- Support for displaying a complete list of available components on `ComponentsGrid`. ## [0.20.1] - 2019-08-29 diff --git a/react/ComponentsGrid.tsx b/react/ComponentsGrid.tsx index f18cf6d..b519e33 100644 --- a/react/ComponentsGrid.tsx +++ b/react/ComponentsGrid.tsx @@ -44,8 +44,14 @@ const ComponentsGrid: FC = ({ ComponentsListQuery }) => { route: { params }, } = useRuntime() - const componentsListForCategory = - ComponentsListQuery.componentsList[params.category] + const [category] = params.category.split('-') + const shouldShowAllComponents = category === 'all' + + const componentsListFromCategory = shouldShowAllComponents + ? Object.keys(ComponentsListQuery.componentsList).flatMap( + category => ComponentsListQuery.componentsList[category] + ) + : ComponentsListQuery.componentsList[category] return (
@@ -56,19 +62,28 @@ const ComponentsGrid: FC = ({ ComponentsListQuery }) => {

- {componentsListForCategory && - componentsListForCategory.map(component => ( -
- -
- ))} + {componentsListFromCategory && + componentsListFromCategory.map(component => { + const hasTitleAndDescription = !!( + component.appName && component.description + ) + + return ( + hasTitleAndDescription && ( +
+ +
+ ) + ) + })}
) diff --git a/react/package.json b/react/package.json index dae5534..e39e251 100644 --- a/react/package.json +++ b/react/package.json @@ -36,8 +36,8 @@ "react-dom": "^16.8.6", "react-intl": "^2.9.0", "typescript": "3.5.2", - "vtex.render-runtime": "http://vtex.vteximg.com.br/_v/public/typings/v1/vtex.render-runtime@8.45.3/public/_types/react", "vtex.docs-graphql": "http://vtex.vteximg.com.br/_v/public/typings/v1/vtex.docs-graphql@1.5.0/public/_types/react", + "vtex.render-runtime": "http://vtex.vteximg.com.br/_v/public/typings/v1/vtex.render-runtime@8.45.3/public/_types/react", "vtex.store-drawer": "http://vtex.vteximg.com.br/_v/public/typings/v1/vtex.store-drawer@0.1.0/public/_types/react", "vtex.styleguide": "http://vtex.vteximg.com.br/_v/public/typings/v1/vtex.styleguide@9.72.4/public/_types/react" } diff --git a/react/tsconfig.json b/react/tsconfig.json index 74d60ad..6428141 100644 --- a/react/tsconfig.json +++ b/react/tsconfig.json @@ -1,16 +1,10 @@ { "compilerOptions": { - "types": [ - "node", - "jest" - ], + "types": ["node", "jest"], "allowSyntheticDefaultImports": true, "resolveJsonModule": true, "jsx": "react", - "lib": [ - "es2017", - "dom" - ], + "lib": ["es2019", "dom"], "module": "es6", "moduleResolution": "node", "sourceMap": true, @@ -21,12 +15,6 @@ "typeAcquisition": { "enable": false }, - "include": [ - "./**/*.tsx", - "./typings", - "./typings.d.ts" - ], - "exclude": [ - "node_modules" - ] + "include": ["./**/*.tsx", "./typings", "./typings.d.ts"], + "exclude": ["node_modules"] }