Skip to content

Commit 50316b9

Browse files
authored
Merge branch 'main' into refactor-print-section
2 parents 4dcc7de + 9022f38 commit 50316b9

15 files changed

Lines changed: 105 additions & 339 deletions

File tree

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@
7575
"dependencies": {
7676
"@docsearch/react": "^4.6.0",
7777
"@react-spring/web": "^10.0.3",
78+
"clsx": "^2.1.1",
7879
"path-browserify": "^1.0.1",
7980
"prop-types": "^15.8.1",
8081
"react": "^19.2.4",
@@ -84,6 +85,7 @@
8485
"react-router-dom": "^7.13.1",
8586
"react-tiny-popover": "^8.1.6",
8687
"react-use": "^17.6.0",
88+
"tailwind-merge": "^3.5.0",
8789
"webpack-pwa-manifest": "^4.3.0",
8890
"workbox-window": "^7.4.0"
8991
},

src/components/CodeBlockWithCopy/CodeBlockWithCopy.jsx

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import PropTypes from "prop-types";
22
import { useEffect, useRef, useState } from "react";
3-
import "./CodeBlockWithCopy.scss";
3+
import { cn } from "../../utilities/cn.mjs";
44

55
export default function CodeBlockWithCopy({ children }) {
66
const preRef = useRef(null);
@@ -115,10 +115,22 @@ export default function CodeBlockWithCopy({ children }) {
115115
);
116116

117117
return (
118-
<div className="code-block-wrapper">
118+
<div className="code-block-wrapper relative mb-6 group">
119119
<button
120120
onClick={handleCopy}
121-
className={`copy-button ${copyStatus}`}
121+
className={cn(
122+
"copy-button",
123+
"absolute top-2 right-2 z-10 px-[0.7rem] py-[0.4rem] rounded-[0.35rem] border-none cursor-pointer text-xs font-medium text-slate-200",
124+
"opacity-0 group-hover:opacity-100",
125+
"transition-[background-color,transform,opacity] duration-200",
126+
"active:scale-95",
127+
"focus-visible:outline-none focus-visible:opacity-100",
128+
copyStatus === "copied"
129+
? "bg-green-600 hover:bg-green-700"
130+
: copyStatus === "error"
131+
? "bg-red-500 hover:bg-red-700"
132+
: "bg-[#175d96] hover:bg-[#2f85d0]",
133+
)}
122134
aria-label="Copy code to clipboard"
123135
>
124136
{copyStatus === "copied"

src/components/CodeBlockWithCopy/CodeBlockWithCopy.scss

Lines changed: 0 additions & 66 deletions
This file was deleted.

src/components/Page/Page.jsx

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import { placeholderString } from "../Placeholder/Placeholder.jsx";
1212
import AdjacentPages from "./AdjacentPages.jsx";
1313

1414
// Load Styling
15-
import "./Page.scss";
1615

1716
export default function Page(props) {
1817
const {
@@ -117,7 +116,10 @@ export default function Page(props) {
117116
);
118117
}
119118
return (
120-
<main id="main-content" className="page">
119+
<main
120+
id="main-content"
121+
className="flex-auto relative overflow-x-hidden py-[1.5em] px-[1em] md:flex-[3] md:p-[1.5em]"
122+
>
121123
<Markdown>
122124
<h1>{title}</h1>
123125
{rest.date && pathname.startsWith("/blog/") && !isBlogIndex && (
@@ -136,19 +138,34 @@ export default function Page(props) {
136138
<div id="md-content">{contentRender}</div>
137139

138140
{rest.url === "/blog/" && (
139-
<div className="blog-list">
141+
<div className="mt-8">
140142
{(props.pages || [])
141143
.filter((post) => post.url !== "/blog/")
142144
.map((post) => (
143-
<div key={post.url} className="blog-post-item">
144-
<h2>
145-
<Link to={post.url}>{post.title}</Link>
145+
<div
146+
key={post.url}
147+
className="mb-[3rem] pb-[2rem] border-b border-gray-100 last:border-b-0 dark:border-gray-800"
148+
>
149+
<h2 className="mt-0 mb-[0.5rem] text-[1.8rem] font-bold leading-[1.2]">
150+
<Link
151+
to={post.url}
152+
className="text-blue-800 no-underline hover:text-blue-400 dark:!text-[#9ab3c0] dark:hover:!text-blue-200"
153+
>
154+
{post.title}
155+
</Link>
146156
</h2>
147157
{post.date && (
148-
<div className="blog-post-date">{post.date}</div>
158+
<div className="text-gray-500 text-[1.2rem] font-semibold mt-[0.25rem] mb-[1rem] italic dark:text-[#bbb]">
159+
{post.date}
160+
</div>
149161
)}
150-
<p>{post.teaser}</p>
151-
<Link to={post.url} className="read-more">
162+
<p className="text-gray-600 leading-[1.4] mb-[1rem] dark:text-gray-200">
163+
{post.teaser}
164+
</p>
165+
<Link
166+
to={post.url}
167+
className="text-blue-400 font-semibold no-underline hover:underline dark:text-blue-200"
168+
>
152169
Read More &rarr;
153170
</Link>
154171
</div>

src/components/Page/Page.scss

Lines changed: 0 additions & 98 deletions
This file was deleted.

src/components/Print/Print.jsx

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,20 +39,14 @@ export default function Print(props) {
3939
fill="#175d96"
4040
/>
4141
<a
42-
className="sidebar-item__title flex flex-nowrap items-center"
42+
className="sidebar-item__title flex items-center flex-nowrap"
4343
href={printUrl}
4444
rel="nofollow noopener noreferrer"
4545
title="Print"
4646
target="_blank"
4747
>
4848
Print Section
49-
<img
50-
className="h-20 mr-0.5"
51-
src={icon}
52-
width={27}
53-
height={20}
54-
alt="Printer Icon"
55-
/>
49+
<img src={icon} alt="Printer Icon" className="h-[20px] w-[27px]" />
5650
</a>
5751
</div>
5852
);

src/components/SidebarItem/SidebarItem.scss

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
flex-wrap: wrap;
88
font-size: 15px;
99
margin: 0.6em 0;
10+
align-items: center;
11+
min-height: 40px;
1012

1113
&__toggle {
1214
flex: 0 0 auto;
@@ -25,14 +27,20 @@
2527
background: none;
2628
border: none;
2729
padding: 0;
28-
display: flex;
30+
display: inline-flex;
2931
align-items: center;
32+
justify-content: center;
33+
min-width: 40px;
34+
min-height: 40px;
3035
}
3136

3237
&__title {
3338
flex: 1 1 auto;
3439
color: getColor(elephant);
3540
max-width: 85%;
41+
min-height: 40px;
42+
display: inline-flex;
43+
align-items: center;
3644
@include control-overflow;
3745
&.active {
3846
font-weight: 600;

0 commit comments

Comments
 (0)