create-audora-next 2.0.1 → 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/README.md CHANGED
@@ -6,11 +6,11 @@ Create a new Audora Next.js app with one command.
6
6
 
7
7
  **Base template**
8
8
 
9
- ![Audora Next](./assets/audora-next.webp)
9
+ ![Audora Next](https://github.com/AudoraLabs/create-audora-next/raw/master/assets/audora-next.webp)
10
10
 
11
11
  **Blog template**
12
12
 
13
- ![Audora Blog](./assets/audora-blog.png)
13
+ ![Audora Blog](https://github.com/AudoraLabs/create-audora-next/raw/master/assets/audora-blog.png)
14
14
 
15
15
  ## Quick Start
16
16
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-audora-next",
3
- "version": "2.0.1",
3
+ "version": "2.0.3",
4
4
  "description": "Create a new Audora Next.js app with one command",
5
5
  "keywords": [
6
6
  "create",
@@ -84,9 +84,42 @@ function CustomLink(props: CustomLinkProps) {
84
84
  );
85
85
  }
86
86
 
87
- function RoundedImage(props: React.ComponentProps<typeof Image>) {
88
- // eslint-disable-next-line jsx-a11y/alt-text
89
- return <Image className="rounded-lg" {...props} />;
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: RoundedImage,
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 well build a minimal Hello, World!” server you can run in a few minutes.
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
- ## What’s going on
60
+ ![Hello World server running in the browser](/images/screenshot-desktop-light.webp)
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.