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

Use next/font #21

Open
wants to merge 4 commits into
base: main
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
1 change: 0 additions & 1 deletion src/app/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
body {
color: var(--foreground);
background: var(--background);
font-family: "Inter", sans-serif;
}

@layer utilities {
Expand Down
17 changes: 9 additions & 8 deletions src/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,25 +1,26 @@
import type { Metadata } from "next";
import { Inter } from "next/font/google"
import "./globals.css";

export const metadata: Metadata = {
title: "Create Next App",
description: "Generated by create next app",
};

const inter = Inter({
subsets: ["latin"],
display: "optional",
variable: "--font-inter"
})

export default function RootLayout({
children,
}: Readonly<{
children: React.ReactNode;
}>) {
return (
<html lang="en">
<head>
<link
href="https://fonts.googleapis.com/css2?family=Inter&display=optional"
rel="stylesheet"
/>
</head>
<body>
<html lang="en" className={inter.variable}>
<body className="font-inter">
{children}
</body>
</html>
Expand Down
9 changes: 6 additions & 3 deletions src/app/templates/BlogPostTemplate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,22 @@ export interface PostProps {
image?: {
src: StaticImageData | string
alt: string
}
fill?: boolean
},
author: string
date: string
content: string
}

const Post: FC<PostProps> = ({ title, hook, image={src: "https://picsum.photos/1000/500", alt: "A randomly generated image from Lorem Picsum"}, author, date, content }) => {
const Post: FC<PostProps> = ({ title, hook, image={src: "https://picsum.photos/1000/500", alt: "A randomly generated image from Lorem Picsum", fill: true}, author, date, content }) => {
image.fill ??= true

return (
<>
<Navbar />
<main>
<div className="grid grid-cols-2 grid-rows-2 h-[50vh] w-[100vw] overflow-hidden relative gap-4">
<Image src={image.src} alt={image.alt} height={0} width={0} sizes="100vw" className="col-start-1 col-end-3 w-[100vw] h-auto" />
<Image src={image.src} alt={image.alt} height={0} width={0} sizes="100vw" className={`col-start-1 col-end-3 ${image.fill ? "w-[100vw]" : "w-auto"} ${!image.fill && "justify-self-center"} h-auto`} />
<div className="col-start-1 row-start-2 z-10 m-6 bg-[#BE8CFF] p-4 w-fit rounded-xl flex flex-col gap-3">
<h1 className="text-4xl text-text_secondary font-black">{title}</h1>
{hook && <p>{hook}</p>}
Expand Down
8 changes: 7 additions & 1 deletion src/app/templates/page.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
import Post, { PostProps } from "./BlogPostTemplate"
import onboardingLogo from "@/app/assets/onboarding_logo_rev_2.png"

const anArticle: PostProps = {
title: "Dotkom er best",
hook: "Men det visste jo alle fra før. I tilfelle du er appkommer eller bare dum, og ikke er enig, så forklarer denne artikkelen hvorfor!",
image: {
src: onboardingLogo,
alt: "Dotkom Onboaring 2024 sin logo",
fill: false
},
author: "Henry Græbserg",
date: "23/10/2024",
content: `The standard Lorem Ipsum passage, used since the 1500s
Expand All @@ -20,4 +26,4 @@ const Page = () => {
)
}

export default Page;
export default Page;
2 changes: 1 addition & 1 deletion tailwind.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const config: Config = {
accent: "#B432DB",
},
fontFamily: {
inter: ["Inter", "sans-serif"],
inter: ["var(--font-inter)", "sans-serif"],
},
},
},
Expand Down