Skip to content

Commit

Permalink
fix(ButtonIframe): add global style to prevent body overflow-y issue (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
Betree authored Nov 29, 2024
1 parent 87acf58 commit 56f9885
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions pages/button.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
import React from 'react';
import PropTypes from 'prop-types';
import styled from 'styled-components';
import styled, { createGlobalStyle } from 'styled-components';

/**
* This circumvents an issue introduced with Tailwind where the body overflow-y is always set to
* 'scroll', which we want to avoid for this button page.
*/
const GlobalStyle = createGlobalStyle`
body {
overflow-y: hidden;
}
`;

const CollectButton = styled.div`
background-color: transparent;
Expand Down Expand Up @@ -47,9 +57,12 @@ class ButtonPage extends React.Component {
const { color = 'white', collectiveSlug, verb = 'donate' } = this.props;

return (
<a target="_blank" rel="noopener noreferrer" href={`https://opencollective.com/${collectiveSlug}/${verb}`}>
<CollectButton color={color} verb={verb} />
</a>
<React.Fragment>
<GlobalStyle />
<a target="_blank" rel="noopener noreferrer" href={`https://opencollective.com/${collectiveSlug}/${verb}`}>
<CollectButton color={color} verb={verb} />
</a>
</React.Fragment>
);
}
}
Expand Down

0 comments on commit 56f9885

Please sign in to comment.