Remove react-github-btn dependency

This commit is contained in:
Daniel Lautzenheiser 2022-09-30 12:15:21 -04:00
parent b7be7ed822
commit d39debb9d0
4 changed files with 5 additions and 41 deletions

View File

@ -37,7 +37,6 @@
"prismjs": "^1.21.0", "prismjs": "^1.21.0",
"react": "^17.0.1", "react": "^17.0.1",
"react-dom": "^17.0.1", "react-dom": "^17.0.1",
"react-github-btn": "^1.1.1",
"react-helmet": "^6.0.0", "react-helmet": "^6.0.0",
"react-markdown": "^6.0.0", "react-markdown": "^6.0.0",
"smooth-scroll": "^16.1.2" "smooth-scroll": "^16.1.2"

View File

@ -1,30 +1,14 @@
import React, { PureComponent } from 'react'; import React, { PureComponent } from 'react';
class GitHubStarButton extends PureComponent { class GitHubStarButton extends PureComponent {
async componentDidMount() {
const gitHubButtonModule = await import('github-buttons/dist/react');
this.GitHubButton = gitHubButtonModule.default;
this.forceUpdate();
}
render() { render() {
const GitHubButton = this.GitHubButton;
if (!GitHubButton) {
return null;
}
return ( return (
<GitHubButton <a
href="https://github.com/SimpleCMS/simple-cms" href="https://github.com/SimpleCMS/simple-cms"
data-icon="octicon-star"
data-show-count="true"
aria-label="Star SimpleCMS/simple-cms on GitHub" aria-label="Star SimpleCMS/simple-cms on GitHub"
> >
Star <img alt="Star SimpleCMS/simple-cms on GitHub" src="https://img.shields.io/github/stars/SimpleCMS/simple-cms?style=social" />
</GitHubButton> </a>
); );
} }
} }

View File

@ -2,8 +2,8 @@ import React, { useState, useEffect } from 'react';
import { Link, graphql, StaticQuery } from 'gatsby'; import { Link, graphql, StaticQuery } from 'gatsby';
import styled from '@emotion/styled'; import styled from '@emotion/styled';
import { css } from '@emotion/core'; import { css } from '@emotion/core';
import GitHubButton from 'react-github-btn';
import GitHubStarButton from './github-button';
import Container from './container'; import Container from './container';
import Notifications from './notifications'; import Notifications from './notifications';
import DocSearch from './docsearch'; import DocSearch from './docsearch';
@ -214,14 +214,7 @@ function Header({ hasHeroBelow }) {
margin-top: 8px; margin-top: 8px;
`} `}
> >
<GitHubButton <GitHubStarButton />
href="https://github.com/SimpleCMS/simple-cms"
data-icon="octicon-star"
data-show-count="true"
aria-label="Star SimpleCMS/simple-cms on GitHub"
>
Star
</GitHubButton>
</MenuItem> </MenuItem>
<MenuItem> <MenuItem>
<NavLink to="/docs/intro/">Docs</NavLink> <NavLink to="/docs/intro/">Docs</NavLink>

View File

@ -6064,11 +6064,6 @@ git-up@^4.0.5:
is-ssh "^1.3.0" is-ssh "^1.3.0"
parse-url "^6.0.0" parse-url "^6.0.0"
github-buttons@^2.21.1:
version "2.21.1"
resolved "https://registry.yarnpkg.com/github-buttons/-/github-buttons-2.21.1.tgz#9e55eb83b70c9149a21c235db2e971c53d4d98a2"
integrity sha512-n9bCQ8sj+5oX1YH5NeyWGbAclRDtHEhMBzqw2ctsWpdEHOwVgfruRu0VIVy01Ah10dd/iFajMHYU71L7IBWBOw==
github-from-package@0.0.0: github-from-package@0.0.0:
version "0.0.0" version "0.0.0"
resolved "https://registry.yarnpkg.com/github-from-package/-/github-from-package-0.0.0.tgz#97fb5d96bfde8973313f20e8288ef9a167fa64ce" resolved "https://registry.yarnpkg.com/github-from-package/-/github-from-package-0.0.0.tgz#97fb5d96bfde8973313f20e8288ef9a167fa64ce"
@ -10685,13 +10680,6 @@ react-frame-component@^5.2.1:
resolved "https://registry.yarnpkg.com/react-frame-component/-/react-frame-component-5.2.1.tgz#6bd5ec73ef7d720f57ee8f259546ed926a941267" resolved "https://registry.yarnpkg.com/react-frame-component/-/react-frame-component-5.2.1.tgz#6bd5ec73ef7d720f57ee8f259546ed926a941267"
integrity sha512-nrSh1OZuHlX69eWqJPiUkPT9S6/wxc4PpJV+vOQ4pHQQ8XmIsIT+utWT+nX32ZfANHZuKONA7JsWMUGT36CqaQ== integrity sha512-nrSh1OZuHlX69eWqJPiUkPT9S6/wxc4PpJV+vOQ4pHQQ8XmIsIT+utWT+nX32ZfANHZuKONA7JsWMUGT36CqaQ==
react-github-btn@^1.1.1:
version "1.2.2"
resolved "https://registry.yarnpkg.com/react-github-btn/-/react-github-btn-1.2.2.tgz#9aab2498ff311b9f9c448a2d2b902d0277037d5c"
integrity sha512-X4IcX2qwaLciSa4wcUsrFgF2PcT+ukMbZZRBT50ZvO2HJMyqQJNYNHErCN2R0sgZfSFQHUuUHlGndF15VQUhPA==
dependencies:
github-buttons "^2.21.1"
react-helmet@^6.0.0: react-helmet@^6.0.0:
version "6.1.0" version "6.1.0"
resolved "https://registry.yarnpkg.com/react-helmet/-/react-helmet-6.1.0.tgz#a750d5165cb13cf213e44747502652e794468726" resolved "https://registry.yarnpkg.com/react-helmet/-/react-helmet-6.1.0.tgz#a750d5165cb13cf213e44747502652e794468726"