-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
996e4c5
commit 6129c9c
Showing
13 changed files
with
470 additions
and
153 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,12 @@ | ||
{ | ||
"typescript.tsdk": "node_modules/typescript/lib" | ||
"typescript.tsdk": "node_modules/typescript/lib", | ||
// This is the greatest improvement in your editing experience. | ||
// If your vscode isn't already formatting on save, you're missing out. | ||
"editor.formatOnSave": true, | ||
|
||
"tailwindCSS.experimental.classRegex": [ | ||
["clsx\\(([^)]*)\\)", "(?:'|\"|`)([^']*)(?:'|\"|`)"], | ||
["cn\\(([^)]*)\\)", "(?:'|\"|`)([^']*)(?:'|\"|`)"], | ||
["tw`([^`]*)"] | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import React, { ReactNode, useEffect } from "react"; | ||
import { SvgSprite } from "./svg-sprite"; | ||
|
||
export const Clipboardable: React.FC<{ | ||
children?: ReactNode; | ||
content: string; | ||
}> = ({ children, content }) => { | ||
const [copied, setCopied] = React.useState(false); | ||
// eslint-disable-next-line consistent-return | ||
useEffect(() => { | ||
if (copied) { | ||
const timer = setTimeout(() => { | ||
setCopied(false); | ||
}, 3000); | ||
return () => clearTimeout(timer); | ||
} | ||
}, [copied]); | ||
|
||
return ( | ||
<div className="relative"> | ||
<button | ||
type="button" | ||
className="absolute right-2 top-[0.75rem] w-7 aspect-square rounded-md flex justify-center items-center bg-slate-600" | ||
onClick={() => { | ||
navigator.clipboard.writeText(content); | ||
setCopied(true); | ||
}} | ||
> | ||
{copied ? ( | ||
<SvgSprite | ||
className="w-4 h-auto text-green-400" | ||
aria-hidden="true" | ||
name="check" | ||
/> | ||
) : ( | ||
<SvgSprite | ||
className="w-4 h-auto text-white" | ||
aria-hidden="true" | ||
name="copy" | ||
/> | ||
)} | ||
</button> | ||
{children} | ||
</div> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { cn, tw } from "../utils/tailwind"; | ||
import { SvgSprite } from "./svg-sprite"; | ||
|
||
const className = cn( | ||
tw`bg-black text-sm font-bold text-white fixed top-0 right-0 p-2 z-50 w-[16rem] flex no-underline leading-normal justify-center rotate-45 transform translate-x-1/4 translate-y-full`, | ||
tw`hover:bg-gray-900 hover:text-white hover:scale-110 transition-transform`, | ||
); | ||
|
||
export const Ribbon = () => { | ||
return ( | ||
<a | ||
href="https://github.com/peerigon/uberschrift/" | ||
className={className} | ||
aria-label="View source on GitHub" | ||
> | ||
<SvgSprite | ||
className="w-5 h-5 mr-3" | ||
aria-hidden="true" | ||
name="github" | ||
/> | ||
GitHub | ||
</a> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { SVGProps } from "react"; | ||
|
||
type Props = { | ||
name: string; | ||
}; | ||
|
||
export const SvgSprite: React.FC<Props & SVGProps<SVGSVGElement>> = ({ | ||
name, | ||
className, | ||
...props | ||
}) => { | ||
return ( | ||
<svg className={className} {...props}> | ||
<use href={`/sprite.svg#${name}`} /> | ||
</svg> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import clsx from "clsx"; | ||
|
||
export const tw = String.raw; | ||
|
||
export const cn = clsx; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,14 @@ | ||
/** @type {import('@remix-run/dev').AppConfig} */ | ||
|
||
export default { | ||
ignoredRouteFiles: ["**/.*"], | ||
serverDependenciesToBundle: [/@uberschrift\/.*/, "uberschrift"], | ||
mdx: async (filename) => { | ||
const [rehypeHighlight] = await Promise.all([ | ||
import("rehype-highlight").then((mod) => mod.default), | ||
]); | ||
return { | ||
rehypePlugins: [rehypeHighlight], | ||
}; | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,7 @@ | ||
import type { Config } from "tailwindcss"; | ||
import typography from "@tailwindcss/typography"; | ||
|
||
export default { | ||
content: ["./app/**/*.{js,jsx,ts,tsx}"], | ||
theme: { | ||
extend: {}, | ||
}, | ||
plugins: [], | ||
content: ["./app/**/*.{js,jsx,ts,tsx,mdx}"], | ||
plugins: [typography], | ||
} satisfies Config; |
Oops, something went wrong.