-
Notifications
You must be signed in to change notification settings - Fork 4
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 #974 from cityofaustin/add_links_to_dashboard
Add links to various Vision Zero resources to VZE dashboard
- Loading branch information
Showing
4 changed files
with
189 additions
and
11 deletions.
There are no files selected for viewing
Binary file added
BIN
+574 Bytes
atd-vze/src/assets/img/brand/power_bi_icon_white_on_transparent.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,124 @@ | ||
import React, { Component } from "react"; | ||
import PropTypes from "prop-types"; | ||
import { Card, CardBody, CardFooter } from "reactstrap"; | ||
import classNames from "classnames"; | ||
import { mapToCssModules } from "reactstrap/lib/utils"; | ||
|
||
const propTypes = { | ||
header: PropTypes.string, | ||
mainText: PropTypes.string, | ||
icon: PropTypes.string, | ||
raster_icon: PropTypes.string, | ||
raster_icon_alt: PropTypes.string, | ||
color: PropTypes.string, | ||
variant: PropTypes.string, | ||
footer: PropTypes.bool, | ||
link: PropTypes.string, | ||
target: PropTypes.string, | ||
children: PropTypes.node, | ||
className: PropTypes.string, | ||
cssModule: PropTypes.object, | ||
}; | ||
|
||
const defaultProps = { | ||
header: "$1,999.50", | ||
mainText: "Income", | ||
icon: "fa fa-cogs", | ||
raster_icon: null, | ||
raster_icon_alt: null, | ||
color: "primary", | ||
variant: "0", | ||
link: "#", | ||
target: "_new", | ||
}; | ||
|
||
class VZLinksWidget extends Component { | ||
render() { | ||
const { | ||
className, | ||
cssModule, | ||
header, | ||
mainText, | ||
icon, | ||
raster_icon, | ||
raster_icon_alt, | ||
color, | ||
footer, | ||
link, | ||
target, | ||
children, | ||
variant, | ||
...attributes | ||
} = this.props; | ||
|
||
// demo purposes only | ||
const padding = | ||
variant === "0" | ||
? { card: "p-3", icon: "p-3", lead: "mt-2" } | ||
: variant === "1" | ||
? { | ||
card: "p-0", | ||
icon: "p-4", | ||
lead: "pt-3", | ||
} | ||
: { card: "p-0", icon: "p-4 px-5", lead: "pt-3" }; | ||
|
||
const card = { style: "clearfix", color: color, icon: icon, raster_icon: raster_icon, raster_icon_alt: raster_icon_alt, classes: "" }; | ||
card.classes = mapToCssModules( | ||
classNames(className, card.style, padding.card), | ||
cssModule | ||
); | ||
|
||
const lead = { style: "h5 mb-0", color: color, classes: "" }; | ||
lead.classes = classNames(lead.style, "text-" + card.color, padding.lead); | ||
|
||
const blockIcon = function(icon, raster_icon) { | ||
const classes = classNames( | ||
raster_icon ? null : icon, | ||
"bg-" + card.color, | ||
padding.icon, | ||
raster_icon ? null : "font-2xl", | ||
"mr-3 float-left" | ||
); | ||
return <i className={classes}>{raster_icon ? <img src={raster_icon} alt={raster_icon_alt} /> : null}</i>; | ||
}; | ||
|
||
const cardFooter = function() { | ||
if (footer) { | ||
return ( | ||
<CardFooter className="px-3 py-2"> | ||
<a | ||
className="font-weight-bold font-xs btn-block text-muted" | ||
href={link} | ||
> | ||
View More | ||
<i className="fa fa-angle-right float-right font-lg"></i> | ||
</a> | ||
</CardFooter> | ||
); | ||
} | ||
}; | ||
|
||
return ( | ||
<Card> | ||
<CardBody className={card.classes} {...attributes}> | ||
{blockIcon(card.icon, card.raster_icon)} | ||
<div className={lead.classes}> | ||
<a target={target} href={link}> | ||
{header} | ||
</a> | ||
</div> | ||
<div className="text-muted text-uppercase font-weight-bold font-xs"> | ||
{mainText} | ||
</div> | ||
</CardBody> | ||
{cardFooter()} | ||
</Card> | ||
); | ||
} | ||
} | ||
|
||
VZLinksWidget.propTypes = propTypes; | ||
VZLinksWidget.defaultProps = defaultProps; | ||
|
||
export default VZLinksWidget; |
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