Skip to content

Commit

Permalink
Merge pull request #178 from fedimint/fix-fonts
Browse files Browse the repository at this point in the history
fix: gateway fonts
  • Loading branch information
EthnTuttle authored Sep 8, 2023
2 parents 11a6161 + 4a653d5 commit 64aad55
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 5 deletions.
4 changes: 3 additions & 1 deletion apps/gateway-ui/src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import React from 'react';
import ReactDOM from 'react-dom/client';
import { SharedChakraProvider, theme, Fonts } from '@fedimint/ui';
import spaceGroteskTtf from '@fedimint/ui/assets/fonts/SpaceGrotesk-Variable.ttf';
import interTtf from '@fedimint/ui/assets/fonts/Inter-Variable.ttf';
import { App } from './App';
import { i18nProvider } from '@fedimint/utils';
import { languages } from './languages';
Expand All @@ -13,7 +15,7 @@ const root = ReactDOM.createRoot(

root.render(
<React.StrictMode>
<Fonts />
<Fonts spaceGroteskTtf={spaceGroteskTtf} interTtf={interTtf} />
<SharedChakraProvider theme={theme}>
<App />
</SharedChakraProvider>
Expand Down
6 changes: 6 additions & 0 deletions apps/gateway-ui/src/react-app-env.d.ts
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
/// <reference types="react-scripts" />

// Fonts are handled by react-scripts as well
declare module '*.ttf' {
const src: string;
export default src;
}
4 changes: 3 additions & 1 deletion apps/guardian-ui/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import React, { useMemo } from 'react';
import { Box, VStack, Spinner, Heading, Text, Center } from '@chakra-ui/react';
import { theme, Fonts, SharedChakraProvider, Wrapper } from '@fedimint/ui';
import spaceGroteskTtf from '@fedimint/ui/assets/fonts/SpaceGrotesk-Variable.ttf';
import interTtf from '@fedimint/ui/assets/fonts/Inter-Variable.ttf';
import { SetupContextProvider } from './setup/SetupContext';
import { AdminContextProvider } from './admin/AdminContext';
import { FederationSetup } from './setup/FederationSetup';
Expand Down Expand Up @@ -71,7 +73,7 @@ export const App = React.memo(function App() {

return (
<React.StrictMode>
<Fonts />
<Fonts spaceGroteskTtf={spaceGroteskTtf} interTtf={interTtf} />
<SharedChakraProvider theme={theme}>
<Center>
<Box width='100%'>{content}</Box>
Expand Down
6 changes: 6 additions & 0 deletions apps/guardian-ui/src/react-app-env.d.ts
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
/// <reference types='react-scripts' />

// Fonts are handled by react-scripts as well
declare module '*.ttf' {
const src: string;
export default src;
}
File renamed without changes.
11 changes: 8 additions & 3 deletions packages/ui/src/theme.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -374,23 +374,28 @@ export const theme = extendTheme(
withDefaultColorScheme({ colorScheme: 'gray', components: ['Table'] })
);

export const Fonts = () => (
interface FontsProps {
spaceGroteskTtf: string;
interTtf: string;
}

export const Fonts: React.FC<FontsProps> = ({ spaceGroteskTtf, interTtf }) => (
<Global
styles={`
@font-face {
font-family: ${SPACE_GROTESK};
font-style: normal;
font-weight: 300 700;
font-display: swap;
src: url('/fonts/SpaceGrotesk-Variable.ttf') format('truetype');
src: url(${spaceGroteskTtf}) format('truetype');
}
@font-face {
font-family: ${INTER};
font-style: normal;
font-weight: 100 900;
font-display: swap;
src: url('/fonts/Inter-Variable.ttf') format('truetype');
src: url(${interTtf}) format('truetype');
}
`}
/>
Expand Down

0 comments on commit 64aad55

Please sign in to comment.