From 66ad38b68d49d5985794e6c351a449ba01e94d0c Mon Sep 17 00:00:00 2001 From: rudouglas Date: Wed, 2 Jun 2021 11:43:45 +0100 Subject: [PATCH 1/6] feat: added Install component This includes an Install button and Dropdown button with list of options. These are just samples for now to showcase functionality --- src/components/InstallButton.js | 63 +++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 src/components/InstallButton.js diff --git a/src/components/InstallButton.js b/src/components/InstallButton.js new file mode 100644 index 000000000..93bc95ee7 --- /dev/null +++ b/src/components/InstallButton.js @@ -0,0 +1,63 @@ +import React from 'react'; +import PropTypes from 'prop-types'; +import { Button, Dropdown, Link } from '@newrelic/gatsby-theme-newrelic'; +import { css } from '@emotion/react'; + +const sampleItems = new Array(10).fill().map((_, i) => i + 1); + +const createMenuItems = (children, items) => { + const menuItems = []; + for (const item of items) { + menuItems.push({item}); + } + return menuItems; +}; + +const createInstallLink = () => { + return `https://one.newrelic.com/launcher/nr1-core.explorer`; +}; + +const InstallButton = ({ children, title, ...props }) => { + return ( +
+ + + + {createMenuItems(children, sampleItems)} + +
+ ); +}; + +InstallButton.propTypes = { + children: PropTypes.node, + title: PropTypes.string, + guid: PropTypes.string, +}; + +export default InstallButton; From 2b71cb9307eb6acf53c3fd1ee4a1943201d43e4f Mon Sep 17 00:00:00 2001 From: rudouglas Date: Wed, 2 Jun 2021 11:44:59 +0100 Subject: [PATCH 2/6] fix: adding title prop --- src/components/InstallButton.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/InstallButton.js b/src/components/InstallButton.js index 93bc95ee7..e4a722030 100644 --- a/src/components/InstallButton.js +++ b/src/components/InstallButton.js @@ -37,7 +37,7 @@ const InstallButton = ({ children, title, ...props }) => { margin-right: 2px; `} > - Install + {title} Date: Thu, 3 Jun 2021 21:45:17 +0100 Subject: [PATCH 3/6] Update src/components/InstallButton.js remove the children Co-authored-by: aswanson-nr <70179303+aswanson-nr@users.noreply.github.com> --- src/components/InstallButton.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/InstallButton.js b/src/components/InstallButton.js index e4a722030..a58532910 100644 --- a/src/components/InstallButton.js +++ b/src/components/InstallButton.js @@ -5,7 +5,7 @@ import { css } from '@emotion/react'; const sampleItems = new Array(10).fill().map((_, i) => i + 1); -const createMenuItems = (children, items) => { +const createMenuItems = (items) => items.map((i) => {i}) const menuItems = []; for (const item of items) { menuItems.push({item}); From af37d372abe5766a294131d5ada9bb30626ba4b3 Mon Sep 17 00:00:00 2001 From: rudouglas Date: Fri, 4 Jun 2021 00:06:37 +0100 Subject: [PATCH 4/6] fix: removed float and refactored creeateMenuItems --- src/components/InstallButton.js | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/components/InstallButton.js b/src/components/InstallButton.js index a58532910..9d5619cee 100644 --- a/src/components/InstallButton.js +++ b/src/components/InstallButton.js @@ -5,13 +5,8 @@ import { css } from '@emotion/react'; const sampleItems = new Array(10).fill().map((_, i) => i + 1); -const createMenuItems = (items) => items.map((i) => {i}) - const menuItems = []; - for (const item of items) { - menuItems.push({item}); - } - return menuItems; -}; +const createMenuItems = (items) => + items.map((item) => {item}); const createInstallLink = () => { return `https://one.newrelic.com/launcher/nr1-core.explorer`; @@ -23,7 +18,6 @@ const InstallButton = ({ children, title, ...props }) => { css={css` display: flex; flex-direction: row; - float: right; `} >