Skip to content

Commit

Permalink
fix(gatsby-admin): Move isOfficalPackage & GatsbyMonogram to own …
Browse files Browse the repository at this point in the history
…components (#27921)
  • Loading branch information
LekoArts committed Nov 9, 2020
1 parent e4fd0ad commit 3489672
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 2 deletions.
18 changes: 18 additions & 0 deletions packages/gatsby-admin/src/components/gatsby-monogram.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import React from "react"

function Monogram(): JSX.Element {
return (
<svg
fill="currentColor"
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 1200 1200"
focusable="false"
height="1em"
width="1em"
>
<path d="M600 0C268.6 0 0 268.6 0 600s268.6 600 600 600 600-268.6 600-600S931.4 0 600 0zM266.6 933.3C176.1 842.8 131 724.6 129.6 606L594 1070.4c-118.6-1.4-236.8-46.5-327.4-137.1zm437.7 126.1L140.6 495.7c47.5-210.1 235-367.1 459.4-367.1 156.9 0 295.5 77 381.2 194.9L915.6 379C845.8 279.5 730.5 214.3 600 214.3c-167.7 0-310.3 107.7-363.3 257.5l491.6 491.6c123.4-43.7 218-148.2 247.6-277.6H771.4V600h300c0 224.5-157 411.9-367.1 459.4z" />
</svg>
)
}

export default Monogram
4 changes: 2 additions & 2 deletions packages/gatsby-admin/src/pages/plugins.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ import Highlight, { defaultProps } from "prism-react-renderer"
import useNpmPackageData from "../utils/use-npm-data"
import prismThemeCss from "../prism-theme"
import gitHubIcon from "../github.svg"
import isOfficialPackage from "../../../../www/src/utils/is-official-package"
import GatsbyIcon from "../../../../www/src/components/gatsby-monogram"
import isOfficialPackage from "../utils/is-official-package"
import GatsbyIcon from "../components/gatsby-monogram"
import { useTelemetry } from "../utils/use-telemetry"

const markdownRenderers = {
Expand Down
13 changes: 13 additions & 0 deletions packages/gatsby-admin/src/utils/is-official-package.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// Checks whether the package from an Algolia NPM search hit is an official Gatsby package
export default function isOfficialPackage(pkg: Record<string, any>): boolean {
return (
pkg.repository &&
!pkg.name.startsWith(`@`) &&
// if the repo url is the Gatsby monorepo
(pkg.repository.url === `https://github.com/gatsbyjs/gatsby` ||
// or the repo url is a specific package in the monorepo
pkg.repository.url.startsWith(
`https://github.com/gatsbyjs/gatsby/tree/master/packages/`
))
)
}

0 comments on commit 3489672

Please sign in to comment.