Skip to content

Commit

Permalink
feat(component-index): 1555-component-index-filter-ui-functionality (c…
Browse files Browse the repository at this point in the history
…arbon-design-system#1584)

* feat(component-index): 1555-component-index-filter-ui-functionality

* all design updates done - except grid

* responsive breakpoints updated - need to fix left grid alignment

* feat(component-index): 1555-component-index-filter-ui-functionality - soft launch preview

* things working

* feat(component-index): all features should be working

* updated filter refactor

* feat(component-index): 1555-component-index-filter-ui-functionality - soft launch

* Update src/components/ComponentIndexPage/index.js

Co-authored-by: Josh Black <[email protected]>

* feat(component-index): redirect, and css updates

* feat(component-index): deleted components mdx file

* Update src/data/nav-items.yaml

Co-authored-by: jillianhowarth <[email protected]>

Co-authored-by: andrea.cardonaibm.com <andrea.cardonaibm.com>
Co-authored-by: Josh Black <[email protected]>
Co-authored-by: Vince Picone <[email protected]>
Co-authored-by: jillianhowarth <[email protected]>
  • Loading branch information
4 people authored and natashadecoste committed May 19, 2021
1 parent 78af8b7 commit 36ae2e8
Show file tree
Hide file tree
Showing 11 changed files with 274 additions and 165 deletions.
5 changes: 4 additions & 1 deletion conf.d/rewrite.conf
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,7 @@ rewrite /experimental/dashboard-widgets/(.*) https://pages.github.ibm.com/CDAI-d
rewrite /experimental/order-summary-template/(.*) https://pages.github.ibm.com/CDAI-design/CDAI-design-website/patterns/order-summary/\$1 permanent;

# Experimental -> community
rewrite /experimental/(.*) /community/patterns/\$1 permanent;
rewrite /experimental/(.*) /community/patterns/\$1 permanent;

# Community index
rewrite /community/components /community/component-index permanent;
125 changes: 60 additions & 65 deletions src/components/ComponentIndexPage/ComponentIndexListItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import figmaIcon from './images/Figma.svg';
import sketchIcon from './images/Sketch.svg';
import xdIcon from './images/XD.svg';

const href = '/get-started/about-carbon';
const frameworkIcons = {
Angular: angularIcon,
React: reactIcon,
Expand All @@ -51,7 +50,7 @@ const ComponentIndexListItem = React.memo(
name,
websiteUrl,
}) => {
let img = undefined;
let img;

if (image?.fluid) {
img = (
Expand All @@ -71,69 +70,65 @@ const ComponentIndexListItem = React.memo(
}

return (
<Row>
<Column sm={4} md={8} lg={9}>
<article className="component-index-item">
<div className="component-index-item__image bx--aspect-ratio bx--aspect-ratio--4x3">
{img}
</div>
<div className="component-index-item__content">
<header className="component-index-item__name">{name}</header>
<p className="component-index-item__description">{description}</p>
<footer className="component-index-item__info">
<div className="component-index-item__links">
<Link
className="component-index-item__link"
href={websiteUrl}
rel="noopener noreferrer">
Website
</Link>
{codeUrl && (
<>
<div className="component-index-item__divider" />
<Link
className="component-index-item__link"
href={codeUrl}
rel="noopener noreferrer">
Code
</Link>
</>
)}
</div>
<ul className="component-index-item__tags">
{framework && (
<li className="component-index-item__tag component-index-item__tag--framework">
<TooltipIcon direction="top" tooltipText={framework}>
<img
src={frameworkIcons[framework] || null}
alt={framework}
/>
</TooltipIcon>
</li>
)}
{designAsset && (
<li className="component-index-item__tag component-index-item__tag--design-asset">
<TooltipIcon direction="top" tooltipText={designAsset}>
<img
src={designAssetIcons[designAsset] || null}
alt={designAsset}
/>
</TooltipIcon>
</li>
)}
{maintainer && (
<li className="component-index-item__tag component-index-item__tag--maintainer">
<TooltipIcon direction="top" tooltipText="Maintainer">
<Tag>{maintainer}</Tag>
</TooltipIcon>
</li>
)}
</ul>
</footer>
</div>
</article>
</Column>
</Row>
<>
<article className="component-index-item">
<div className="component-index-item__image">{img}</div>
<div className="component-index-item__content">
<header className="component-index-item__name">{name}</header>
<p className="component-index-item__description">{description}</p>
<footer className="component-index-item__info">
<div className="component-index-item__links">
<Link
className="component-index-item__link"
href={websiteUrl}
rel="noopener noreferrer">
Website
</Link>
{codeUrl && (
<>
<div className="component-index-item__divider" />
<Link
className="component-index-item__link"
href={codeUrl}
rel="noopener noreferrer">
Code
</Link>
</>
)}
</div>
<ul className="component-index-item__tags">
{framework && (
<li className="component-index-item__tag component-index-item__tag--framework">
<TooltipIcon direction="top" tooltipText={framework}>
<img
src={frameworkIcons[framework] || null}
alt={framework}
/>
</TooltipIcon>
</li>
)}
{designAsset && (
<li className="component-index-item__tag component-index-item__tag--design-asset">
<TooltipIcon direction="top" tooltipText={designAsset}>
<img
src={designAssetIcons[designAsset] || null}
alt={designAsset}
/>
</TooltipIcon>
</li>
)}
{maintainer && (
<li className="component-index-item__tag component-index-item__tag--maintainer">
<TooltipIcon direction="top" tooltipText="Maintainer">
<Tag>{maintainer}</Tag>
</TooltipIcon>
</li>
)}
</ul>
</footer>
</div>
</article>
</>
);
}
);
Expand Down
16 changes: 12 additions & 4 deletions src/components/ComponentIndexPage/ComponentIndexNotFound.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,17 @@
* LICENSE file in the root directory of this source tree.
*/

import { Row, Column } from 'carbon-components-react';
import { Row, Column, Link } from 'carbon-components-react';
import React from 'react';

const coreComponentsLink = '/components/overview';

function ComponentIndexNotFound() {
return (
<div className="component-index-not-found">
<h2 className="component-index-not-found__title">No results found</h2>
<Row>
<Column sm={4} md={6} lg={6}>
<h2 className="component-index-not-found__title">No results found</h2>
<p className="component-index-not-found__text">
It appears we don’t have a communtiy component that matches your
search. Try different search terms.
Expand All @@ -24,8 +26,14 @@ function ComponentIndexNotFound() {
<Column sm={4} md={6} lg={6}>
<p className="component-index-not-found__text">
This community component index does not include the Carbon core
components and you may find what you’re looking for in the core
component list.
components and you may find what you're looking for in the
<Link
className="component-index-not-found__link"
href={coreComponentsLink}
rel="noopener noreferrer">
core component
</Link>
list.
</p>
</Column>
</Row>
Expand Down
22 changes: 9 additions & 13 deletions src/components/ComponentIndexPage/ComponentIndexSearch.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Search, Row, Column } from 'carbon-components-react';
import { Search } from 'carbon-components-react';
import PropTypes from 'prop-types';
import React from 'react';

Expand All @@ -9,18 +9,14 @@ function ComponentIndexSearch({ value, onChange }) {

return (
<div className="component-index-search">
<Row>
<Column sm={4} md={8} lg={9}>
<Search
light
id="component-index-search"
labelText="Search component index by name, keyword, or domain"
placeHolderText="Component name, keyword, domain"
value={value}
onChange={handleOnChange}
/>
</Column>
</Row>
<Search
light
id="component-index-search"
labelText="Search component index by name, keyword, or domain"
placeHolderText="Component name, keyword, domain"
value={value}
onChange={handleOnChange}
/>
</div>
);
}
Expand Down
34 changes: 16 additions & 18 deletions src/components/ComponentIndexPage/ComponentIndexSort.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,27 @@
* LICENSE file in the root directory of this source tree.
*/

import { Dropdown, Row, Column } from 'carbon-components-react';
import { Dropdown } from 'carbon-components-react';
import PropTypes from 'prop-types';
import React from 'react';

function ComponentIndexSort({ initialSortOption, options, onChange }) {
return (
<Row className="component-index-sort-container">
<Column sm={4} md={8} lg={9}>
<div className="component-index-sort">
<Dropdown
id="component-index-sort"
initialSelectedItem={initialSortOption}
items={options}
label="Sort"
light
onChange={({ selectedItem }) => {
onChange(selectedItem);
}}
type="inline"
/>
</div>
</Column>
</Row>
<div className="component-index-sort-container">
<div className="component-index-sort">
<Dropdown
id="component-index-sort"
initialSelectedItem={initialSortOption}
items={options}
label="Sort"
light
onChange={({ selectedItem }) => {
onChange(selectedItem);
}}
type="inline"
/>
</div>
</div>
);
}

Expand Down
Loading

0 comments on commit 36ae2e8

Please sign in to comment.