Browse Source

feat(blog): mobile-friendly responsiveness

Signed-off-by: Muthu Kumar <muthukumar@thefeathers.in>
pull/1/head
Muthu Kumar 2 years ago
parent
commit
53fc04e4ac
Signed by: mkrhere GPG Key ID: 3FD688398897097E
  1. 2
      package.json
  2. 4
      src/components/Spacer.tsx
  3. 14
      src/pages/blog/Home.tsx

2
package.json

@ -5,7 +5,7 @@
"type": "module", "type": "module",
"scripts": { "scripts": {
"start": "vite", "start": "vite",
"build": "tsc && vite build", "build": "pnpm blog && tsc && vite build",
"serve": "vite preview", "serve": "vite preview",
"blog": "node scripts/blog.js" "blog": "node scripts/blog.js"
}, },

4
src/components/Spacer.tsx

@ -15,8 +15,8 @@ export const Spacer: React.FC<Props> = ({ inline, x, y = 1 }) => {
className="spacer" className="spacer"
style={{ style={{
display: inline ? "inline-block" : "block", display: inline ? "inline-block" : "block",
width: rem(x), minWidth: rem(x),
height: rem(y), minHeight: rem(y),
}} }}
/> />
); );

14
src/pages/blog/Home.tsx

@ -11,7 +11,6 @@ const Header: React.FC = () => {
<header <header
className={css` className={css`
padding-inline: 1rem; padding-inline: 1rem;
margin-bottom: 4rem;
`}> `}>
<div> <div>
<h1 <h1
@ -90,6 +89,14 @@ const BlogHome: React.FC = () => {
} }
} }
} }
& > aside,
& > article {
@media screen and (max-width: 50rem) {
padding-block-start: 4rem;
padding-block-end: 6rem;
}
}
`, `,
)}> )}>
<aside <aside
@ -101,10 +108,11 @@ const BlogHome: React.FC = () => {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 1rem; gap: 1rem;
padding: 8rem; padding: 8vw;
max-width: 45rem; max-width: 45rem;
`}> `}>
<Header /> <Header />
<Spacer y={2} />
{articles.map(article => { {articles.map(article => {
const { title, snippet } = article; const { title, snippet } = article;
const path = getBlogPath(article); const path = getBlogPath(article);
@ -151,7 +159,7 @@ const BlogHome: React.FC = () => {
width: 100%; width: 100%;
overflow-y: auto; overflow-y: auto;
overflow-x: hidden; overflow-x: hidden;
padding: 8rem; padding: 8vw;
background-color: #262626; background-color: #262626;
flex: 3; flex: 3;
display: flex; display: flex;

Loading…
Cancel
Save