From 70035db4b36fc8377aaa6fab8dfa931e5478b755 Mon Sep 17 00:00:00 2001 From: Alex Wendland Date: Thu, 22 Dec 2022 23:11:00 -0800 Subject: [PATCH] design: Increase text density and reduce font size on mobile --- src/components/layout.js | 2 +- src/pages/index.js | 39 +++++--------------------------------- src/pages/index.module.css | 39 ++++++++++++++++++++++++++++++++++++++ src/utils/typography.js | 15 ++++++++++++++- 4 files changed, 59 insertions(+), 36 deletions(-) create mode 100644 src/pages/index.module.css diff --git a/src/components/layout.js b/src/components/layout.js index 01f7f4c..e94d2a4 100644 --- a/src/components/layout.js +++ b/src/components/layout.js @@ -57,7 +57,7 @@ class Layout extends React.Component { style={{ marginLeft: 'auto', marginRight: 'auto', - maxWidth: rhythm(24), + maxWidth: rhythm(28), padding: `${rhythm(1.5)} ${rhythm(3 / 4)}`, }} > diff --git a/src/pages/index.js b/src/pages/index.js index 7eab1b7..d0ff0f0 100644 --- a/src/pages/index.js +++ b/src/pages/index.js @@ -6,6 +6,7 @@ import LongTermNotesSnippet from '../components/long-term-notes-snippet' import Layout from '../components/layout' import SEO from '../components/seo' import { rhythm } from '../utils/typography' +import * as styles from './index.module.css' const TimelineLinkEntry = ({ isoDate, @@ -16,25 +17,11 @@ const TimelineLinkEntry = ({ emoji = '', }) => { return ( -
+
@@ -49,27 +36,11 @@ const TimelineLinkEntry = ({ {emoji} {slug ? ( - + {title} ) : ( - + {title} )} diff --git a/src/pages/index.module.css b/src/pages/index.module.css new file mode 100644 index 0000000..0edd11a --- /dev/null +++ b/src/pages/index.module.css @@ -0,0 +1,39 @@ +@media screen and not (min-width: 768px) { + .timelineLinkEntry { + margin-bottom: calc(0.25 * var(--rhythm)); + } + + .timelineLinkEntry_time { + margin-right: 1em; + opacity: 0.6; + font-size: 0.8em; + line-height: calc(1 * var(--rhythm)); + } + + .timelineLinkEntry_title { + display: block; + } +} + +@media screen and (min-width: 768px) { + .timelineLinkEntry { + margin-bottom: calc(0.35 * var(--rhythm)); + display: flex; + align-items: flex-end; + } + + .timelineLinkEntry_time { + display: inline-block; + width: calc(3.8 * var(--rhythm)); + flex-shrink: 0; + opacity: 0.6; + font-size: 0.8em; + line-height: calc(1 * var(--rhythm)); + } + + .timelineLinkEntry_title { + white-space: nowrap; + text-overflow: ellipsis; + overflow: hidden; + } +} diff --git a/src/utils/typography.js b/src/utils/typography.js index 4c900ab..8b65203 100644 --- a/src/utils/typography.js +++ b/src/utils/typography.js @@ -12,14 +12,27 @@ Wordpress2016.overrideThemeStyles = ( 'a.gatsby-resp-image-link': { boxShadow: 'none', }, - 'a.anchor': { + a: { // Cancel out noticeable styling boxShadow: `none`, }, + 'h1,h2,h3,h4,h5,h6': { + marginTop: rhythm(1.3333333), + }, + ':root': { + '--rhythm': rhythm(1), + }, + '@media only screen and (max-width:768px)': { + html: { + fontSize: '15px', + }, + }, }) delete Wordpress2016.googleFonts +Wordpress2016.baseLineHeight = 1.5 + const typography = new Typography(Wordpress2016) // Hot reload typography in development.