Skip to content

Commit

Permalink
feat(app): add font (#381)
Browse files Browse the repository at this point in the history
* refactor(app): simplify ActiveNavigationLink props

* feat(app): add font

* feat(app): add default fonts

* feat(app): add latin-ext subset

* refactor(app): change font weight

* feat(app): change navigation font size
  • Loading branch information
AdiPol1359 authored Dec 6, 2022
1 parent a02777a commit 91d3628
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 10 deletions.
1 change: 1 addition & 0 deletions apps/app/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const nextConfig = {
appDir: true,
transpilePackages: [],
esmExternals: true,
fontLoaders: [{ loader: "@next/font/google", options: { subsets: ["latin", "latin-ext"] } }],
},
webpack(config) {
config.module.rules.push({
Expand Down
1 change: 1 addition & 0 deletions apps/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"build-storybook": "storybook build"
},
"dependencies": {
"@next/font": "13.0.6",
"next": "13.0.4",
"react": "18.2.0",
"react-dom": "18.2.0",
Expand Down
13 changes: 12 additions & 1 deletion apps/app/src/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,24 @@
import { Fira_Sans, Fira_Code } from "@next/font/google";
import { AnalyticsWrapper } from "../components/analytics";
import { CtaHeader } from "../components/CtaHeader";
import { Header } from "../components/Header/Header";
import { Footer } from "../components/Footer";

import "../styles/globals.css";

const firaSans = Fira_Sans({
weight: ["200", "400", "700"],
variable: "--font-fira-sans",
});

const firaCode = Fira_Code({
weight: "variable",
variable: "--font-fira-code",
});

export default function RootLayout({ children }: { children: React.ReactNode }) {
return (
<html lang="pl">
<html lang="pl" className={`${firaSans.variable} ${firaCode.variable}`}>
<body>
<Header />
<CtaHeader />
Expand Down
10 changes: 5 additions & 5 deletions apps/app/src/components/Header/ActiveNagivationLink.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import type { ComponentProps } from "react";
import type { ReactNode } from "react";
import { ActiveLink } from "../ActiveLink";

type ActiveNavigationLinkProps = Omit<
ComponentProps<typeof ActiveLink>,
"className" | "activeClassName"
>;
type ActiveNavigationLinkProps = Readonly<{
href: string;
children: ReactNode;
}>;

export const ActiveNavigationLink = (props: ActiveNavigationLinkProps) => (
<ActiveLink className="border-b border-transparent" activeClassName="border-white" {...props} />
Expand Down
2 changes: 1 addition & 1 deletion apps/app/src/components/Header/HeaderNavigation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const HeaderNavigation = ({ children }: { children: ReactNode }) => {
<nav
id="header-navigation"
className={twMerge(
"fixed top-0 left-0 z-10 h-full w-full flex-col items-center justify-center gap-5 bg-violet-600 uppercase",
"fixed top-0 left-0 z-10 h-full w-full flex-col items-center justify-center gap-5 bg-violet-600 text-sm uppercase",
"sm:relative sm:flex sm:h-fit sm:w-fit sm:flex-row",
isOpen ? "flex" : "hidden",
)}
Expand Down
6 changes: 6 additions & 0 deletions apps/app/tailwind.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
const defaultTheme = require("tailwindcss/defaultTheme");

const violet = {
50: "oklch(95.27% 0.017 295)",
100: "oklch(87.14% 0.047 295)",
Expand All @@ -24,6 +26,10 @@ module.exports = {
"yellow-branding-dark": "oklch(78.94% 0.16 80)",
violet,
},
fontFamily: {
sans: ["var(--font-fira-sans)", ...defaultTheme.fontFamily.sans],
mono: ["var(--font-fira-code)", ...defaultTheme.fontFamily.mono],
},
},
},
plugins: [],
Expand Down
12 changes: 9 additions & 3 deletions pnpm-lock.yaml

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

0 comments on commit 91d3628

Please # to comment.