-
Notifications
You must be signed in to change notification settings - Fork 113
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
propagate changes to household charts.
- Loading branch information
Showing
4 changed files
with
159 additions
and
209 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
// This component enables the user to download or share the results generated by | ||
// PolicyEngine by showing the following sequence of buttons with appropriate | ||
// icons: | ||
// - Download the chart as a png file | ||
// - Download the data as a csv file | ||
// - Copy the link for the result | ||
// - Share the result on Twitter | ||
// - Share the result on Facebook | ||
// - Share the result on LinkedIn | ||
|
||
import style from "../style"; | ||
|
||
import { Button, Tooltip } from "antd"; | ||
import { | ||
TwitterOutlined, | ||
FacebookFilled, | ||
LinkedinFilled, | ||
LinkOutlined, | ||
FileImageOutlined, | ||
FileTextOutlined, | ||
} from "@ant-design/icons"; | ||
import React from "react"; | ||
|
||
export default function ResultActions(props) { | ||
const { copyLink, twitterLink, facebookLink, linkedInLink } = props; | ||
return ( | ||
<div | ||
style={{ | ||
display: "flex", | ||
flexDirection: "row", | ||
flexWrap: "wrap", | ||
backgroundColor: style.colors.WHITE, | ||
justifyContent: "center", | ||
alignItems: "center", | ||
paddingBottom: 40, | ||
gap: 5, | ||
}} | ||
> | ||
{props.downloadPng && ( | ||
<Tooltip title="Download the chart as a png file"> | ||
<Button | ||
type="text" | ||
icon={<FileImageOutlined style={{ fontSize: 20 }} />} | ||
onClick={props.downloadPng} | ||
/> | ||
</Tooltip> | ||
)} | ||
{props.downloadCsv && ( | ||
<Tooltip title="Download the data as a csv file"> | ||
<Button | ||
type="text" | ||
icon={<FileTextOutlined style={{ fontSize: 20 }} />} | ||
onClick={props.downloadCsv} | ||
/> | ||
</Tooltip> | ||
)} | ||
<Tooltip title="Copy the link for the result"> | ||
<Button | ||
type="text" | ||
icon={<LinkOutlined style={{ fontSize: 20 }} />} | ||
onClick={copyLink} | ||
/> | ||
</Tooltip> | ||
<Tooltip title="Share the result on Twitter"> | ||
<Button | ||
type="link" | ||
icon={<TwitterOutlined style={{ fontSize: 20 }} />} | ||
href={twitterLink} | ||
/> | ||
</Tooltip> | ||
<Tooltip title="Share the result on Facebook"> | ||
<Button | ||
type="link" | ||
icon={<FacebookFilled style={{ fontSize: 20 }} />} | ||
href={facebookLink} | ||
/> | ||
</Tooltip> | ||
<Tooltip title="Share the result on LinkedIn"> | ||
<Button | ||
type="link" | ||
size="small" | ||
icon={<LinkedinFilled style={{ fontSize: 20 }} />} | ||
href={linkedInLink} | ||
/> | ||
</Tooltip> | ||
</div> | ||
); | ||
} |
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.