Skip to content

Commit

Permalink
feat(component-index): info links Website & Code (carbon-design-syste…
Browse files Browse the repository at this point in the history
…m#1553)

Co-authored-by: andrea.cardonaibm.com <andrea.cardonaibm.com>
  • Loading branch information
andreancardona authored and natashadecoste committed May 19, 2021
1 parent 2d5f12a commit 43b83df
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/components/ComponentIndexPage/ComponentIndexList.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,19 @@ const designAssetIcons = {
XD: xdIcon,
};

const href = '/get-started/about-carbon';

function ComponentIndexList({ items }) {
return (
<section aria-label="Component index">
{items.map(
({ name, description, maintainer, framework, designAsset }) => {
({
name,
description,
maintainer,
framework,
designAsset,
codeUrl,
websiteUrl,
}) => {
const key = `${name}:${maintainer}`;
return (
<Row key={key}>
Expand All @@ -63,14 +69,14 @@ function ComponentIndexList({ items }) {
<div className="component-index-item__links">
<Link
className="component-index-item__link"
href={href}
href={websiteUrl}
rel="noopener noreferrer">
Website
</Link>
<div className="component-index-item__divider" />
<Link
className="component-index-item__link"
href={href}
href={codeUrl}
rel="noopener noreferrer">
Code
</Link>
Expand Down
8 changes: 8 additions & 0 deletions src/components/ComponentIndexPage/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ const ALL_COMPONENTS_QUERY = graphql`
aliases
framework
design_asset
code_url
website_url
}
}
}
Expand All @@ -42,6 +44,8 @@ const searchOptions = {
'node.aliases',
'node.framework',
'node.design_asset',
'node.code_url',
'node.website_url',
],
};

Expand Down Expand Up @@ -118,13 +122,17 @@ function ComponentIndexPage() {
maintainer,
framework,
design_asset: designAsset,
code_url: codeUrl,
website_url: websiteUrl,
} = node;
return {
name,
description,
maintainer,
framework,
designAsset,
codeUrl,
websiteUrl,
};
})}
/>
Expand Down

0 comments on commit 43b83df

Please sign in to comment.