Skip to content

Commit 3489672

Browse files
authored
fix(gatsby-admin): Move isOfficalPackage & GatsbyMonogram to own components (#27921)
1 parent e4fd0ad commit 3489672

File tree

3 files changed

+33
-2
lines changed

3 files changed

+33
-2
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import React from "react"
2+
3+
function Monogram(): JSX.Element {
4+
return (
5+
<svg
6+
fill="currentColor"
7+
xmlns="http://www.w3.org/2000/svg"
8+
viewBox="0 0 1200 1200"
9+
focusable="false"
10+
height="1em"
11+
width="1em"
12+
>
13+
<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" />
14+
</svg>
15+
)
16+
}
17+
18+
export default Monogram

packages/gatsby-admin/src/pages/plugins.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ import Highlight, { defaultProps } from "prism-react-renderer"
2323
import useNpmPackageData from "../utils/use-npm-data"
2424
import prismThemeCss from "../prism-theme"
2525
import gitHubIcon from "../github.svg"
26-
import isOfficialPackage from "../../../../www/src/utils/is-official-package"
27-
import GatsbyIcon from "../../../../www/src/components/gatsby-monogram"
26+
import isOfficialPackage from "../utils/is-official-package"
27+
import GatsbyIcon from "../components/gatsby-monogram"
2828
import { useTelemetry } from "../utils/use-telemetry"
2929

3030
const markdownRenderers = {
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// Checks whether the package from an Algolia NPM search hit is an official Gatsby package
2+
export default function isOfficialPackage(pkg: Record<string, any>): boolean {
3+
return (
4+
pkg.repository &&
5+
!pkg.name.startsWith(`@`) &&
6+
// if the repo url is the Gatsby monorepo
7+
(pkg.repository.url === `https://github.com/gatsbyjs/gatsby` ||
8+
// or the repo url is a specific package in the monorepo
9+
pkg.repository.url.startsWith(
10+
`https://github.com/gatsbyjs/gatsby/tree/master/packages/`
11+
))
12+
)
13+
}

0 commit comments

Comments
 (0)