Browse Source

fix: better font formats

fix/enable-imgix
Thomas Osmonson 4 years ago
committed by Thomas Osmonson
parent
commit
f1e984a0e8
  1. BIN
      public/static/fonts/soehne-mono-web-buch.woff
  2. BIN
      public/static/fonts/soehne-mono-web-buch.woff2
  3. BIN
      public/static/fonts/soehne-web-buch.woff
  4. BIN
      public/static/fonts/soehne-web-buch.woff2
  5. BIN
      public/static/fonts/soehne-web-halbfett_1.woff
  6. BIN
      public/static/fonts/soehne-web-halbfett_1.woff2
  7. BIN
      public/static/fonts/soehne-web-kraftig_1.woff
  8. BIN
      public/static/fonts/soehne-web-kraftig_1.woff2
  9. 24
      src/components/custom-blocks/page-reference.tsx
  10. 7
      src/components/header.tsx
  11. 2
      src/components/mdx/overrides.tsx
  12. 4
      src/components/toc.tsx
  13. 12
      src/pages/_document.tsx

BIN
public/static/fonts/soehne-mono-web-buch.woff

Binary file not shown.

BIN
public/static/fonts/soehne-mono-web-buch.woff2

Binary file not shown.

BIN
public/static/fonts/soehne-web-buch.woff

Binary file not shown.

BIN
public/static/fonts/soehne-web-buch.woff2

Binary file not shown.

BIN
public/static/fonts/soehne-web-halbfett_1.woff

Binary file not shown.

BIN
public/static/fonts/soehne-web-halbfett_1.woff2

Binary file not shown.

BIN
public/static/fonts/soehne-web-kraftig_1.woff

Binary file not shown.

BIN
public/static/fonts/soehne-web-kraftig_1.woff2

Binary file not shown.

24
src/components/custom-blocks/page-reference.tsx

