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

Add Heroicons #85

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from 4 commits
Commits
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
10 changes: 4 additions & 6 deletions app/components/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { cx } from "@/cx";
import { Select, SelectContent, SelectIcon, SelectOption, SelectTrigger } from "@/select";
import { isTheme, theme, useTheme } from "@/theme-provider";
import { WithStyleProps } from "@/types/with-style-props";
import { SunIcon } from "@heroicons/react/24/outline";
import { Link } from "@remix-run/react";
import { PropsWithChildren, useState } from "react";
import { NavLink } from "./nav-link";
Expand Down Expand Up @@ -59,12 +60,9 @@ export function Layout({ children, className, style }: Props) {
<div className="ml-auto">
{/* TODO: this should probably have a title/tooltip instead that describes what it is since we ain't got a spot for a label */}
<span className="sr-only">Theme Switcher</span>
<SelectTrigger className="w-min" hideIcon>
<SelectIcon className="text-gray-600">
<svg width="39" height="24" fill="currentColor">
<path d="M28 9h10l-5 6-5-6Z" />
<path d="M16.02 2.297a10.53 10.53 0 0 1 3.58 2.457A10.464 10.464 0 0 1 22.5 12c0 5.799-4.701 10.5-10.5 10.5-2.81 0-5.361-1.104-7.246-2.9A10.468 10.468 0 0 1 1.5 12a10.469 10.469 0 0 1 3.075-7.425A10.469 10.469 0 0 1 12 1.5c1.424 0 2.781.283 4.02.797ZM20.9 12a8.87 8.87 0 0 0-2.432-6.114L5.886 18.468A8.9 8.9 0 0 0 20.9 12Z" />
</svg>
<SelectTrigger className="w-min">
<SelectIcon>
<SunIcon className="w-6 h-6" />
</SelectIcon>
</SelectTrigger>
</div>
Expand Down
31 changes: 6 additions & 25 deletions app/routes/components.code-block.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
CodeBlockTitle,
} from "@/code-block";
import { code } from "@/code-block/code";
import { CommandLineIcon, DocumentTextIcon } from "@heroicons/react/20/solid";
import type { MetaFunction } from "@vercel/remix";
import { Example } from "~/components/example";

