-
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: enable detail panel with communities in all dashboard
- Loading branch information
Showing
3 changed files
with
186 additions
and
4 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
45 changes: 45 additions & 0 deletions
45
app/components/AnalystDashboard/AllDashboardDetailPanel.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,45 @@ | ||
import styled from 'styled-components'; | ||
|
||
interface Props { | ||
row: any; | ||
} | ||
|
||
const StyledMapLink = styled.a` | ||
color: ${(props) => props.theme.color.links}; | ||
text-decoration-line: underline; | ||
:hover { | ||
cursor: pointer; | ||
} | ||
`; | ||
|
||
const StyledSpan = styled.span` | ||
color: ${(props) => props.theme.color.darkGrey}; | ||
display: block; | ||
`; | ||
|
||
const AllDashboardDetailPanel: React.FC<Props> = ({ row }) => { | ||
const communities = (row.original.communities as any[]) || []; | ||
return ( | ||
<> | ||
<StyledSpan>Communities</StyledSpan> | ||
{communities.length > 0 ? ( | ||
communities.map((item, index) => ( | ||
<> | ||
<StyledMapLink | ||
href={item.mapLink} | ||
target="_blank" | ||
rel="noopener noreferrer" | ||
> | ||
{item.geoName} | ||
</StyledMapLink> | ||
{index < communities.length - 1 && ', '} | ||
</> | ||
)) | ||
) : ( | ||
<StyledSpan>N/A</StyledSpan> | ||
)} | ||
</> | ||
); | ||
}; | ||
|
||
export default AllDashboardDetailPanel; |
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