-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add technology tags to documentation
- Loading branch information
1 parent
7504e8c
commit c5b793f
Showing
51 changed files
with
304 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import React from 'react'; | ||
import { Tag } from 'hds-react'; | ||
import PropTypes from 'prop-types'; | ||
import componentData from '../data/components.json'; | ||
|
||
const tagStyles = { | ||
core: { label: 'Core', theme: { '--background-color': 'var(--color-copper-medium-light)' } }, | ||
react: { label: 'React', theme: { '--background-color': 'var(--color-fog-medium-light)' } }, | ||
js: { label: 'Vanilla JS', theme: { '--background-color': 'var(--color-engel)' } }, | ||
}; | ||
|
||
export const TechTags = ({ componentName, withoutHeading }) => { | ||
const componentTags = componentData.find((item) => item.name === componentName)?.tags; | ||
|
||
return ( | ||
<> | ||
{!withoutHeading && <h4 className="heading-s">Available technologies</h4>} | ||
{componentTags && ( | ||
<div style={{ display: 'flex', gap: 'var(--spacing-2-xs)' }}> | ||
{componentTags.map( | ||
(tag) => | ||
tagStyles?.[tag] && ( | ||
<Tag key={tag} theme={tagStyles[tag]?.theme}> | ||
{tagStyles[tag]?.label} | ||
</Tag> | ||
), | ||
)} | ||
</div> | ||
)} | ||
</> | ||
); | ||
}; | ||
|
||
TechTags.propTypes = { | ||
componentName: PropTypes.string.isRequired, | ||
withoutHeading: PropTypes.bool, | ||
}; | ||
|
||
export default TechTags; |
Oops, something went wrong.