Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

big package dependency updates for node 22 #298

Open
wants to merge 17 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix: remove unused copy functionality and improve TOC rendering
alasdairwilson committed Jan 24, 2025
commit 1d540212b6ef6dffba2ead1159f1f12bb8efa7f6
1 change: 1 addition & 0 deletions components/TableOfContents.tsx
Original file line number Diff line number Diff line change
@@ -117,6 +117,7 @@ const TableOfContents: React.FC<TableOfContentsProps> = ({ markdown, tocTitle }:
h4: () => null,
h5: () => null,
h6: () => null,
hr: () => null,
p: () => null,
ul: () => null,
ol: () => null,
11 changes: 1 addition & 10 deletions components/content/Heading.tsx
Original file line number Diff line number Diff line change
@@ -12,7 +12,6 @@ interface HeadingProps {

const Heading: React.FC<HeadingProps> = ({ content, section, tag, spanId }) => {
const Tag = tag as keyof React.JSX.IntrinsicElements
const [isCopied, setIsCopied] = useState(false)

const generateHeadingContent = () => {
if (typeof content === "string") {
@@ -46,23 +45,15 @@ const Heading: React.FC<HeadingProps> = ({ content, section, tag, spanId }) => {
return href + "#" + generateHeadingContent()
}

const onCopyHandler = () => {
setIsCopied(true)
setTimeout(() => {
setIsCopied(false)
}, 1500)
}

return (
<>
<Tag id={generateHeadingContent()} className="inline-flex items-center space-x-2">
<span id={spanId}>{content}</span>
<CopyToClipboard text={generateHeadingURL()}>
<button className="text-xs flex items-center space-x-1" onClick={onCopyHandler}>
<button className="text-xs flex items-center space-x-1">
<FaLink className="group-hover:text-white" />
</button>
</CopyToClipboard>
{isCopied && <span className="text-xs text-green-500 ml-3">Copied to clipboard!</span>}
</Tag>
</>
)
2 changes: 1 addition & 1 deletion components/ui/CopyToClipboard.tsx
Original file line number Diff line number Diff line change
@@ -22,10 +22,10 @@ const CopyToClipboard: React.FC<CopyToClipboardProps> = ({ text, onCopy, childre

return (
<div>
<span>{copied ? "Copied!" : ""}</span>
<div onClick={handleCopy} style={{ display: "inline-block", cursor: "pointer" }}>
{children}
</div>
{copied && <span className="text-xs text-green-500 ml-3">Copied to clipboard!</span>}
</div>
)
}