mirror of https://github.com/MaxLeiter/Drift
				
				
				
			dep improvements, style fixes, next/link codemod
							parent
							
								
									0405f821c4
								
							
						
					
					
						commit
						0a5a2adb26
					
				@ -0,0 +1,4 @@
 | 
				
			|||||||
 | 
					{
 | 
				
			||||||
 | 
					  "typescript.tsdk": "./node_modules/typescript/lib",
 | 
				
			||||||
 | 
					  "typescript.enablePromptUseWorkspaceTsdk": true
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -1,17 +0,0 @@
 | 
				
			|||||||
import type { LinkProps } from "@geist-ui/core"
 | 
					 | 
				
			||||||
import { Link as GeistLink } from "@geist-ui/core"
 | 
					 | 
				
			||||||
import { useRouter } from "next/router"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
const Link = (props: LinkProps) => {
 | 
					 | 
				
			||||||
	const { basePath } = useRouter()
 | 
					 | 
				
			||||||
	const propHrefWithoutLeadingSlash =
 | 
					 | 
				
			||||||
		props.href && props.href.startsWith("/")
 | 
					 | 
				
			||||||
			? props.href.substring(1)
 | 
					 | 
				
			||||||
			: props.href
 | 
					 | 
				
			||||||
	const href = basePath
 | 
					 | 
				
			||||||
		? `${basePath}/${propHrefWithoutLeadingSlash}`
 | 
					 | 
				
			||||||
		: props.href
 | 
					 | 
				
			||||||
	return <GeistLink {...props} href={href} />
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
export default Link
 | 
					 | 
				
			||||||
@ -0,0 +1,26 @@
 | 
				
			|||||||
 | 
					import { useRouter } from "next/router"
 | 
				
			||||||
 | 
					import NextLink from "next/link"
 | 
				
			||||||
 | 
					import styles from "./link.module.css"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					type LinkProps = {
 | 
				
			||||||
 | 
						href: string,
 | 
				
			||||||
 | 
						colored?: boolean,
 | 
				
			||||||
 | 
						children: React.ReactNode
 | 
				
			||||||
 | 
					} & React.ComponentProps<typeof NextLink>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const Link = ({ href, colored, children, ...props }: LinkProps) => {
 | 
				
			||||||
 | 
						const { basePath } = useRouter()
 | 
				
			||||||
 | 
						const propHrefWithoutLeadingSlash =
 | 
				
			||||||
 | 
							href && href.startsWith("/") ? href.substring(1) : href
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						const url = basePath ? `${basePath}/${propHrefWithoutLeadingSlash}` : href
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						const className = colored ? `${styles.link} ${styles.color}` : styles.link
 | 
				
			||||||
 | 
						return (
 | 
				
			||||||
 | 
							<NextLink {...props} href={url} className={className}>
 | 
				
			||||||
 | 
								{children}
 | 
				
			||||||
 | 
							</NextLink>
 | 
				
			||||||
 | 
						)
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export default Link
 | 
				
			||||||
@ -0,0 +1,12 @@
 | 
				
			|||||||
 | 
					.link {
 | 
				
			||||||
 | 
					    text-decoration: none;
 | 
				
			||||||
 | 
					    color: var(--fg);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.color {
 | 
				
			||||||
 | 
					    color: var(--link);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.color:hover {
 | 
				
			||||||
 | 
					    text-decoration: underline;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -0,0 +1,17 @@
 | 
				
			|||||||
 | 
					import styles from "./note.module.css"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const Note = ({
 | 
				
			||||||
 | 
						type = "info",
 | 
				
			||||||
 | 
						children,
 | 
				
			||||||
 | 
						...props
 | 
				
			||||||
 | 
					}: {
 | 
				
			||||||
 | 
						type: "info" | "warning" | "error"
 | 
				
			||||||
 | 
						children: React.ReactNode
 | 
				
			||||||
 | 
					} & React.ComponentProps<"div">) => (
 | 
				
			||||||
 | 
						<div className={`${styles.note} ${styles[type]}`} {...props}>
 | 
				
			||||||
 | 
							<strong className={styles.type}>{type}:</strong>
 | 
				
			||||||
 | 
							{children}
 | 
				
			||||||
 | 
						</div>
 | 
				
			||||||
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export default Note
 | 
				
			||||||
@ -0,0 +1,27 @@
 | 
				
			|||||||
 | 
					.note {
 | 
				
			||||||
 | 
						font-size: 0.8em;
 | 
				
			||||||
 | 
						color: var(--fg);
 | 
				
			||||||
 | 
						margin: 0;
 | 
				
			||||||
 | 
						padding: var(--gap);
 | 
				
			||||||
 | 
						margin-top: 0.5em;
 | 
				
			||||||
 | 
						margin-bottom: 0.5em;
 | 
				
			||||||
 | 
						border-radius: var(--radius);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.info {
 | 
				
			||||||
 | 
						background: var(--gray);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.warning {
 | 
				
			||||||
 | 
						background: #f33;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.error {
 | 
				
			||||||
 | 
						background: red;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.type {
 | 
				
			||||||
 | 
						color: var(--fg);
 | 
				
			||||||
 | 
						margin-right: 0.5em;
 | 
				
			||||||
 | 
						text-transform: capitalize;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
											
												
													File diff suppressed because it is too large
													Load Diff
												
											
										
									
								@ -1,37 +1,61 @@
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
	"compilerOptions": {
 | 
					  "compilerOptions": {
 | 
				
			||||||
		"plugins": [{ "name": "typescript-plugin-css-modules" }],
 | 
					    "plugins": [
 | 
				
			||||||
		"target": "es2020",
 | 
					      {
 | 
				
			||||||
		"lib": ["dom", "dom.iterable", "esnext"],
 | 
					        "name": "typescript-plugin-css-modules"
 | 
				
			||||||
		"allowJs": true,
 | 
					      },
 | 
				
			||||||
		"skipLibCheck": true,
 | 
					      {
 | 
				
			||||||
		"strict": true,
 | 
					        "name": "next"
 | 
				
			||||||
		"forceConsistentCasingInFileNames": true,
 | 
					      }
 | 
				
			||||||
		"noImplicitAny": true,
 | 
					    ],
 | 
				
			||||||
		"strictNullChecks": true,
 | 
					    "target": "es2020",
 | 
				
			||||||
		"strictFunctionTypes": true,
 | 
					    "lib": [
 | 
				
			||||||
		"strictBindCallApply": true,
 | 
					      "dom",
 | 
				
			||||||
		"strictPropertyInitialization": true,
 | 
					      "dom.iterable",
 | 
				
			||||||
		"noImplicitThis": true,
 | 
					      "esnext"
 | 
				
			||||||
		"alwaysStrict": true,
 | 
					    ],
 | 
				
			||||||
		"noUnusedLocals": false,
 | 
					    "allowJs": true,
 | 
				
			||||||
		"noUnusedParameters": true,
 | 
					    "skipLibCheck": true,
 | 
				
			||||||
		"noEmit": true,
 | 
					    "strict": true,
 | 
				
			||||||
		"esModuleInterop": true,
 | 
					    "forceConsistentCasingInFileNames": true,
 | 
				
			||||||
		"module": "esnext",
 | 
					    "noImplicitAny": true,
 | 
				
			||||||
		"moduleResolution": "node",
 | 
					    "strictNullChecks": true,
 | 
				
			||||||
		"allowSyntheticDefaultImports": true,
 | 
					    "strictFunctionTypes": true,
 | 
				
			||||||
		"resolveJsonModule": true,
 | 
					    "strictBindCallApply": true,
 | 
				
			||||||
		"isolatedModules": true,
 | 
					    "strictPropertyInitialization": true,
 | 
				
			||||||
		"jsx": "preserve",
 | 
					    "noImplicitThis": true,
 | 
				
			||||||
		"incremental": true,
 | 
					    "alwaysStrict": true,
 | 
				
			||||||
		"baseUrl": ".",
 | 
					    "noUnusedLocals": false,
 | 
				
			||||||
		"paths": {
 | 
					    "noUnusedParameters": true,
 | 
				
			||||||
			"@components/*": ["components/*"],
 | 
					    "noEmit": true,
 | 
				
			||||||
			"@lib/*": ["lib/*"],
 | 
					    "esModuleInterop": true,
 | 
				
			||||||
			"@styles/*": ["styles/*"]
 | 
					    "module": "esnext",
 | 
				
			||||||
		}
 | 
					    "moduleResolution": "node",
 | 
				
			||||||
	},
 | 
					    "allowSyntheticDefaultImports": true,
 | 
				
			||||||
	"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
 | 
					    "resolveJsonModule": true,
 | 
				
			||||||
	"exclude": ["node_modules"]
 | 
					    "isolatedModules": true,
 | 
				
			||||||
 | 
					    "jsx": "preserve",
 | 
				
			||||||
 | 
					    "incremental": true,
 | 
				
			||||||
 | 
					    "baseUrl": ".",
 | 
				
			||||||
 | 
					    "paths": {
 | 
				
			||||||
 | 
					      "@components/*": [
 | 
				
			||||||
 | 
					        "components/*"
 | 
				
			||||||
 | 
					      ],
 | 
				
			||||||
 | 
					      "@lib/*": [
 | 
				
			||||||
 | 
					        "lib/*"
 | 
				
			||||||
 | 
					      ],
 | 
				
			||||||
 | 
					      "@styles/*": [
 | 
				
			||||||
 | 
					        "styles/*"
 | 
				
			||||||
 | 
					      ]
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  },
 | 
				
			||||||
 | 
					  "include": [
 | 
				
			||||||
 | 
					    "next-env.d.ts",
 | 
				
			||||||
 | 
					    "**/*.ts",
 | 
				
			||||||
 | 
					    "**/*.tsx",
 | 
				
			||||||
 | 
					    ".next/types/**/*.ts"
 | 
				
			||||||
 | 
					  ],
 | 
				
			||||||
 | 
					  "exclude": [
 | 
				
			||||||
 | 
					    "node_modules"
 | 
				
			||||||
 | 
					  ]
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
											
												
													File diff suppressed because it is too large
													Load Diff
												
											
										
									
								
					Loading…
					
					
				
		Reference in New Issue