Skip to content

Commit

Permalink
refactor fonts saas/app #156
Browse files Browse the repository at this point in the history
  • Loading branch information
tima101 committed Jun 1, 2021
1 parent 4b06a3a commit efeb327
Show file tree
Hide file tree
Showing 13 changed files with 47 additions and 31 deletions.
7 changes: 6 additions & 1 deletion saas/app/components/posts/PostContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,12 @@ class PostContent extends React.Component<Props> {

return (
<div
style={{ fontSize: '15px', lineHeight: '2em', font: '16px Roboto', wordBreak: 'break-all' }}
style={{
fontSize: '15px',
lineHeight: '2em',
fontFamily: 'Roboto, sans-serif',
wordBreak: 'break-all',
}}
dangerouslySetInnerHTML={{ __html: html }}
/>
);
Expand Down
2 changes: 1 addition & 1 deletion saas/app/components/posts/PostEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ class PostEditor extends React.Component<Props, State> {
border: 'none',
outline: 'none',
color: isThemeDark ? '#fff' : '#000',
font: '16px Roboto',
fontFamily: 'Roboto, sans-serif',
height: '100vh',
lineHeight: '1.5em',
backgroundColor: content ? textareaBackgroundColor : 'transparent',
Expand Down
4 changes: 2 additions & 2 deletions saas/app/lib/theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const themeDark = createMuiTheme({
},
},
typography: {
fontFamily: ['IBM Plex Mono', 'monospace', 'Roboto', 'sans-serif'].join(','),
fontFamily: ['IBM Plex Mono', 'monospace'].join(','),
button: {
textTransform: 'none',
},
Expand All @@ -29,7 +29,7 @@ const themeLight = createMuiTheme({
},
},
typography: {
fontFamily: ['IBM Plex Mono', 'monospace', 'Roboto', 'sans-serif'].join(','),
fontFamily: ['IBM Plex Mono', 'monospace'].join(','),
button: {
textTransform: 'none',
},
Expand Down
17 changes: 3 additions & 14 deletions saas/app/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -133,24 +133,13 @@ class MyApp extends App {

const isThemeDark = store.currentUser ? store.currentUser.darkTheme : true;

const isServer = typeof window === 'undefined';

return (
<ThemeProvider theme={isThemeDark ? themeDark : themeLight}>
<Head>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link
rel="prefetch"
href="https://d2c24pn6pcl4ug.cloudfront.net/fonts/IBM-Plex-Mono/IBMPlexMono-Regular.woff2"
as="font"
crossOrigin="anonymous"
type="font/woff2"
/>
<link
rel="prefetch"
href="https://d2c24pn6pcl4ug.cloudfront.net/fonts/IBM-Plex-Mono/IBMPlexMono-Bold.woff2"
as="font"
crossOrigin="anonymous"
type="font/woff2"
/>
<link rel="stylesheet" href={isServer ? '/fonts/server.css' : '/fonts/cdn.css'} />
<link
rel="stylesheet"
href={
Expand Down
13 changes: 0 additions & 13 deletions saas/app/pages/_document.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,6 @@ class MyDocument extends Document {
href="https://storage.googleapis.com/async-await/async-favicon32.png"
/>

<link
rel="prefetch"
href="/fonts/IBM-Plex-Mono/IBMPlexMono-Regular.woff2"
as="font"
type="font/woff2"
/>
<link
rel="prefetch"
href="/fonts/IBM-Plex-Mono/IBMPlexMono-Bold.woff2"
as="font"
type="font/woff2"
/>

<link
rel="stylesheet"
href={
Expand Down
Binary file not shown.
Binary file not shown.
Binary file modified saas/app/public/fonts/IBM-Plex-Mono/IBMPlexMono-Regular.woff2
Binary file not shown.
Binary file added saas/app/public/fonts/Roboto/Roboto-Regular.woff
Binary file not shown.
Binary file added saas/app/public/fonts/Roboto/Roboto-Regular.woff2
Binary file not shown.
Binary file not shown.
18 changes: 18 additions & 0 deletions saas/app/public/fonts/cdn.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
@font-face {
font-family: 'IBM Plex Mono';
font-style: normal;
font-display: swap;
font-weight: 400;
src: url(https://d2c24pn6pcl4ug.cloudfront.net/fonts/IBM-Plex-Mono/IBMPlexMono-Regular.woff2) format('woff2'), url(https://d2c24pn6pcl4ug.cloudfront.net/fonts/IBM-Plex-Mono/IBMPlexMono-Regular.woff) format('woff');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
font-family: 'Roboto';
font-style: normal;
font-display: swap;
font-weight: 400;
src: url(https://d2c24pn6pcl4ug.cloudfront.net/fonts/Roboto/Roboto-Regular.woff2) format('woff2'), url(https://d2c24pn6pcl4ug.cloudfront.net/fonts/Roboto/Roboto-Regular.woff) format('woff');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

17 changes: 17 additions & 0 deletions saas/app/public/fonts/server.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
@font-face {
font-family: 'IBM Plex Mono';
font-style: normal;
font-display: swap;
font-weight: 400;
src: url(./IBM-Plex-Mono/IBMPlexMono-Regular.woff2) format('woff2'), url(./IBM-Plex-Mono/IBMPlexMono-Regular.woff) format('woff');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
font-family: 'Roboto';
font-style: normal;
font-display: swap;
font-weight: 400;
src: url(./Roboto/Roboto-Regular.woff2) format('woff2'), url(./Roboto/Roboto-Regular.woff) format('woff');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

0 comments on commit efeb327

Please sign in to comment.