-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #186 from fedspendingtransparency/ftr/10654-new_Se…
…ctionHeader_component Ftr/10654 new section header component
- Loading branch information
Showing
16 changed files
with
161 additions
and
126 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,11 +16,11 @@ Import our components like this: | |
import { Table } from 'data-transparency-ui'; | ||
``` | ||
|
||
To see our exported components, [see our type definition file.](https://github.com/fedspendingtransparency/data-transparency-ui/blob/master/index.d.ts). | ||
To see our exported components, [see our type definition file](https://github.com/fedspendingtransparency/data-transparency-ui/blob/master/index.d.ts). | ||
|
||
The purpose of this project is to give visibility into the patterns built into the | ||
[Broker](https://broker.usaspending.gov/) and [USASpending](https://usaspending.gov/) UI and their corresponding technical implementations. | ||
These implementations, referred to as UI Components, exist outside of the USASpending | ||
These implementations, referred to as UI Components, exist outside the USASpending | ||
and Broker codebase. | ||
|
||
With this visibility & independence, the following benefits arise: | ||
|
@@ -35,7 +35,7 @@ in a single place and then see those changes propagated throughout the website i | |
- It is advised that consumers of this project add `"preinstall": "npx [email protected]"` to the package.json of the project that uses this library. Users must also add the appropriate `"resolutions"` section to their package.json as well. Doing the aforementioned steps will help resolve any security vulnerabilities from `npm audit` | ||
## UI/UX & Development Collaboration Process | ||
|
||
The below info-graphic displays how the UI/UX and Development Teams will iteratively work together to identify new components for this library. | ||
The below infographic displays how the UI/UX and Development Teams will iteratively work together to identify new components for this library. | ||
|
||
<img src={infoGraphic} alt="Data Transparency USASpending.gov logo" /> | ||
|
||
|
@@ -73,8 +73,14 @@ To test components locally in the context it will be used either use `npm link`: | |
2. Change "main": "dist/index.js" in the package.json file to "main": "index.js" | ||
3. Run npm link | ||
4. Run npm link path/to/your/<consumer-context>/node_modules/react (example npm link ../<consumer-context>/node_modules/react; to integrate with usaspending.gov use `npm link ../usaspending-website/node_modules/react`) | ||
5. Navigate to the consumer context directory (ie. for usaspending.gov the consumer context directory is "usaspending-website") | ||
6. Run npm link data-transparency-ui | ||
5. Navigate to the consumer context directory (i.e. for usaspending.gov the consumer context directory is "usaspending-website") | ||
6. Run `npm link data-transparency-ui` | ||
7. NOTE: After work is finished with the linked consumer context, it will be necessary to then unlink this library by doing the following: | ||
1. Navigate to the consumer context directory again. | ||
2. Run `npm unlink --no-save data-transparency-ui` | ||
3. Navigate to the `data-transparency-ui/` root. | ||
4. Run npm unlink path/to/your/<consumer-context/node-modules/react (example npm unlink ../<consumer-context>/node_modules/react; to integrate with usaspending.gov use `npm unlink ../usaspending-website/node_modules/react`). | ||
5. As an additional precaution, delete & reinstall the node modules in the consumer context and clear the cache to ensure a clean consumer context. | ||
|
||
OR use `npm pack`: | ||
|
||
|
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,53 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import TooltipWrapper from './infoTooltip/TooltipWrapper'; | ||
|
||
function SectionHeader({ | ||
icon, title, overLine, description, titleTooltip, descTooltip | ||
}) { | ||
return ( | ||
<div className="usda-section-title__sectionHeader"> | ||
{icon && React.cloneElement(icon, { className: 'usda-section-title__title-icon' })} | ||
<div className="usda-section-title__header"> | ||
{overLine && <strong className="usda-section-title__overline">{overLine}</strong>} | ||
<div className="usda-section-title__title"> | ||
<h3> | ||
{title} | ||
</h3> | ||
{titleTooltip.component && ( | ||
<TooltipWrapper | ||
tooltipComponent={titleTooltip.component} | ||
icon="info" | ||
className={`${overLine ? 'has-overline' : ''}`} | ||
{...titleTooltip.props} /> | ||
)} | ||
</div> | ||
</div> | ||
{description && React.cloneElement(description, { className: 'usda-section-title__desc has-overline' })} | ||
{descTooltip.component && ( | ||
<TooltipWrapper | ||
tooltipComponent={descTooltip.component} | ||
icon="info" | ||
tooltipPosition="left" | ||
{...descTooltip.props} /> | ||
)} | ||
</div> | ||
); | ||
} | ||
|
||
SectionHeader.propTypes = { | ||
icon: PropTypes.element.isRequired, | ||
title: PropTypes.string.isRequired, | ||
overLine: PropTypes.string, | ||
description: PropTypes.element, | ||
titleTooltip: PropTypes.shape({ | ||
component: PropTypes.element, | ||
props: PropTypes.object | ||
}), | ||
descTooltip: PropTypes.shape({ | ||
component: PropTypes.element, | ||
props: PropTypes.object | ||
}) | ||
}; | ||
|
||
export default SectionHeader; |
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
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
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
Oops, something went wrong.