Expand Down Expand Up @@ -35,7 +36,7 @@ export default function Page() {
<Example className="mt-4">
<CodeBlock>
<CodeBlockHeader>
<FileIcon />
<DocumentTextIcon className="w-5 h-5" />
<CodeBlockTitle>ngrok-example.js</CodeBlockTitle>
</CodeBlockHeader>
<CodeBlockBody>
Expand Down Expand Up @@ -125,7 +126,7 @@ export default function Page() {
<Example className="mt-4">
<CodeBlock>
<CodeBlockHeader>
<CommandLineIcon />
<CommandLineIcon className="w-5 h-5" />
<CodeBlockTitle>Command Line</CodeBlockTitle>
</CodeBlockHeader>
<CodeBlockBody>
Expand All @@ -143,7 +144,7 @@ export default function Page() {
{code`
<CodeBlock>
<CodeBlockHeader>
<CommandLineIcon />
<CommandLineIcon className="w-5 h-5" />
<CodeBlockTitle>Command Line</CodeBlockTitle>
</CodeBlockHeader>
<CodeBlockBody>
Expand All @@ -168,7 +169,7 @@ export default function Page() {
<Example className="mt-4">
<CodeBlock>
<CodeBlockHeader>
<FileIcon />
<DocumentTextIcon className="w-5 h-5" />
<CodeBlockTitle>ngrok-example.js</CodeBlockTitle>
</CodeBlockHeader>
<CodeBlockBody>
Expand Down Expand Up @@ -203,7 +204,7 @@ export default function Page() {
{code`
<CodeBlock>
<CodeBlockHeader>
<FileIcon />
<DocumentTextIcon className="w-5 h-5" />
<CodeBlockTitle>ngrok-example.js</CodeBlockTitle>
</CodeBlockHeader>
<CodeBlockBody>
Expand Down Expand Up @@ -332,23 +333,3 @@ export default function Page() {
</div>
);
}

const CommandLineIcon = () => (
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" className="h-5 w-5">
<path
fillRule="evenodd"
d="M3.25 3A2.25 2.25 0 001 5.25v9.5A2.25 2.25 0 003.25 17h13.5A2.25 2.25 0 0019 14.75v-9.5A2.25 2.25 0 0016.75 3H3.25zm.943 8.752a.75.75 0 01.055-1.06L6.128 9l-1.88-1.693a.75.75 0 111.004-1.114l2.5 2.25a.75.75 0 010 1.114l-2.5 2.25a.75.75 0 01-1.06-.055zM9.75 10.25a.75.75 0 000 1.5h2.5a.75.75 0 000-1.5h-2.5z"
clipRule="evenodd"
/>
</svg>
);

const FileIcon = () => (
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" className="h-5 w-5">
<path
fillRule="evenodd"
d="M4.5 2A1.5 1.5 0 003 3.5v13A1.5 1.5 0 004.5 18h11a1.5 1.5 0 001.5-1.5V7.621a1.5 1.5 0 00-.44-1.06l-4.12-4.122A1.5 1.5 0 0011.378 2H4.5zm2.25 8.5a.75.75 0 000 1.5h6.5a.75.75 0 000-1.5h-6.5zm0 3a.75.75 0 000 1.5h6.5a.75.75 0 000-1.5h-6.5z"
clipRule="evenodd"
/>
</svg>
);
29 changes: 3 additions & 26 deletions components/code-block/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
import "prismjs/components/prism-bash.js";
import "prismjs/components/prism-jsx.js";
import "prismjs/components/prism-tsx.js";
import { CheckIcon, ChevronDownIcon } from "@heroicons/react/20/solid";
import { useCopyToClipboard } from "@uidotdev/usehooks";
import assert from "tiny-invariant";
import { cx } from "../cx";
Expand Down Expand Up @@ -236,7 +237,7 @@ const CodeBlockCopyButton = forwardRef<HTMLButtonElement, CodeBlockCopyButtonPro
{copied ? (
<>
Copied
<CheckIcon />
<CheckIcon className="w-5 h-5" />
</>
) : (
<CopyIcon />
Expand Down Expand Up @@ -281,7 +282,7 @@ const CodeBlockExpanderButton = forwardRef<HTMLButtonElement, CodeBlockExpanderB
}}
>
{isCodeExpanded ? "Show less" : "Show more"}{" "}
<ExpandIcon className={cx(isCodeExpanded && "rotate-180", "transition-all duration-150")} />
<ChevronDownIcon className={cx("w-5 h-5", isCodeExpanded && "rotate-180", "transition-all duration-150")} />
</button>
);
},
Expand All @@ -298,18 +299,6 @@ export {
CodeBlockTitle,
};

const ExpandIcon = ({ className, style }: WithStyleProps) => (
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 20 20"
fill="currentColor"
className={cx("relative top-px h-5 w-5 transition-transform", className)}
style={style}
>
<path d="M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.938a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z" />
</svg>
);

const CopyIcon = ({ className, style }: WithStyleProps) => (
<svg
xmlns="http://www.w3.org/2000/svg"
Expand All @@ -327,15 +316,3 @@ const CopyIcon = ({ className, style }: WithStyleProps) => (
/>
</svg>
);

const CheckIcon = ({ className, style }: WithStyleProps) => (
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 20 20"
fill="currentColor"
className={cx("h-5 w-5", className)}
style={style}
>
<path d="M16.704 4.153a.75.75 0 01.143 1.052l-8 10.5a.75.75 0 01-1.127.075l-4.5-4.5a.75.75 0 011.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 011.05-.143z" />
</svg>
);
6 changes: 3 additions & 3 deletions components/select/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { CaretSortIcon, CheckIcon } from "@radix-ui/react-icons";
import { CheckIcon, ChevronDownIcon } from "@heroicons/react/20/solid";
import {
Content,
Group,
Expand Down Expand Up @@ -41,7 +41,7 @@ const SelectTrigger = forwardRef<
{children}
{!hideIcon && (
<Icon asChild>
<CaretSortIcon className="h-4 w-4 opacity-50" />
<ChevronDownIcon className="w-5 h-5" />
</Icon>
)}
</Trigger>
Expand Down Expand Up @@ -96,7 +96,7 @@ const SelectOption = forwardRef<ElementRef<typeof Item>, ComponentPropsWithoutRe
>
<span className="absolute right-2 flex h-3.5 w-3.5 items-center justify-center">
<ItemIndicator>
<CheckIcon className="h-4 w-4" />
<CheckIcon className="w-5 h-5" />
</ItemIndicator>
</span>
<ItemText>{children}</ItemText>
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
"typecheck": "tsc --incremental --noEmit --skipLibCheck"
},
"dependencies": {
"@heroicons/react": "^2.0.18",
aaronshekey marked this conversation as resolved.
Show resolved Hide resolved
"@radix-ui/react-dialog": "1.0.5",
"@radix-ui/react-dropdown-menu": "2.0.6",
"@radix-ui/react-icons": "1.3.0",
Expand Down
11 changes: 11 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading