Skip to content

Commit

Permalink
Merge pull request #792 from newrelic/develop
Browse files Browse the repository at this point in the history
Release
  • Loading branch information
jerelmiller authored Sep 26, 2020
2 parents 4d16ade + e098b2f commit 92e5602
Show file tree
Hide file tree
Showing 10 changed files with 4,096 additions and 3,883 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/fetch-related-content.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ jobs:
const result = await github.repos.updateBranchProtection({
owner: context.repo.owner,
repo: context.repo.repo,
branch: 'main',
branch: 'develop',
required_status_checks: null,
restrictions: null,
enforce_admins: null,
Expand All @@ -71,7 +71,7 @@ jobs:
uses: ad-m/[email protected]
with:
github_token: ${{ secrets.OPENSOURCE_BOT_TOKEN }}
branch: main
branch: develop

- name: Re-enable "required_pull_request_reviews" branch protection
id: enable-branch-protection
Expand All @@ -84,7 +84,7 @@ jobs:
const result = await github.repos.updateBranchProtection({
owner: context.repo.owner,
repo: context.repo.repo,
branch: 'main',
branch: 'develop',
required_status_checks: null,
restrictions: null,
enforce_admins: true,
Expand Down
13 changes: 6 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ name: Release
on:
push:
branches:
# todo: change this branch name
- main
- develop

env:
BOT_NAME: nr-opensource-bot
Expand Down Expand Up @@ -111,7 +110,7 @@ jobs:
const result = await github.repos.updateBranchProtection({
owner: context.repo.owner,
repo: context.repo.repo,
branch: 'main',
branch: 'develop',
required_status_checks: null,
restrictions: null,
enforce_admins: null,
Expand All @@ -124,7 +123,7 @@ jobs:
uses: ad-m/[email protected]
with:
github_token: ${{ secrets.OPENSOURCE_BOT_TOKEN }}
branch: main
branch: develop

- name: Re-enable "required_pull_request_reviews" branch protection
id: enable-branch-protection
Expand All @@ -137,7 +136,7 @@ jobs:
const result = await github.repos.updateBranchProtection({
owner: context.repo.owner,
repo: context.repo.repo,
branch: 'main',
branch: 'develop',
required_status_checks: null,
restrictions: null,
enforce_admins: true,
Expand Down Expand Up @@ -187,7 +186,7 @@ jobs:
const result = await github.repos.updateBranchProtection({
owner: context.repo.owner,
repo: context.repo.repo,
branch: 'main',
branch: 'develop',
required_status_checks: null,
restrictions: null,
enforce_admins: null,
Expand Down Expand Up @@ -217,7 +216,7 @@ jobs:
const result = await github.repos.updateBranchProtection({
owner: context.repo.owner,
repo: context.repo.repo,
branch: 'main',
branch: 'develop',
required_status_checks: null,
restrictions: null,
enforce_admins: true,
Expand Down
28 changes: 25 additions & 3 deletions package-lock.json

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

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"@mdx-js/react": "^1.6.16",
"@newrelic/gatsby-theme-newrelic": "^1.9.5",
"@splitsoftware/splitio-react": "^1.2.0",
"@xstate/react": "^1.0.0-rc.6",
"classnames": "^2.2.6",
"date-fns": "^2.16.1",
"eslint-plugin-react-hooks": "^4.1.0",
Expand Down Expand Up @@ -50,7 +51,8 @@
"react-shadow": "^18.3.0",
"react-simple-code-editor": "^0.11.0",
"use-dark-mode": "^2.3.1",
"use-media": "^1.4.0"
"use-media": "^1.4.0",
"xstate": "^4.13.0"
},
"devDependencies": {
"@newrelic/eslint-plugin-newrelic": "^0.3.0",
Expand Down
49 changes: 42 additions & 7 deletions src/components/MarketoForm/MarketoForm.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import React from 'react';
import PropTypes from 'prop-types';
import { css } from '@emotion/core';
import './marketo.scss';
import { navigate } from 'gatsby';
import useMarketoForm from '../../hooks/useMarketoForm';
import Spinner from '../Spinner';
import './marketo.scss';

const MarketoForm = ({
title,
Expand All @@ -11,9 +13,14 @@ const MarketoForm = ({
publishableKey,
redirectLink,
}) => {
const loaded = useMarketoForm(munchkinId, id, publishableKey, redirectLink);
const [, { state }] = useMarketoForm({
munchkinId,
id,
publishableKey,
onSubmit: () => navigate(redirectLink),
});

return loaded ? (
return (
<div
css={css`
position: relative;
Expand All @@ -28,19 +35,47 @@ const MarketoForm = ({
padding: 1.25rem;
`}
>
<p
<h4
css={css`
font-size: 1rem;
font-weight: bold;
text-align: center;
margin-bottom: 1rem;
`}
>
{title}
</p>
</h4>
<form id={`mktoForm_${id}`} />
{state.matches('blocked') && (
<Error>
Unable to load the form. Perhaps you have an ad blocker enabled?
</Error>
)}
{state.matches('error') && <Error>Unable to load the form.</Error>}
{state.matches('loading') && <Spinner />}
</div>
</div>
) : null;
);
};

const Error = ({ children }) => (
<div
css={css`
padding: 1rem;
border-radius: 0.25rem;
background: var(--color-red-100);
font-size: 0.875rem;
.dark-mode & {
background: var(--color-red-900);
}
`}
>
{children}
</div>
);

Error.propTypes = {
children: PropTypes.node,
};

MarketoForm.propTypes = {
Expand Down
Loading

0 comments on commit 92e5602

Please sign in to comment.