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

feat(next-font): implemented next/font and refactor github button #3046

Closed
wants to merge 2 commits into from
Closed
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
47 changes: 23 additions & 24 deletions pages/_app.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import '../styles/globals.css';

import type { AppProps } from 'next/app';
import Head from 'next/head';
import React from 'react';

import AlgoliaSearch from '@/components/AlgoliaSearch';
Expand All @@ -13,6 +12,7 @@ import { MDXProvider } from '@/components/MDX/MDX';
import NavBar from '@/components/navigation/NavBar';
import StickyNavbar from '@/components/navigation/StickyNavbar';
import AppContext from '@/context/AppContext';
import { firaCode, firaMono, inter, workSans } from '@/utils/font';
import { defaultLanguage, defaultNamespace, I18nProvider, languages, namespaces } from '@/utils/i18n';
import loadLocales from '@/utils/locales';

Expand All @@ -29,30 +29,29 @@ function MyApp({ Component, pageProps, router }: AppProps) {
};

return (
<I18nProvider i18n={i18n}>
<AppContext.Provider value={{ path: router.asPath }}>
<Head>
<script async defer src='https://buttons.github.io/buttons.js'></script>
</Head>
<MDXProvider>
<AlgoliaSearch>
<div className='flex min-h-screen flex-col'>
<Banner />
<StickyNavbar>
<NavBar className='mx-auto block max-w-screen-xl px-4 sm:px-6 lg:px-8' />
</StickyNavbar>
<Layout>
<Component {...pageProps} />
<ScrollButton />
</Layout>
<div className='mt-auto'>
<Footer />
<div className={`${inter.variable} ${workSans.variable} ${firaCode.variable} ${firaMono.variable}`}>
<I18nProvider i18n={i18n}>
<AppContext.Provider value={{ path: router.asPath }}>
<MDXProvider>
<AlgoliaSearch>
<div className={'flex min-h-screen flex-col font-sans'}>
<Banner />
<StickyNavbar>
<NavBar className='mx-auto block max-w-screen-xl px-4 sm:px-6 lg:px-8' />
</StickyNavbar>
<Layout>
<Component {...pageProps} />
<ScrollButton />
</Layout>
<div className='mt-auto'>
<Footer />
</div>
</div>
</div>
</AlgoliaSearch>
</MDXProvider>
</AppContext.Provider>
</I18nProvider>
</AlgoliaSearch>
</MDXProvider>
</AppContext.Provider>
</I18nProvider>
</div>
);
}

Expand Down
12 changes: 2 additions & 10 deletions pages/_document.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import Document, { Head, Html, Main, NextScript } from 'next/document';
import Script from 'next/script';

class MyDocument extends Document {
static async getInitialProps(ctx: any) {
Expand All @@ -11,22 +12,13 @@ class MyDocument extends Document {
return (
<Html lang='en'>
<Head>
{/* Load Work Sans font */}
<link rel='preconnect' href='https://fonts.googleapis.com' />
<link rel='preconnect' href='https://fonts.gstatic.com' crossOrigin='anonymous' />
{/* eslint-disable-next-line max-len */}
<link
href='https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Work+Sans:wght@200;300;400;500;600;700;800;900&display=swap'
rel='stylesheet'
/>

{/* Icons */}
<link rel='icon' href='/favicon.ico' />
<link rel='icon' type='image/png' sizes='16x16' href='/favicon-16x16.png' />
<link rel='icon' type='image/png' sizes='32x32' href='/favicon-32x32.png' />
<link rel='icon' type='image/png' sizes='194x194' href='/favicon-194x194.png' />

<script async defer src='https://buttons.github.io/buttons.js'></script>
<Script src='https://buttons.github.io/buttons.js' strategy='afterInteractive' />
</Head>
<body>
<Main />
Expand Down
26 changes: 13 additions & 13 deletions styles/globals.css
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
@import url(https://cdn.jsdelivr.net/gh/tonsky/FiraCode@4/distr/fira_code.css);
@import url(https://cdn.jsdelivr.net/npm/@docsearch/css@3);

@import "swiper/css";
@import "swiper/css/a11y";
@import "swiper/css/navigation";
@import "swiper/css/pagination";
@import "swiper/css/scrollbar";
@import 'swiper/css';
@import 'swiper/css/a11y';
@import 'swiper/css/navigation';
@import 'swiper/css/pagination';
@import 'swiper/css/scrollbar';

@tailwind base;
@tailwind components;
Expand All @@ -19,7 +18,7 @@ body {
scroll-behavior: smooth;
}

li>p {
li > p {
display: inline;
}

Expand Down Expand Up @@ -51,11 +50,11 @@ abbr[title] {

@keyframes GradientAnimation {
0% {
background-position: 0% 50%
background-position: 0% 50%;
}

100% {
background-position: 200% 50%
background-position: 200% 50%;
}
}

Expand Down Expand Up @@ -110,7 +109,8 @@ abbr[title] {
padding: 0;
}

.DocSearch-Help > a:focus, .DocSearch-Help > a:hover {
.DocSearch-Help > a:focus,
.DocSearch-Help > a:hover {
outline: none;
text-decoration: underline;
}
Expand All @@ -130,8 +130,8 @@ abbr[title] {
}
}

@media (max-width: 767px){
.orbits{
@media (max-width: 767px) {
.orbits {
display: none;
}
}
Expand Down Expand Up @@ -338,6 +338,6 @@ abbr[title] {
color: white;
}

.meeting-card:hover > div:nth-child(2) > p {
.meeting-card:hover > div:nth-child(2) > p {
color: white;
}
8 changes: 4 additions & 4 deletions tailwind.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,10 @@ const config: Config = {
mapCover: 'url(\'/img/homepage/mapbase.webp\')'
},
fontFamily: {
sans: ['Inter', ...defaultTheme.fontFamily.sans],
heading: ['Work Sans', ...defaultTheme.fontFamily.sans],
body: ['Inter', ...defaultTheme.fontFamily.sans],
mono: ['Fira Code VF', 'Fira Code', ...defaultTheme.fontFamily.mono]
sans: ['var(--font-inter)', ...defaultTheme.fontFamily.sans],
heading: ['var(--font-work-sans)', ...defaultTheme.fontFamily.sans],
body: ['var(--font-inter)', ...defaultTheme.fontFamily.sans],
mono: ['var(--font-fira-code-mono)', 'var(--font-fira-code)', ...defaultTheme.fontFamily.mono]
},
minWidth: {
72: '18rem',
Expand Down
29 changes: 29 additions & 0 deletions utils/font.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { Fira_Code, Fira_Mono, Inter, Work_Sans } from 'next/font/google';

export const inter = Inter({
subsets: ['latin'],
display: 'swap',
weight: ['300', '400', '500', '600', '700'],
variable: '--font-inter'
});

export const workSans = Work_Sans({
subsets: ['latin'],
display: 'swap',
weight: ['100', '200', '300', '400', '500', '600', '700', '800', '900'],
variable: '--font-work-sans'
});

export const firaCode = Fira_Code({
subsets: ['latin'],
display: 'swap',
weight: ['300', '400', '500', '600', '700'],
variable: '--font-fira-code'
});

export const firaMono = Fira_Mono({
subsets: ['latin'],
display: 'swap',
weight: ['400', '500', '700'],
variable: '--font-fira-code-mono'
});
Loading