diff --git a/package-lock.json b/package-lock.json index 3b56dc0..c703000 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7,6 +7,7 @@ "": { "name": "react-github-permalink", "version": "1.10.3", + "license": "MIT", "dependencies": { "react-responsive": "^10.0.0", "react-syntax-highlighter": "^15.5.0" diff --git a/src/library/ErrorMessages/ErrorMessages.tsx b/src/library/ErrorMessages/ErrorMessages.tsx index 5261b43..036f171 100644 --- a/src/library/ErrorMessages/ErrorMessages.tsx +++ b/src/library/ErrorMessages/ErrorMessages.tsx @@ -2,40 +2,40 @@ import { ErrorResponses } from "../config/GithubPermalinkContext"; import { exhaustiveFailure } from "../utils/exhaustiveFailure"; export function ErrorMessages(props: { - data: ErrorResponses + data: ErrorResponses }) { - const data = props.data; - if(data.status === "404"){ - return <> -

- Github returned an HTTP status 404. Is this a private Github repo? -

- - } - - if(data.status ==="rate-limit"){ - return <> -

- You have encountered Github's unauthenticated API request rate limit. You can still visit the above link to see the code snippet. -

- - } - if(data.status === "unauthorized"){ - return <> -

- Unauthorized. Is your Github token valid? -

- - } - - if(data.status ==="other-error"){ - return <> -

- An unknown error occurred. -

- - } + const data = props.data; + if (data.status === "404") { + return <> +

+ Github returned an HTTP status 404. Is this a private Github repo? +

+ + } - return exhaustiveFailure(data); + if (data.status === "rate-limit") { + return <> +

+ You have encountered Github's unauthenticated API request rate limit. You can still visit the above link to see the code snippet. +

+ + } + if (data.status === "unauthorized") { + return <> +

+ Unauthorized. Is your Github token valid? +

+ + } + + if (data.status === "other-error") { + return <> +

+ An unknown error occurred. +

+ + } + + return exhaustiveFailure(data); } diff --git a/src/library/GithubPermalink/GithubPermlinkRsc.stories.tsx b/src/library/GithubPermalink/GithubPermlinkRsc.stories.tsx index 76a1db8..0bb0523 100644 --- a/src/library/GithubPermalink/GithubPermlinkRsc.stories.tsx +++ b/src/library/GithubPermalink/GithubPermlinkRsc.stories.tsx @@ -1,7 +1,7 @@ import { Meta, StoryObj } from '@storybook/react'; import { GithubPermalinkRsc } from './GithubPermalinkRsc'; -import { githubPermalinkRscConfig } from '../export'; +import { githubPermalinkRscConfig } from '../rsc'; import { defaultGetPermalinkFn } from '../config/defaultFunctions'; const meta = { @@ -24,7 +24,7 @@ export const Basic: Story = { export const LineExclusions: Story = { args: { permalink: "https://github.com/dwjohnston/react-github-permalink/blob/5b15aa07e60af4e317086f391b28cadf9aae8e1b/sample_files/sample1.go#L1-L5", - excludeLines: [[2,4]] + excludeLines: [[2, 4]] } } export const Erroring: Story = {