-
Notifications
You must be signed in to change notification settings - Fork 7
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 #614 from HHS/main
Add topics/reasons, filters, and activity reports table to TTA record page, update robots.txt for lower environments, Update Trussworks 2.0, lower export CSV limit
- Loading branch information
Showing
129 changed files
with
8,720 additions
and
2,613 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/bin/bash | ||
|
||
echo 'Setting site to be indexable in robots.txt' | ||
|
||
cat >frontend/public/robots.txt <<EOL | ||
# Welcome Robots | ||
User-agent: * | ||
Disallow: | ||
EOL |
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 |
---|---|---|
@@ -1,3 +1,6 @@ | ||
# we disallow everything by default | ||
# in production, we allow indexing by removing the slash from the disallow | ||
|
||
# https://www.robotstxt.org/robotstxt.html | ||
User-agent: * | ||
Disallow: | ||
Disallow: / |
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,122 @@ | ||
import React, { useState } from 'react'; | ||
import PropTypes from 'prop-types'; | ||
|
||
export const AccordionItem = ({ | ||
title, | ||
id, | ||
content, | ||
expanded, | ||
className, | ||
handleToggle, | ||
headingSize, | ||
}) => { | ||
const headingClasses = `usa-accordion__heading ${className}`; | ||
const contentClasses = `usa-accordion__content usa-prose ${className}`; | ||
const HeadingSizeTag = `h${headingSize}`; | ||
return ( | ||
<> | ||
<HeadingSizeTag className={headingClasses}> | ||
<button | ||
type="button" | ||
className="usa-accordion__button" | ||
aria-expanded={expanded} | ||
aria-controls={id} | ||
data-testid={`accordionButton_${id}`} | ||
onClick={handleToggle} | ||
> | ||
{title} | ||
</button> | ||
</HeadingSizeTag> | ||
<div | ||
id={id} | ||
data-testid={`accordionItem_${id}`} | ||
className={contentClasses} | ||
hidden={!expanded} | ||
> | ||
{content} | ||
</div> | ||
</> | ||
); | ||
}; | ||
|
||
AccordionItem.propTypes = { | ||
title: PropTypes.string.isRequired, | ||
content: PropTypes.string.isRequired, | ||
expanded: PropTypes.bool.isRequired, | ||
id: PropTypes.string.isRequired, | ||
className: PropTypes.string, | ||
handleToggle: PropTypes.func, | ||
headingSize: PropTypes.number.isRequired, | ||
}; | ||
|
||
AccordionItem.defaultProps = { | ||
className: '', | ||
handleToggle: () => { }, | ||
}; | ||
|
||
export const Accordion = ({ | ||
bordered, | ||
items, | ||
multiselectable, | ||
headingSize, | ||
}) => { | ||
const [openItems, setOpenState] = useState( | ||
items.filter((i) => !!i.expanded).map((i) => i.id), | ||
); | ||
|
||
const classes = bordered ? 'usa-accordion usa-accordion--bordered' : 'usa-accordion'; | ||
|
||
const toggleItem = (itemId) => { | ||
const newOpenItems = [...openItems]; | ||
const itemIndex = openItems.indexOf(itemId); | ||
const isMultiselectable = multiselectable; | ||
|
||
if (itemIndex > -1) { | ||
newOpenItems.splice(itemIndex, 1); | ||
} else if (isMultiselectable) { | ||
newOpenItems.push(itemId); | ||
} else { | ||
newOpenItems.splice(0, newOpenItems.length); | ||
newOpenItems.push(itemId); | ||
} | ||
setOpenState(newOpenItems); | ||
}; | ||
|
||
return ( | ||
<div | ||
className={classes} | ||
data-testid="accordion" | ||
aria-multiselectable={multiselectable || undefined} | ||
> | ||
{items.map((item) => ( | ||
<AccordionItem | ||
key={`accordionItem_${item.id}`} | ||
title={item.title} | ||
id={item.id} | ||
content={item.content} | ||
className={item.className} | ||
expanded={openItems.indexOf(item.id) > -1} | ||
handleToggle={() => { | ||
toggleItem(item.id); | ||
}} | ||
headingSize={headingSize} | ||
/> | ||
))} | ||
</div> | ||
); | ||
}; | ||
|
||
Accordion.propTypes = { | ||
bordered: PropTypes.bool, | ||
multiselectable: PropTypes.bool, | ||
items: PropTypes.arrayOf(PropTypes.shape(AccordionItem)).isRequired, | ||
headingSize: PropTypes.number, | ||
}; | ||
|
||
Accordion.defaultProps = { | ||
bordered: false, | ||
multiselectable: false, | ||
headingSize: 2, | ||
}; | ||
|
||
export default Accordion; |
47 changes: 47 additions & 0 deletions
47
frontend/src/components/ActivityReportsTable/ColumnHeader.js
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,47 @@ | ||
/* eslint-disable jsx-a11y/anchor-is-valid */ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
|
||
function ColumnHeader({ | ||
displayName, name, sortBy, sortDirection, onUpdateSort, | ||
}) { | ||
const getClassNamesFor = (n) => (sortBy === n ? sortDirection : ''); | ||
const sortClassName = getClassNamesFor(name); | ||
let fullAriaSort; | ||
switch (sortClassName) { | ||
case 'asc': | ||
fullAriaSort = 'ascending'; | ||
break; | ||
case 'desc': | ||
fullAriaSort = 'descending'; | ||
break; | ||
default: | ||
fullAriaSort = 'none'; | ||
break; | ||
} | ||
|
||
return ( | ||
<th scope="col" aria-sort={fullAriaSort}> | ||
<a | ||
role="button" | ||
tabIndex={0} | ||
onClick={() => onUpdateSort(name)} | ||
onKeyPress={() => onUpdateSort(name)} | ||
className={`sortable ${sortClassName}`} | ||
aria-label={`${displayName}. Activate to sort ${sortClassName === 'asc' ? 'descending' : 'ascending'}`} | ||
> | ||
{displayName} | ||
</a> | ||
</th> | ||
); | ||
} | ||
|
||
ColumnHeader.propTypes = { | ||
displayName: PropTypes.string.isRequired, | ||
name: PropTypes.string.isRequired, | ||
sortBy: PropTypes.string.isRequired, | ||
sortDirection: PropTypes.string.isRequired, | ||
onUpdateSort: PropTypes.func.isRequired, | ||
}; | ||
|
||
export default ColumnHeader; |
Oops, something went wrong.