edit post stuff
This commit is contained in:
parent
d22f7e4ab2
commit
d81ec4d50c
3 changed files with 28 additions and 11 deletions
|
@ -4,11 +4,13 @@ import styles from "styles/Posts.module.sass";
|
||||||
import { useTheme } from "next-themes";
|
import { useTheme } from "next-themes";
|
||||||
import Date from "./Date";
|
import Date from "./Date";
|
||||||
|
|
||||||
const Post = ({ title, date, tag }) => {
|
const Post = ({ title, date, tag, slug }) => {
|
||||||
const { resolvedTheme: theme } = useTheme();
|
const { resolvedTheme: theme } = useTheme();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
<Link href={`/blog/${slug}`}>
|
||||||
|
<a className={styles.link}>
|
||||||
<div data-theme={theme} className={styles.post}>
|
<div data-theme={theme} className={styles.post}>
|
||||||
<div className={styles.title_date}>
|
<div className={styles.title_date}>
|
||||||
<p className={styles.title}>{title}</p>
|
<p className={styles.title}>{title}</p>
|
||||||
|
@ -16,8 +18,14 @@ const Post = ({ title, date, tag }) => {
|
||||||
<Date dateString={date} />
|
<Date dateString={date} />
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
{tag ? <p data-theme={theme} className={styles.tag}>{tag}</p> : undefined}
|
{tag ? (
|
||||||
|
<p data-theme={theme} className={styles.tag}>
|
||||||
|
{tag}
|
||||||
|
</p>
|
||||||
|
) : undefined}
|
||||||
</div>
|
</div>
|
||||||
|
</a>
|
||||||
|
</Link>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
@ -18,3 +18,7 @@ You should ask yourself: "Can I pre-render this page **ahead** of a user's reque
|
||||||
On the other hand, Static Generation is **not** a good idea if you cannot pre-render a page ahead of a user's request. Maybe your page shows frequently updated data, and the page content changes on every request.
|
On the other hand, Static Generation is **not** a good idea if you cannot pre-render a page ahead of a user's request. Maybe your page shows frequently updated data, and the page content changes on every request.
|
||||||
|
|
||||||
In that case, you can use **Server-Side Rendering**. It will be slower, but the pre-rendered page will always be up-to-date. Or you can skip pre-rendering and use client-side JavaScript to populate data.
|
In that case, you can use **Server-Side Rendering**. It will be slower, but the pre-rendered page will always be up-to-date. Or you can skip pre-rendering and use client-side JavaScript to populate data.
|
||||||
|
|
||||||
|
```js
|
||||||
|
const uwu = "owo";
|
||||||
|
```
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
|
|
||||||
.post
|
.post
|
||||||
display: flex
|
display: flex
|
||||||
|
padding-top: .3rem
|
||||||
|
padding-bottom: .3rem
|
||||||
align-items: center
|
align-items: center
|
||||||
transition: all .2s
|
transition: all .2s
|
||||||
background: $background-dark-buttons
|
background: $background-dark-buttons
|
||||||
|
@ -46,3 +48,6 @@
|
||||||
display: grid
|
display: grid
|
||||||
gap: .5rem
|
gap: .5rem
|
||||||
grid-template-columns: 1
|
grid-template-columns: 1
|
||||||
|
|
||||||
|
.link
|
||||||
|
cursor: pointer
|
||||||
|
|
Loading…
Add table
Reference in a new issue