From be81e53a9540f6aacd7bab2486145ca817d8041e Mon Sep 17 00:00:00 2001 From: Marc-Aurele Besner <82244926+marc-aurele-besner@users.noreply.github.com> Date: Thu, 19 Dec 2024 15:07:13 -0500 Subject: [PATCH 1/3] add typography tailwind config --- explorer/tailwind.config.ts | 206 ++++++++++++++++++++++++++++++++++-- 1 file changed, 196 insertions(+), 10 deletions(-) diff --git a/explorer/tailwind.config.ts b/explorer/tailwind.config.ts index ce951594..03a754ff 100644 --- a/explorer/tailwind.config.ts +++ b/explorer/tailwind.config.ts @@ -1,5 +1,5 @@ import type { Config } from 'tailwindcss' -import defaultTheme from 'tailwindcss/defaultTheme' +import plugin from 'tailwindcss/plugin' const config: Config = { content: [ @@ -19,7 +19,6 @@ const config: Config = { light: 'linear-gradient(180deg, #EBEFFC 0%, #3654A6 100%)', }, colors: { - // Common Gradient // Gradients gradientFrom: '#032372', gradientVia: '#1949D2', @@ -79,16 +78,116 @@ const config: Config = { footerLight: '#032372', footerDark: '#08183E', }, - }, - fontFamily: { - montserrat: ['Montserrat'], - }, - theme: { + fontFamily: { - sans: ['Montserrat', ...defaultTheme.fontFamily.sans], + display: ['var(--font-roboto-serif)', 'serif'], + body: ['var(--font-libre-franklin)', 'sans-serif'], }, fontSize: { - xs: ['13px', '16px'], + 'display-lg': [ + '4.75rem', + { + lineHeight: '100%', + letterSpacing: '-0.04em', + fontWeight: '300', + }, + ], + 'display-md': [ + '3.75rem', + { + lineHeight: '100%', + letterSpacing: '-0.04em', + fontWeight: '300', + }, + ], + 'display-sm': [ + '3rem', + { + lineHeight: '100%', + letterSpacing: '-0.04em', + fontWeight: '300', + }, + ], + 'title-1': [ + '3.313rem', + { + lineHeight: '100%', + letterSpacing: '-0.02em', + fontWeight: '300', + }, + ], + 'title-2': [ + '2.938rem', + { + lineHeight: '120%', + letterSpacing: '-0.02em', + fontWeight: '300', + }, + ], + 'title-3': [ + '2.5rem', + { + lineHeight: '120%', + letterSpacing: '-0.02em', + fontWeight: '300', + }, + ], + 'body-lg': [ + '2rem', + { + lineHeight: '150%', + letterSpacing: '0.02em', + fontWeight: '400', + }, + ], + 'body-md': [ + '1.688rem', + { + lineHeight: '150%', + letterSpacing: '0.02em', + fontWeight: '400', + }, + ], + 'body-sm': [ + '1.313rem', + { + lineHeight: '150%', + letterSpacing: '0.02em', + fontWeight: '400', + }, + ], + 'button-lg': [ + '1.188rem', + { + lineHeight: '20px', + letterSpacing: '0', + fontWeight: '500', + }, + ], + 'button-md': [ + '1rem', + { + lineHeight: '20px', + letterSpacing: '0', + fontWeight: '500', + }, + ], + 'pre-title': [ + '1.188rem', + { + lineHeight: '150%', + letterSpacing: '0.02em', + fontWeight: '400', + }, + ], + detail: [ + '1.188rem', + { + lineHeight: '120%', + letterSpacing: '-0.02em', + fontWeight: '600', + }, + ], }, spacing: { 13: '3.125rem', @@ -100,7 +199,94 @@ const config: Config = { }, }, }, - plugins: [require('@headlessui/tailwindcss'), require('@tailwindcss/forms')], + plugins: [ + require('@headlessui/tailwindcss'), + require('@tailwindcss/forms'), + plugin(function ({ addBase }) { + addBase({ + 'h1.display-large': { + fontFamily: 'var(--font-roboto-serif), serif', + fontSize: '4.75rem', + lineHeight: '100%', + letterSpacing: '-0.04em', + fontWeight: '300', + }, + 'h1.display-medium': { + fontFamily: 'var(--font-roboto-serif), serif', + fontSize: '3.75rem', + lineHeight: '100%', + letterSpacing: '-0.04em', + fontWeight: '300', + }, + 'h2.display-small': { + fontFamily: 'var(--font-roboto-serif), serif', + fontSize: '3rem', + lineHeight: '100%', + letterSpacing: '-0.04em', + fontWeight: '300', + }, + h1: { + fontFamily: 'var(--font-roboto-serif), serif', + fontSize: '3.313rem', + lineHeight: '100%', + letterSpacing: '-0.02em', + fontWeight: '300', + }, + h2: { + fontFamily: 'var(--font-roboto-serif), serif', + fontSize: '2.938rem', + lineHeight: '120%', + letterSpacing: '-0.02em', + fontWeight: '300', + }, + h3: { + fontFamily: 'var(--font-roboto-serif), serif', + fontSize: '2.5rem', + lineHeight: '120%', + letterSpacing: '-0.02em', + fontWeight: '300', + }, + p: { + fontFamily: 'var(--font-libre-franklin), sans-serif', + fontSize: '1.313rem', + lineHeight: '150%', + letterSpacing: '0.02em', + fontWeight: '400', + }, + 'p.body-large': { + fontSize: '2rem', + }, + 'p.body-medium': { + fontSize: '1.688rem', + }, + button: { + fontFamily: 'var(--font-libre-franklin), sans-serif', + fontSize: '1rem', + lineHeight: '20px', + letterSpacing: '0', + fontWeight: '500', + }, + 'button.button-large': { + fontSize: '1.188rem', + }, + '.pre-title': { + fontFamily: 'var(--font-libre-franklin), sans-serif', + fontSize: '1.188rem', + lineHeight: '150%', + letterSpacing: '0.02em', + fontWeight: '400', + textTransform: 'uppercase', + }, + '.detail': { + fontFamily: 'var(--font-libre-franklin), sans-serif', + fontSize: '1.188rem', + lineHeight: '120%', + letterSpacing: '-0.02em', + fontWeight: '600', + }, + }) + }), + ], } export default config From 01f47a6856c1d39e61ae52a8da9706de6cf8fab3 Mon Sep 17 00:00:00 2001 From: Marc-Aurele Besner <82244926+marc-aurele-besner@users.noreply.github.com> Date: Thu, 19 Dec 2024 15:08:13 -0500 Subject: [PATCH 2/3] import font the next way --- explorer/src/app/[chain]/layout.tsx | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/explorer/src/app/[chain]/layout.tsx b/explorer/src/app/[chain]/layout.tsx index dd44078a..167c6a13 100644 --- a/explorer/src/app/[chain]/layout.tsx +++ b/explorer/src/app/[chain]/layout.tsx @@ -2,12 +2,25 @@ import { GoogleAnalytics } from '@next/third-parties/google' import { indexers, networks } from 'constants/indexers' import { lang, metadata } from 'constants/metadata' import { Metadata, Viewport } from 'next' +import { Libre_Franklin as LibreFranklin, Roboto_Serif as RobotoSerif } from 'next/font/google' import { headers } from 'next/headers' import { Provider } from 'providers' import { Toaster } from 'react-hot-toast' import type { ChainPageProps } from 'types/app' import '../../styles/index.css' +const robotoSerif = RobotoSerif({ + subsets: ['latin'], + weight: ['300'], + variable: '--font-roboto-serif', +}) + +const libreFranklin = LibreFranklin({ + subsets: ['latin'], + weight: ['400', '500', '600'], + variable: '--font-libre-franklin', +}) + export async function generateStaticParams() { return Array.from(networks).map((chain) => ({ chain })) } @@ -16,7 +29,7 @@ export default async function RootLayout({ children, }: ChainPageProps & { children: React.ReactNode }) { return ( - + {process.env.NEXT_PUBLIC_GOOGLE_ANALYTICS_ID && ( )} From 9cb95724a5c9715cc11ec604be16321a7adfed82 Mon Sep 17 00:00:00 2001 From: Marc-Aurele Besner <82244926+marc-aurele-besner@users.noreply.github.com> Date: Thu, 19 Dec 2024 15:08:32 -0500 Subject: [PATCH 3/3] remove hardcoded font class --- explorer/src/components/Consensus/Home/HomeInfoCard.tsx | 4 +--- explorer/src/components/Staking/RegisterOperators.tsx | 2 +- explorer/src/components/common/DesktopTable.tsx | 2 +- explorer/src/components/common/ListCard.tsx | 4 ++-- explorer/src/components/common/MobileCard.tsx | 2 +- explorer/src/components/common/OutOfSyncBanner.tsx | 2 +- explorer/src/components/layout/ConsensusHeader.tsx | 2 +- explorer/src/components/layout/Container.tsx | 2 +- explorer/src/components/layout/DomainHeader.tsx | 2 +- explorer/src/components/layout/EmptyHeader.tsx | 2 +- explorer/src/components/layout/FarmingHeader.tsx | 2 +- explorer/src/components/layout/Footer.tsx | 2 +- explorer/src/components/layout/Layout.tsx | 4 ++-- explorer/src/components/layout/LeaderboardHeader.tsx | 2 +- explorer/src/components/layout/StakingHeader.tsx | 2 +- explorer/src/components/layout/StorageHeader.tsx | 2 +- 16 files changed, 18 insertions(+), 20 deletions(-) diff --git a/explorer/src/components/Consensus/Home/HomeInfoCard.tsx b/explorer/src/components/Consensus/Home/HomeInfoCard.tsx index 852de94c..797970bc 100644 --- a/explorer/src/components/Consensus/Home/HomeInfoCard.tsx +++ b/explorer/src/components/Consensus/Home/HomeInfoCard.tsx @@ -25,9 +25,7 @@ export const HomeInfoCard: FC = ({ [value], ) return ( -
+
{icon}
diff --git a/explorer/src/components/Staking/RegisterOperators.tsx b/explorer/src/components/Staking/RegisterOperators.tsx index 2e16c51f..4e5cae92 100644 --- a/explorer/src/components/Staking/RegisterOperators.tsx +++ b/explorer/src/components/Staking/RegisterOperators.tsx @@ -151,7 +151,7 @@ export const RegisterOperators = () => { return (
-
+
diff --git a/explorer/src/components/common/DesktopTable.tsx b/explorer/src/components/common/DesktopTable.tsx index 5f6be6bb..0ee7a35b 100644 --- a/explorer/src/components/common/DesktopTable.tsx +++ b/explorer/src/components/common/DesktopTable.tsx @@ -9,7 +9,7 @@ interface TableProps { export const DesktopTable = ({ table, emptyMessage }: TableProps) => (
- +
{table.getHeaderGroups().map((headerGroup) => ( diff --git a/explorer/src/components/common/ListCard.tsx b/explorer/src/components/common/ListCard.tsx index 1a60a2d5..48582a98 100644 --- a/explorer/src/components/common/ListCard.tsx +++ b/explorer/src/components/common/ListCard.tsx @@ -12,7 +12,7 @@ export const ListCard = ({ table, emptyMessage }: ListCardProp table.getRowModel().rows.map((row, index) => (
{row.getVisibleCells().map((cell, index) => { const header = table.getHeaderGroups()[0].headers[index] @@ -32,7 +32,7 @@ export const ListCard = ({ table, emptyMessage }: ListCardProp
)) ) : ( -
+
{emptyMessage || 'No entries to show'} diff --git a/explorer/src/components/common/MobileCard.tsx b/explorer/src/components/common/MobileCard.tsx index cb202598..47816f09 100644 --- a/explorer/src/components/common/MobileCard.tsx +++ b/explorer/src/components/common/MobileCard.tsx @@ -14,7 +14,7 @@ type Row = { export const MobileCard: FC = ({ header, body, id, children }) => { return ( -
+
{header}
{body.map(({ name, value }, index) => ( diff --git a/explorer/src/components/common/OutOfSyncBanner.tsx b/explorer/src/components/common/OutOfSyncBanner.tsx index 803a076c..b8d358b5 100644 --- a/explorer/src/components/common/OutOfSyncBanner.tsx +++ b/explorer/src/components/common/OutOfSyncBanner.tsx @@ -15,7 +15,7 @@ const POLL_INTERVAL = 12000 const OutOfSyncBanner: FC = () => { const { network } = useIndexers() return ( -
+
diff --git a/explorer/src/components/layout/ConsensusHeader.tsx b/explorer/src/components/layout/ConsensusHeader.tsx index 97def115..aa61d8c7 100644 --- a/explorer/src/components/layout/ConsensusHeader.tsx +++ b/explorer/src/components/layout/ConsensusHeader.tsx @@ -23,7 +23,7 @@ export const ConsensusHeader: FC = () => { const menuList = useMemo(() => getSupportedHeaderLinks(network, Routes.consensus), [network]) return ( -
+
{isDesktop ? (
= ({ children }) => { return ( -
+
{children}
) diff --git a/explorer/src/components/layout/DomainHeader.tsx b/explorer/src/components/layout/DomainHeader.tsx index 9141fb0e..b42b07bf 100644 --- a/explorer/src/components/layout/DomainHeader.tsx +++ b/explorer/src/components/layout/DomainHeader.tsx @@ -32,7 +32,7 @@ export const DomainHeader = () => { ) return ( -
+
{isDesktop ? (
{ const { network } = useIndexers() return ( -
+
{isDesktop ? (
{ ) return ( -
+
{isDesktop ? (
{ return ( -
+
diff --git a/explorer/src/components/layout/Layout.tsx b/explorer/src/components/layout/Layout.tsx index 3f5945ec..d1bec1af 100644 --- a/explorer/src/components/layout/Layout.tsx +++ b/explorer/src/components/layout/Layout.tsx @@ -26,8 +26,8 @@ export const MainLayout: FC = ({ children, subHeader }) => { }, [pathname]) return ( -
-
+
+
{outOfSync} {subHeader} diff --git a/explorer/src/components/layout/LeaderboardHeader.tsx b/explorer/src/components/layout/LeaderboardHeader.tsx index dc3993c6..09ace0c0 100644 --- a/explorer/src/components/layout/LeaderboardHeader.tsx +++ b/explorer/src/components/layout/LeaderboardHeader.tsx @@ -23,7 +23,7 @@ export const LeaderboardHeader: FC = () => { const menuList = useMemo(() => getSupportedHeaderLinks(network, Routes.leaderboard), [network]) return ( -
+
{isDesktop ? (
{ const menuList = useMemo(() => getSupportedHeaderLinks(network, Routes.staking), [network]) return ( -
+
{isDesktop ? (
{ const menuList = useMemo(() => getSupportedHeaderLinks(network, Routes.storage), [network]) return ( -
+
{isDesktop ? (