Skip to content

Commit 418b458

Browse files
committed
feat(makrdown): add style for checkbox related
- Add robust handling of rss setting in <head>. - Fix not-found page tailwindcss variable issue.
1 parent 7daad73 commit 418b458

File tree

6 files changed

+58
-25
lines changed

6 files changed

+58
-25
lines changed

.changeset/soft-bats-appear.md

-5
This file was deleted.

CHANGELOG.md

+20
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,25 @@
11
# SuzuBlog Changelog
22

3+
## 1.5.0
4+
5+
### Minor Changes
6+
7+
- Theme cleanup and style refine
8+
9+
- feat(makrdown): add style for checkbox related
10+
11+
- 7daad73: style(global): styles clean up and re-structure
12+
13+
- Move reusable styles into `styles` folder.
14+
- Fix custom scroll bar consistence.
15+
- Fix minor styling issue and contract issue.
16+
- Improve A11Y overall experience.
17+
- Remove img min-h limit in markdown. Remember to refine this in the future.
18+
- Remove Suspense for `CategoriesTagsList.tsx`. LoadingIndicator is non-used component now.
19+
20+
- 2548e85: chore: clean up some code
21+
- 215b4eb: feat(darkTheme): theme setting only store for 7 days
22+
323
## 1.4.3
424

525
### Patch Changes

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "suzu-blog",
3-
"version": "1.4.3",
3+
"version": "1.5.0",
44
"private": true,
55
"packageManager": "[email protected]",
66
"author": {

src/app/layout.tsx

+11-8
Original file line numberDiff line numberDiff line change
@@ -72,14 +72,17 @@ export default function RootLayout(
7272
<link rel="apple-touch-icon" sizes="180x180" href="/icons/apple-touch-icon.png" />
7373

7474
{/* If rss set in config */}
75-
{config.socialMedia.rss && (
76-
<link
77-
rel="alternate"
78-
type="application/rss+xml"
79-
title="RSS Feed"
80-
href={`${config.siteUrl}/feed.xml`}
81-
/>
82-
)}
75+
{config.socialMedia.rss !== undefined
76+
&& config.socialMedia.rss !== null
77+
&& String(config.socialMedia.rss) !== 'false'
78+
&& (
79+
<link
80+
rel="alternate"
81+
type="application/rss+xml"
82+
title="RSS Feed"
83+
href={`${config.siteUrl}/feed.xml`}
84+
/>
85+
)}
8386
{/* Custom js */}
8487
{config.headerJavascript.map(jsFile => (
8588
<Script key={jsFile} src={jsFile} strategy="afterInteractive" />

src/app/not-found.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -26,19 +26,19 @@ function Custom404() {
2626

2727
return (
2828
<main className="mx-8 mt-[30vh] flex flex-col items-center justify-center text-center">
29-
<h1 className="mb-4 text-3xl font-bold text-[var(--sakuraPink)]">
29+
<h1 className="mb-4 text-3xl font-bold text-primary-300">
3030
404 - 页面迷路啦 (;′⌒`)
3131
</h1>
3232
<p className="mb-6 text-base leading-7">
3333
抱歉,您要找的页面已经不见了,或者它从未存在过 🔍
3434
<br />
35-
<span className="text-[var(--skyblue)]">{countdown}</span>
35+
<span className="text-secondary-300">{countdown}</span>
3636
{' '}
3737
秒后将自动返回首页
3838
</p>
3939
<Link
4040
href="/"
41-
className="rounded-sm bg-[var(--skyblue)] px-4 py-2 text-white no-underline transition-all duration-500 hover:scale-110 hover:bg-[var(--skyblue)] hover:text-black"
41+
className="rounded-sm bg-secondary-300 px-4 py-2 text-white no-underline transition-all-500 hover:scale-110 bg-hover-secondary hover:text-black"
4242
>
4343
返回首页
4444
</Link>

src/components/article/parser/markdownComponents.tsx

+23-8
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
11
import type { ReactNode } from 'react'
22
import type { Components as MarkdownComponents } from 'react-markdown'
3-
43
import { CustomImage, SakuraIcon } from '@/components/ui'
54
import { generateHierarchicalSlug, slugPrefix } from '@/services/utils'
6-
7-
import Link from 'next/link'
85
import { isValidElement } from 'react'
9-
106
import { KEY_ICONS } from './keyboardIcons'
117
import CodeBlock from './renderCodeBlock'
128
import renderFriendLinks from './renderFriendLinks'
@@ -143,6 +139,26 @@ const createMarkdownComponents = (translation: Translation, autoSlug: boolean =
143139
{children}
144140
</mark>
145141
),
142+
// Checkbox related [x] or [ ]
143+
input: ({ children, ...props }) => (
144+
<label className="relative inline-flex items-center text-center">
145+
<input
146+
type="checkbox"
147+
className="peer form-tick appearance-none h-4 w-4 border border-gray-300 rounded-md checked:bg-primary-400 checked:border-transparent focus:outline-none focus:ring-2 focus:ring-primary-400 focus:ring-opacity-50"
148+
{...props}
149+
/>
150+
<span className="absolute inset-0 flex items-center justify-center pointer-events-none opacity-0 peer-checked:opacity-100">
151+
<svg
152+
className="h-4 w-4 text-white"
153+
fill="none"
154+
viewBox="0 0 24 24"
155+
stroke="currentColor"
156+
>
157+
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M5 13l4 4L19 7" />
158+
</svg>
159+
</span>
160+
</label>
161+
),
146162

147163
// List related
148164
ul: ({ children }) => (
@@ -169,7 +185,7 @@ const createMarkdownComponents = (translation: Translation, autoSlug: boolean =
169185
a: ({ href = '#', children, ...props }: { href?: string, children?: ReactNode }) => {
170186
const isInternalLink = typeof href === 'string' && (href.startsWith('/') || href.startsWith('#'))
171187
return (
172-
<Link
188+
<a
173189
href={href}
174190
target={isInternalLink ? '_self' : '_blank'}
175191
rel="noopener noreferrer"
@@ -178,12 +194,11 @@ const createMarkdownComponents = (translation: Translation, autoSlug: boolean =
178194
? undefined
179195
: `${translation.newTab}${children?.toString() ?? 'link'}`
180196
}
181-
prefetch={false}
182197
className="text-hover-primary underline-interactive mx-1 break-words font-semibold text-secondary-500"
183198
{...(props as Record<string, unknown>)}
184199
>
185200
{children}
186-
</Link>
201+
</a>
187202
)
188203
},
189204

@@ -195,7 +210,7 @@ const createMarkdownComponents = (translation: Translation, autoSlug: boolean =
195210
width={500}
196211
height={700}
197212
priority={false}
198-
className="relative mx-auto my-6 h-auto max-h-[500px] min-h-[200px] w-auto min-w-[200px] max-w-full rounded-xs object-contain shadow-md lg:max-h-[700px] lg:min-h-[300px] lg:min-w-[300px] xl:max-h-[800px] xl:min-h-[400px] xl:min-w-[400px]"
213+
className="relative mx-auto my-6 h-auto max-h-[500px] w-auto min-w-[200px] max-w-full rounded-xs object-contain shadow-md lg:max-h-[700px] lg:min-w-[300px] xl:max-h-[800px] xl:min-w-[400px]"
199214
{...(props as Record<string, unknown>)}
200215
/>
201216
),

0 commit comments

Comments
 (0)