diff --git a/.changeset/good-knives-tan.md b/.changeset/good-knives-tan.md new file mode 100644 index 0000000..d61524f --- /dev/null +++ b/.changeset/good-knives-tan.md @@ -0,0 +1,5 @@ +--- +'pliny': patch +--- + +Use official giscus component which fixes styling issues diff --git a/.changeset/great-chairs-warn.md b/.changeset/great-chairs-warn.md new file mode 100644 index 0000000..4376f8c --- /dev/null +++ b/.changeset/great-chairs-warn.md @@ -0,0 +1,5 @@ +--- +'pliny': patch +--- + +Fix algolia styles diff --git a/.changeset/pre.json b/.changeset/pre.json index 4ac3605..8d5ca14 100644 --- a/.changeset/pre.json +++ b/.changeset/pre.json @@ -8,6 +8,8 @@ "changesets": [ "fuzzy-apples-judge", "giant-geckos-dress", + "good-knives-tan", + "great-chairs-warn", "metal-coats-grab", "mighty-garlics-appear", "neat-tables-occur", diff --git a/packages/pliny/CHANGELOG.md b/packages/pliny/CHANGELOG.md index eb522dd..59b6635 100644 --- a/packages/pliny/CHANGELOG.md +++ b/packages/pliny/CHANGELOG.md @@ -1,5 +1,12 @@ # pliny +## 0.1.0-beta.4 + +### Patch Changes + +- 44a6f19: Use official giscus component which fixes styling issues +- 3533d4f: Fix algolia styles + ## 0.1.0-beta.3 ### Patch Changes diff --git a/packages/pliny/package.json b/packages/pliny/package.json index 93cd24a..85b3b8a 100644 --- a/packages/pliny/package.json +++ b/packages/pliny/package.json @@ -2,7 +2,7 @@ "name": "pliny", "description": "Main entry point for pliny components", "homepage": "https://github.com/timlrx/pliny", - "version": "0.1.0-beta.3", + "version": "0.1.0-beta.4", "type": "module", "exports": { "./*": "./*", @@ -25,6 +25,7 @@ "author": "Timothy Lin (https://timlrx.com)", "dependencies": { "@docsearch/react": "^3.5.0", + "@giscus/react": "^2.3.0", "@mailchimp/mailchimp_marketing": "^3.0.80", "contentlayer": "^0.3.4", "copyfiles": "^2.4.1", diff --git a/packages/pliny/public/algolia.css b/packages/pliny/public/algolia.css index ec705b2..f592490 100644 --- a/packages/pliny/public/algolia.css +++ b/packages/pliny/public/algolia.css @@ -731,7 +731,6 @@ svg.DocSearch-Hit-Select-Icon { } /* Custom overrides to work with a primary tailwind css theme */ - .light .DocSearch { --docsearch-primary-color: theme(colors.primary.600); --docsearch-highlight-color: theme(colors.primary.600); @@ -756,7 +755,7 @@ svg.DocSearch-Hit-Select-Icon { --docsearch-primary-color: theme(colors.primary.600); --docsearch-highlight-color: theme(colors.primary.600); --docsearch-searchbox-shadow: inset 0 0 0 2px theme(colors.primary.600); - --docsearch-text-color: theme(colors.gray.200); + --docsearch-text-color: theme(colors.gray.300); --docsearch-muted-color: theme(colors.gray.400); --docsearch-container-background: theme(colors.gray.900 / 80%); /* Modal */ @@ -784,13 +783,9 @@ svg.DocSearch-Hit-Select-Icon { } .light .DocSearch-Input { - @apply hover: ring-0 ring-0; + box-shadow: 0 0 #0000; } .dark .DocSearch-Input { - @apply hover: ring-0 ring-0; -} - -.DocSearch-Container { - @apply backdrop-blur; + box-shadow: 0 0 #0000; } diff --git a/packages/pliny/src/comments/Giscus.tsx b/packages/pliny/src/comments/Giscus.tsx index b96ec39..0238bdd 100644 --- a/packages/pliny/src/comments/Giscus.tsx +++ b/packages/pliny/src/comments/Giscus.tsx @@ -1,5 +1,6 @@ -import { useEffect, useCallback } from 'react' import { useTheme } from 'next-themes' +import GiscusComponent from '@giscus/react' +import type { Mapping, BooleanString, InputPosition } from '@giscus/react' // TODO: type optional fields export interface GiscusConfig { @@ -8,14 +9,14 @@ export interface GiscusConfig { themeURL?: string theme?: string darkTheme?: string - mapping?: string - repo?: string - repositoryId?: string - category?: string - categoryId?: string - reactions?: string - metadata?: string - inputPosition?: string + mapping: Mapping + repo: string + repositoryId: string + category: string + categoryId: string + reactions: BooleanString + metadata: BooleanString + inputPosition?: InputPosition lang?: string } } @@ -46,35 +47,21 @@ export const Giscus = ({ const COMMENTS_ID = 'comments-container' - const LoadComments = useCallback(() => { - const script = document.createElement('script') - script.src = 'https://giscus.app/client.js' - script.setAttribute('data-repo', repo) - script.setAttribute('data-repo-id', repositoryId) - script.setAttribute('data-category', category) - script.setAttribute('data-category-id', categoryId) - script.setAttribute('data-mapping', mapping) - script.setAttribute('data-reactions-enabled', reactions) - script.setAttribute('data-emit-metadata', metadata) - script.setAttribute('data-input-position', inputPosition) - script.setAttribute('data-lang', lang) - script.setAttribute('data-theme', commentsTheme) - script.setAttribute('crossorigin', 'anonymous') - script.async = true - - const comments = document.getElementById(COMMENTS_ID) - if (comments) comments.appendChild(script) - - return () => { - const comments = document.getElementById(COMMENTS_ID) - if (comments) comments.innerHTML = '' - } - }, [commentsTheme]) - - // Reload on theme change - useEffect(() => { - LoadComments() - }, [LoadComments]) - - return
+ return ( + + ) } diff --git a/packages/pliny/src/search/Algolia.tsx b/packages/pliny/src/search/Algolia.tsx index 0eedc69..22064ff 100644 --- a/packages/pliny/src/search/Algolia.tsx +++ b/packages/pliny/src/search/Algolia.tsx @@ -107,7 +107,7 @@ export const AlgoliaSearchProvider: React.FC