@ -15,8 +15,9 @@ const Image = ({
src, src,
isHovered, isHovered,
size, size,
alt,
...rest ...rest
}: BoxProps & { src?: string; isHovered?: boolean }) => ( }: BoxProps & { src?: string; isHovered?: boolean; alt?: string }) => (
<Box <Box
flexShrink={0} flexShrink={0}
style={{ style={{
@ -33,6 +34,7 @@ const Image = ({
width="100%" width="100%"
minWidth={size} minWidth={size}
size={size} size={size}
alt={alt}
mx="0 !important" mx="0 !important"
my="0 !important" my="0 !important"
/> />
@ -63,9 +65,22 @@ const Description = ({ children, ...props }) => (
</Text> </Text>
); );
const FloatingLink = ({ href, ...props }: any) => ( const FloatingLink = ({ href, contents, ...props }: any) => (
<Link href={href} passHref> <Link href={href} passHref>
<Box as="a" position="absolute" size="100%" left={0} top={0} /> <Box
as="a"
position="absolute"
size="100%"
opacity={0}
color="transparent"
style={{
userSelect: 'none',
}}
left={0}
top={0}
>
{contents}
</Box>
</Link> </Link>
); );
const InlineCard = ({ page }) => { const InlineCard = ({ page }) => {
@ -91,6 +106,7 @@ const InlineCard = ({ page }) => {
style={{ willChange: 'transform' }} style={{ willChange: 'transform' }}
size="64px" size="64px"
src={page?.images?.sm} src={page?.images?.sm}
alt={`Page image for: ${page.title || page.headings[0]}`}
/> />
</Box> </Box>
<Flex <Flex
@ -177,7 +193,7 @@ const GridItemDetails: React.FC<BoxProps & { isHovered?: boolean; page: any }> =
</Title> </Title>
<Description>{page.description}</Description> <Description>{page.description}</Description>
</Flex> </Flex>
<FloatingLink href={`${page.path}`} /> <FloatingLink href={`${page.path}`} contents={page.title || page.headings[0]} />
</> </>
) )
); );

7
src/components/header.tsx

@ -101,7 +101,12 @@ const NavItem: React.FC<FlexProps & { item: any }> = ({ item, ...props }) => {
}); });
return ( return (
<Flex justifyContent="center" position="relative" {...props} {...bind}> <Flex justifyContent="center" position="relative" {...props} {...bind}>
<HeaderTextItem as={item.href ? 'a' : 'span'} href={item.href}> <HeaderTextItem
as={item.href ? 'a' : 'span'}
href={item.href}
rel="nofollow noopener noreferrer"
target="_blank"
>
{item.label} {item.label}
</HeaderTextItem> </HeaderTextItem>

2
src/components/mdx/overrides.tsx

@ -8,7 +8,7 @@ const GlobalStyles = createGlobalStyle`
} }
* { * {
font-feature-settings: 'ss01' on; font-feature-settings: "onum" 1, "pnum" 1, "kern" 1, "ss01" 1;
} }
html, body { html, body {
font-family: 'Soehne', Inter, sans-serif; font-family: 'Soehne', Inter, sans-serif;

4
src/components/toc.tsx

@ -28,7 +28,7 @@ const Item = ({
slug: string; slug: string;
label: string; label: string;
level: number; level: number;
limit?: number; limit?: boolean;
}) => { }) => {
const { isActive: _isActive, slugInView } = useActiveHeading(slug); const { isActive: _isActive, slugInView } = useActiveHeading(slug);
const isOnScreen = slugInView === slug; const isOnScreen = slugInView === slug;
@ -73,7 +73,7 @@ export const TableOfContents = ({
}[]; }[];
noLabel?: boolean; noLabel?: boolean;
label?: string; label?: string;
limit?: number; limit?: boolean;
columns?: number | number[]; columns?: number | number[];
} & BoxProps) => { } & BoxProps) => {
return ( return (

12
src/pages/_document.tsx

@ -46,28 +46,32 @@ export default class MyDocument extends Document<DocumentProps> {
__html: ` __html: `
@font-face { @font-face {
font-family: 'Soehne Mono'; font-family: 'Soehne Mono';
src: url('/static/fonts/soehne-mono-web-buch.otf') format('opentype'); src: url('/static/fonts/soehne-mono-web-buch.woff2') format('woff2'),
url('/static/fonts/soehne-mono-web-buch.woff') format('woff');
font-weight: 400; font-weight: 400;
font-display: swap; font-display: swap;
font-style: normal; font-style: normal;
} }
@font-face { @font-face {
font-family: 'Soehne'; font-family: 'Soehne';
src: url('/static/fonts/soehne-web-buch.otf') format('opentype'); src: url('/static/fonts/soehne-web-buch.woff2') format('woff2'),
url('/static/fonts/soehne-web-buch.woff') format('woff');
font-weight: 400; font-weight: 400;
font-display: swap; font-display: swap;
font-style: normal; font-style: normal;
} }
@font-face { @font-face {
font-family: 'Soehne'; font-family: 'Soehne';
src: url('/static/fonts/soehne-web-kraftig_1.otf') format('opentype'); src: url('/static/fonts/soehne-web-kraftig_1.woff2') format('woff2'),
url('/static/fonts/soehne-web-kraftig_1.woff') format('woff');
font-weight: 500; font-weight: 500;
font-display: swap; font-display: swap;
font-style: normal; font-style: normal;
} }
@font-face { @font-face {
font-family: 'Soehne'; font-family: 'Soehne';
src: url('/static/fonts/soehne-web-halbfett_1.otf') format('opentype'); src: url('/static/fonts/soehne-web-halbfett_1.woff2') format('woff2'),
url('/static/fonts/soehne-web-halbfett_1.woff') format('woff');
font-weight: 600; font-weight: 600;
font-display: swap; font-display: swap;
font-style: normal; font-style: normal;

Loading…
Cancel
Save