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

Create button component #6

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
31 changes: 31 additions & 0 deletions app/components/button.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import clsx from "clsx";

export default function Button({
text,
route,
variant,
icon,
}: {
text: string;
route: string;
variant: "primary" | "secondary" | "ghost";
icon: React.ElementType;
}) {
const Icon = icon;
return (
<a
href={route}
className={clsx(
"block max-w-max px-4 py-2 rounded-lg font-semibold",
"flex items-center gap-2",
"transition-opacity duration-200 hover:opacity-70",
variant === "primary" && "bg-brand text-gray-900",
variant === "secondary" && "bg-white text-gray-900",
variant === "ghost" && "text-white"
)}
>
{icon && <Icon className="w-4 h-4" />}
<span>{text}</span>
</a>
);
}
Binary file removed app/fonts/GeistMonoVF.woff
Binary file not shown.
Binary file removed app/fonts/GeistVF.woff
Binary file not shown.
24 changes: 0 additions & 24 deletions app/globals.css
Original file line number Diff line number Diff line change
@@ -1,27 +1,3 @@
@tailwind base;
@tailwind components;
@tailwind utilities;

:root {
--background: #ffffff;
--foreground: #171717;
}

@media (prefers-color-scheme: dark) {
:root {
--background: #0a0a0a;
--foreground: #ededed;
}
}

body {
color: var(--foreground);
background: var(--background);
font-family: Arial, Helvetica, sans-serif;
}

@layer utilities {
.text-balance {
text-wrap: balance;
}
}
18 changes: 1 addition & 17 deletions app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,6 @@
import type { Metadata } from "next";
import localFont from "next/font/local";
import "./globals.css";

const geistSans = localFont({
src: "./fonts/GeistVF.woff",
variable: "--font-geist-sans",
weight: "100 900",
});
const geistMono = localFont({
src: "./fonts/GeistMonoVF.woff",
variable: "--font-geist-mono",
weight: "100 900",
});

export const metadata: Metadata = {
title: "Create Next App",
description: "Generated by create next app",
Expand All @@ -25,11 +13,7 @@ export default function RootLayout({
}>) {
return (
<html lang="en">
<body
className={`${geistSans.variable} ${geistMono.variable} antialiased`}
>
{children}
</body>
<body className="antialiased">{children}</body>
</html>
);
}
116 changes: 22 additions & 94 deletions app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,101 +1,29 @@
import Image from "next/image";
import Button from "@/app/components/button";
import { EnvelopeIcon } from "@heroicons/react/20/solid";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LOOKS GREAT SO FAR - can we match the design a bit more by changing this to be the outline version of the icon, instead of solid?

Suggested change
import { EnvelopeIcon } from "@heroicons/react/20/solid";
import { EnvelopeIcon } from "@heroicons/react/20/outline";

if there was a specific reason for using solid icons tho, nw! just document why :-)


export default function Home() {
return (
<div className="grid grid-rows-[20px_1fr_20px] items-center justify-items-center min-h-screen p-8 pb-20 gap-16 sm:p-20 font-[family-name:var(--font-geist-sans)]">
<main className="flex flex-col gap-8 row-start-2 items-center sm:items-start">
<Image
className="dark:invert"
src="https://nextjs.org/icons/next.svg"
alt="Next.js logo"
width={180}
height={38}
priority
/>
<ol className="list-inside list-decimal text-sm text-center sm:text-left font-[family-name:var(--font-geist-mono)]">
<li className="mb-2">
Get started by editing{" "}
<code className="bg-black/[.05] dark:bg-white/[.06] px-1 py-0.5 rounded font-semibold">
app/page.tsx
</code>
.
</li>
<li>Save and see your changes instantly.</li>
</ol>
<div className="p-4 space-y-4 bg-black">
<Button
text="Email Us"
route="/testing"
variant="primary"
icon={EnvelopeIcon}
/>

<div className="flex gap-4 items-center flex-col sm:flex-row">
<a
className="rounded-full border border-solid border-transparent transition-colors flex items-center justify-center bg-foreground text-background gap-2 hover:bg-[#383838] dark:hover:bg-[#ccc] text-sm sm:text-base h-10 sm:h-12 px-4 sm:px-5"
href="https://vercel.com/new?utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"
target="_blank"
rel="noopener noreferrer"
>
<Image
className="dark:invert"
src="https://nextjs.org/icons/vercel.svg"
alt="Vercel logomark"
width={20}
height={20}
/>
Deploy now
</a>
<a
className="rounded-full border border-solid border-black/[.08] dark:border-white/[.145] transition-colors flex items-center justify-center hover:bg-[#f2f2f2] dark:hover:bg-[#1a1a1a] hover:border-transparent text-sm sm:text-base h-10 sm:h-12 px-4 sm:px-5 sm:min-w-44"
href="https://nextjs.org/docs?utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"
target="_blank"
rel="noopener noreferrer"
>
Read our docs
</a>
</div>
</main>
<footer className="row-start-3 flex gap-6 flex-wrap items-center justify-center">
<a
className="flex items-center gap-2 hover:underline hover:underline-offset-4"
href="https://nextjs.org/learn?utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"
target="_blank"
rel="noopener noreferrer"
>
<Image
aria-hidden
src="https://nextjs.org/icons/file.svg"
alt="File icon"
width={16}
height={16}
/>
Learn
</a>
<a
className="flex items-center gap-2 hover:underline hover:underline-offset-4"
href="https://vercel.com/templates?framework=next.js&utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"
target="_blank"
rel="noopener noreferrer"
>
<Image
aria-hidden
src="https://nextjs.org/icons/window.svg"
alt="Window icon"
width={16}
height={16}
/>
Examples
</a>
<a
className="flex items-center gap-2 hover:underline hover:underline-offset-4"
href="https://nextjs.org?utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"
target="_blank"
rel="noopener noreferrer"
>
<Image
aria-hidden
src="https://nextjs.org/icons/globe.svg"
alt="Globe icon"
width={16}
height={16}
/>
Go to nextjs.org →
</a>
</footer>
<Button
text="Email Us"
route="/testing"
variant="secondary"
icon={EnvelopeIcon}
/>

<Button
text="Email Us"
route="/testing"
variant="ghost"
icon={EnvelopeIcon}
/>
</div>
);
}
18 changes: 18 additions & 0 deletions package-lock.json

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

12 changes: 7 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,20 @@
"lint": "next lint"
},
"dependencies": {
"@heroicons/react": "^2.1.5",
"clsx": "^2.1.1",
"next": "14.2.12",
"react": "^18",
"react-dom": "^18",
"next": "14.2.12"
"react-dom": "^18"
},
"devDependencies": {
"typescript": "^5",
"@types/node": "^20",
"@types/react": "^18",
"@types/react-dom": "^18",
"eslint": "^8",
"eslint-config-next": "14.2.12",
"postcss": "^8",
"tailwindcss": "^3.4.1",
"eslint": "^8",
"eslint-config-next": "14.2.12"
"typescript": "^5"
}
}
6 changes: 3 additions & 3 deletions tailwind.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Config } from "tailwindcss";

import colors from "tailwindcss/colors";
const config: Config = {
content: [
"./pages/**/*.{js,ts,jsx,tsx,mdx}",
Expand All @@ -9,8 +9,8 @@ const config: Config = {
theme: {
extend: {
colors: {
background: "var(--background)",
foreground: "var(--foreground)",
gray: colors.slate,
brand: "#32C89E",
},
},
},
Expand Down