Skip to content

Commit

Permalink
Merge branch 'main' into time-picker
Browse files Browse the repository at this point in the history
  • Loading branch information
amit-y committed Dec 19, 2023
2 parents 4dcb884 + 3d375e5 commit f4c3f7e
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 16 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- TimePicker component by [@amit-y](https://github.com/amit-y)

## [1.17.1] - 2023-12-18

- add option to enable title's tooltip + change up/down trend arrow colors to grey by [@shahramk](https://github.com/shahramk)

## [1.17.0] - 2023-12-14

### Added
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@newrelic/nr-labs-components",
"version": "1.17.0",
"version": "1.18.0",
"description": "New Relic Labs components",
"main": "dist/index.js",
"module": "dist/index.es.js",
Expand Down
1 change: 1 addition & 0 deletions src/components/simple-billboard/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ and the code snippet to use the component:
name: PropTypes.string, // required - metric name
style: PropTypes.object, // optional - SCSS class name for metric name
className: PropTypes.string, // optional - SCSS style for metric name
toolTip: PropTypes.bool // optional - enable tool tip for metric name (default: false)
}),
};
```
Expand Down
33 changes: 20 additions & 13 deletions src/components/simple-billboard/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import styles from './styles.scss';
/**
* @param {Object} metric - metric value, previousValue, optional: prefix, suffix, className, style
* @param {Object} statusTrend - optional: className, style
* @param {Object} title - metric name, optional: className, style
* @param {Object} title - metric name, optional: className, style, toolTip
* @return {JSX Object} - RENDERING name, value, up/down trend when previousValue present
*/
const SimpleBillboard = ({ metric, statusTrend = {}, title }) => {
Expand Down Expand Up @@ -58,20 +58,15 @@ const SimpleBillboard = ({ metric, statusTrend = {}, title }) => {
};
const icon =
difference > 0
? {
type: 'uparrow',
fill: '#02865B',
}
: {
type: 'downarrow',
fill: '#DF2D24',
};
? { type: 'uparrow', }
: { type: 'downarrow', };

return (
<svg
className={`${styles['metric-status']} ${statusTrend.className || ''}`}
style={{ ...statusTrend.style } || {}}
viewBox="0 0 16 16"
fill={icon.fill}
fill="#9EA5A9"
xmlns="http://www.w3.org/2000/svg"
focusable="false"
role="img"
Expand All @@ -83,7 +78,7 @@ const SimpleBillboard = ({ metric, statusTrend = {}, title }) => {
}, [difference]);

return (
<div className="simple-billboard">
<div className="simple-billboard">
<div
className={`${styles['metric-color']} ${styles['metric-value']} ${
metric.className || ''
Expand All @@ -94,7 +89,18 @@ const SimpleBillboard = ({ metric, statusTrend = {}, title }) => {
<span>{changeStatus}</span>
</div>

<Tooltip text={title.name}>
{title.toolTip ? (
<Tooltip text={title.name}>
<div
className={`${styles['metric-color']} ${styles['metric-name']} ${
title.className || ''
}`}
style={{ ...title.style } || {}}
>
{title.name}
</div>
</Tooltip>
) : (
<div
className={`${styles['metric-color']} ${styles['metric-name']} ${
title.className || ''
Expand All @@ -103,7 +109,7 @@ const SimpleBillboard = ({ metric, statusTrend = {}, title }) => {
>
{title.name}
</div>
</Tooltip>
)}
</div>
);
};
Expand All @@ -125,6 +131,7 @@ SimpleBillboard.propTypes = {
name: PropTypes.string,
style: PropTypes.object,
className: PropTypes.string,
toolTip: PropTypes.bool,
}),
};

Expand Down
Binary file modified src/components/simple-billboard/simple-billboard.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit f4c3f7e

Please sign in to comment.