Skip to content

Commit 262b435

Browse files
author
Chris D. Macrae
committed
Setup theme to create global CSS vars and improve blockquote styling on mobile
1 parent 052b5a7 commit 262b435

File tree

4 files changed

+21
-5
lines changed

4 files changed

+21
-5
lines changed

packages/cdm-content/content.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,6 @@ export async function getAllContent<ContentShape extends BaseModel>(directory: s
117117
return content
118118
.filter(c => c !== null)
119119
.sort((post1, post2) => post1?.updated ?
120-
(post1?.updated > post2?.updated ? 1 : -1) :
121-
(post1?.created > post2?.created ? 1 : -1)) as ContentShape[]
120+
(post1?.updated > post2?.updated ? -1 : 1) :
121+
(post1?.created > post2?.created ? -1 : 1)) as ContentShape[]
122122
}

packages/cdm-ui/LongFormText/LongFormText.module.css

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,15 @@
1010

1111
.LongFormText blockquote {
1212
border-left: 0.2rem solid rgb(255, 225, 0);
13-
margin-left: -2rem;
14-
padding-left: 1.8rem;
1513
font-style: italic;
14+
margin-left: -1rem;
15+
padding-left: 1.8rem;
16+
}
17+
18+
@media screen and (min-width: 960px) {
19+
.LongFormText blockquote {
20+
margin-left: -2rem;
21+
}
1622
}
1723

1824
.LongFormText ol,

packages/cdm-ui/Theme/Theme.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import Head from "next/head";
12
import React, { createContext, useEffect, useState } from "react";
23
import { BuiltInBreakpoints } from "./useBreakpoint";
34

@@ -39,6 +40,15 @@ export const ThemeProvider: React.FC<ThemeProviderProps> = ({ breakpoints = {},
3940
rootFontSize,
4041
breakpoints: allBreakpoints
4142
}}>
43+
<Head>
44+
<style id="cdm-theme">
45+
{`
46+
:root {${Object.keys(allBreakpoints).map(name => `
47+
--cdm-breakpoint-${name}: ${allBreakpoints[name]};
48+
`).join('')}}
49+
`}
50+
</style>
51+
</Head>
4252
{children}
4353
</ThemeContext.Provider>
4454
);

src/views/Homepage/Homepage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export const Homepage: React.FC<HomepageProps> = ({ posts }) => {
2626
<Box padding="sm">
2727
<Heading as="h3">My thoughts</Heading>
2828
</Box>
29-
{posts?.map((post, i) => <Article {...post} i={i} key={post.slug} />)}
29+
{posts?.map((post, i) => <Article {...post} i={posts.length - 1 - i} key={post.slug} />)}
3030
</Stack>
3131
</Layout.Item>
3232
</BasicLayout>

0 commit comments

Comments
 (0)