create-audora-next 2.0.2 → 2.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -84,9 +84,42 @@ function CustomLink(props: CustomLinkProps) {
|
|
|
84
84
|
);
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
87
|
+
type ImgProps = React.ComponentProps<typeof Image> & {
|
|
88
|
+
width?: number | string;
|
|
89
|
+
height?: number | string;
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
function BlogImage(props: ImgProps) {
|
|
93
|
+
const { width, height, alt, src, ...rest } = props;
|
|
94
|
+
const hasDimensions =
|
|
95
|
+
typeof width === "number" &&
|
|
96
|
+
typeof height === "number" &&
|
|
97
|
+
width > 0 &&
|
|
98
|
+
height > 0;
|
|
99
|
+
|
|
100
|
+
if (hasDimensions) {
|
|
101
|
+
return (
|
|
102
|
+
<Image
|
|
103
|
+
className="rounded-lg"
|
|
104
|
+
width={width}
|
|
105
|
+
height={height}
|
|
106
|
+
alt={alt ?? ""}
|
|
107
|
+
src={src}
|
|
108
|
+
{...rest}
|
|
109
|
+
/>
|
|
110
|
+
);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
const imgSrc = typeof src === "string" ? src : "";
|
|
114
|
+
return (
|
|
115
|
+
// eslint-disable-next-line @next/next/no-img-element
|
|
116
|
+
<img
|
|
117
|
+
className="rounded-lg max-w-full h-auto"
|
|
118
|
+
src={imgSrc}
|
|
119
|
+
alt={alt ?? ""}
|
|
120
|
+
{...rest}
|
|
121
|
+
/>
|
|
122
|
+
);
|
|
90
123
|
}
|
|
91
124
|
|
|
92
125
|
type MDXComponents = NonNullable<MDXRemoteProps["components"]>;
|
|
@@ -188,7 +221,7 @@ const components: MDXComponents = {
|
|
|
188
221
|
);
|
|
189
222
|
},
|
|
190
223
|
a: CustomLink,
|
|
191
|
-
img:
|
|
224
|
+
img: BlogImage,
|
|
192
225
|
Table,
|
|
193
226
|
};
|
|
194
227
|
|
|
@@ -10,7 +10,7 @@ tags:
|
|
|
10
10
|
- web
|
|
11
11
|
---
|
|
12
12
|
|
|
13
|
-
**Axum** is a fast, ergonomic web framework for Rust built on [Tokio](https://tokio.rs/) (async runtime) and [Tower](https://github.com/tower-rs/tower) (middleware). In this post we
|
|
13
|
+
**Axum** is a fast, ergonomic web framework for Rust built on [Tokio](https://tokio.rs/) (async runtime) and [Tower](https://github.com/tower-rs/tower) (middleware). In this post we'll build a minimal "Hello, World!" server you can run in a few minutes.
|
|
14
14
|
|
|
15
15
|
## Setup
|
|
16
16
|
|
|
@@ -57,7 +57,9 @@ cargo run
|
|
|
57
57
|
|
|
58
58
|
Open [http://localhost:3000](http://localhost:3000) and you should see **Hello, World!**.
|
|
59
59
|
|
|
60
|
-
|
|
60
|
+

|
|
61
|
+
|
|
62
|
+
## What's going on
|
|
61
63
|
|
|
62
64
|
- **Router** – Defines routes; here we attach a single `GET /` to `handler`.
|
|
63
65
|
- **handler** – An async function that returns a string; Axum sends it as `text/plain` with status 200.
|