-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: show added and removed communities in history
- Loading branch information
Showing
14 changed files
with
258 additions
and
82 deletions.
There are no files selected for viewing
80 changes: 80 additions & 0 deletions
80
app/components/Analyst/CBC/History/CbcHistoryCommunitiesTable.tsx
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,80 @@ | ||
import styled from 'styled-components'; | ||
|
||
interface Props { | ||
heading: string; | ||
communities: any[]; | ||
} | ||
|
||
const StyledCommunitiesContainer = styled.div` | ||
display: flex; | ||
align-items: center; | ||
`; | ||
|
||
const StyledLeftContainer = styled.div` | ||
padding-right: 2%; | ||
width: 250px; | ||
`; | ||
|
||
const StyledTable = styled.table` | ||
th { | ||
border: none; | ||
} | ||
tbody > tr { | ||
border-bottom: thin dashed; | ||
border-color: ${(props) => props.theme.color.borderGrey}; | ||
td { | ||
width: 200px; | ||
max-width: 200px; | ||
border: none; | ||
} | ||
} | ||
`; | ||
|
||
const StyledIdCell = styled.td` | ||
width: 100px !important; | ||
max-width: 100px; | ||
`; | ||
|
||
const CbcHistoryCommunitiesTable: React.FC<Props> = ({ | ||
heading, | ||
communities, | ||
}) => { | ||
return ( | ||
<StyledCommunitiesContainer | ||
style={{ display: 'flex', alignItems: 'center' }} | ||
> | ||
<StyledLeftContainer>{heading}</StyledLeftContainer> | ||
<div> | ||
<StyledTable> | ||
<thead> | ||
<tr> | ||
<th>Economic Region</th> | ||
<th>Regional District</th> | ||
<th>Geographic Name</th> | ||
<th>Type</th> | ||
<th>ID</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
{communities?.map((community, index) => ( | ||
<tr | ||
// eslint-disable-next-line react/no-array-index-key | ||
key={`${community.bc_geographic_name}-${index}`} | ||
> | ||
<td>{community.economic_region}</td> | ||
<td>{community.regional_district}</td> | ||
<td>{community.bc_geographic_name}</td> | ||
<td>{community.geographic_type}</td> | ||
<StyledIdCell> | ||
{community.communities_source_data_id} | ||
</StyledIdCell> | ||
</tr> | ||
))} | ||
</tbody> | ||
</StyledTable> | ||
</div> | ||
</StyledCommunitiesContainer> | ||
); | ||
}; | ||
|
||
export default CbcHistoryCommunitiesTable; |
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
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.