Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(component-index): design asset & framework #1542

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 31 additions & 4 deletions src/components/ComponentIndexPage/ComponentIndexList.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,34 @@
/* eslint-disable global-require */
/* eslint-disable import/no-dynamic-require */
/* eslint-disable no-undef */
import { Link, Row, Column, Tag, TooltipIcon } from 'carbon-components-react';
import PropTypes from 'prop-types';
import React from 'react';

const componentImg = require('./images/placeholderCompIndex.svg');

// TODO: Render icons dynamically based on framework & designAsset info.
const angularIcon = require('./images/Angular.svg');
const reactIcon = require('./images/React.svg');
const vanillaIcon = require('./images/Vanilla.svg');
const vueIcon = require('./images/Vue.svg');

const axureIcon = require('./images/Axure.svg');
const figmaIcon = require('./images/Figma.svg');
const sketchIcon = require('./images/Sketch.svg');
const xdIcon = require('./images/XD.svg');

const frameworkIcons = {
Angular: angularIcon,
React: reactIcon,
Vanilla: vanillaIcon,
Vue: vueIcon,
};

const designAssetIcons = {
Axure: axureIcon,
Figma: figmaIcon,
Sketch: sketchIcon,
XD: xdIcon,
};

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

Expand Down Expand Up @@ -59,14 +78,22 @@ function ComponentIndexList({ items }) {
<ul className="component-index-item__tags">
<li className="component-index-item__tag component-index-item__tag--framework">
<TooltipIcon direction="top" tooltipText={framework}>
<img src={reactIcon} alt={framework} />
<img
img
src={frameworkIcons[framework] || null}
alt={framework}
/>
</TooltipIcon>
</li>
<li className="component-index-item__tag component-index-item__tag--design-asset">
<TooltipIcon
direction="top"
tooltipText={designAsset}>
<img src={sketchIcon} alt={designAsset} />
<img
img
src={designAssetIcons[designAsset] || null}
alt={designAsset}
/>
</TooltipIcon>
</li>
<li className="component-index-item__tag component-index-item__tag--maintainer">
Expand Down
8 changes: 8 additions & 0 deletions src/components/ComponentIndexPage/images/Angular.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions src/components/ComponentIndexPage/images/Axure.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions src/components/ComponentIndexPage/images/Figma.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions src/components/ComponentIndexPage/images/Vanilla.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions src/components/ComponentIndexPage/images/Vue.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading