Skip to content

Commit 0a867eb

Browse files
committed
feat: Optimize page style & add Markdown support.
1 parent 179669e commit 0a867eb

14 files changed

+795
-123
lines changed

package.json

+2
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,13 @@
2323
"pino-pretty": "^11.0.0",
2424
"react": "^18",
2525
"react-dom": "^18",
26+
"react-markdown": "^9.0.1",
2627
"swagger-ui-react": "^5.12.3",
2728
"tough-cookie": "^4.1.3",
2829
"user-agents": "^1.1.156"
2930
},
3031
"devDependencies": {
32+
"@tailwindcss/typography": "^0.5.12",
3133
"@types/node": "^20",
3234
"@types/react": "^18",
3335
"@types/react-dom": "^18",

pnpm-lock.yaml

+618-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/github-logo.webp

7.09 KB
Binary file not shown.

public/github-mark.png

6.24 KB
Loading

src/app/components/Footer.tsx

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import Link from "next/link";
2+
import Image from "next/image";
3+
4+
export default function Footer() {
5+
return (
6+
<footer className=" flex w-full justify-center py-4 items-center
7+
bg-indigo-50 backdrop-blur-2xl font-mono text-sm px-4 lg:px-0
8+
">
9+
<p className="px-6 py-3 rounded-full flex justify-center items-center gap-2
10+
">
11+
<span>© 2024</span>
12+
<Link href="https://github.com/gcui-art/suno-api/">
13+
gcui-art/suno-api
14+
</Link>
15+
</p>
16+
</footer>
17+
);
18+
}

src/app/components/Header.tsx

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
import Link from "next/link";
2+
import Image from "next/image";
3+
import Logo from "./Logo";
4+
5+
export default function Header() {
6+
return (
7+
<nav className=" flex w-full justify-center py-4 items-center
8+
border-b border-gray-300 backdrop-blur-2xl font-mono text-sm px-4 lg:px-0">
9+
<div className="max-w-3xl flex w-full items-center justify-between">
10+
<div className="font-medium text-xl text-indigo-900 flex items-center gap-2">
11+
<Logo className="w-4 h-4" />
12+
<Link href='/'>
13+
Suno API
14+
</Link>
15+
</div>
16+
<div className="flex items-center justify-center gap-1 text-sm font-light text-indigo-900/90">
17+
<p className="p-2 lg:px-6 lg:py-3 rounded-full flex justify-center items-center
18+
lg:hover:bg-indigo-300 duration-200
19+
">
20+
<Link href="/">
21+
Get Started
22+
</Link>
23+
</p>
24+
<p className="p-2 lg:px-6 lg:py-3 rounded-full flex justify-center items-center
25+
lg:hover:bg-indigo-300 duration-200
26+
">
27+
<Link href="/docs">
28+
API Docs
29+
</Link>
30+
</p>
31+
<p className="p-2 lg:px-6 lg:py-3 rounded-full flex justify-center items-center
32+
lg:hover:bg-indigo-300 duration-200
33+
">
34+
<a href="https://github.com/gcui-art/suno-api/"
35+
target="_blank"
36+
className="flex items-center justify-center gap-1">
37+
<span className="">
38+
<Image src="/github-mark.png" alt="GitHub Logo" width={20} height={20} />
39+
</span>
40+
<span>Github</span>
41+
</a>
42+
</p>
43+
</div>
44+
45+
46+
47+
</div>
48+
</nav>
49+
);
50+
}

src/app/components/Logo.tsx

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
2+
3+
export default function Logo({ className = '', ...props }) {
4+
return (
5+
<span className=" bg-indigo-900 rounded-full p-2">
6+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" className={className}
7+
fill="none" stroke="#ffffff" stroke-width="1"
8+
stroke-linecap="round" stroke-linejoin="round">
9+
<path d="M3 14h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-7a9 9 0 0 1 18 0v7a2 2 0 0 1-2 2h-1a2 2 0 0 1-2-2v-3a2 2 0 0 1 2-2h3" />
10+
</svg>
11+
</span>
12+
);
13+
}

src/app/components/Section.tsx

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
'use client';
2+
/**
3+
*
4+
* @param param0
5+
* @returns
6+
*/
7+
export default function Section({
8+
children,
9+
className
10+
}: {
11+
children?: React.ReactNode | string,
12+
className?: string
13+
}) {
14+
15+
return (
16+
<section className={`mx-auto w-full px-4 lg:px-0 ${className}`} >
17+
<div className=" max-w-3xl mx-auto">
18+
{children}
19+
</div>
20+
</section>
21+
);
22+
};
File renamed without changes.

src/app/docs/page.tsx

+5-6
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
import React from 'react';
2-
import Swagger from './Swagger';
2+
import Swagger from '../components/Swagger';
33
import spec from './swagger-suno-api.json'; // 直接导入JSON文件
4+
import Section from '../components/Section';
45

56

6-
export default async function Docs() {
7-
// const spec = await getApiDocs();
7+
export default function Docs() {
88
return (
9-
<main className="flex min-h-screen flex-col items-center p-24 bg-white">
10-
9+
<Section className="">
1110
<Swagger spec={spec} />
12-
</main>
11+
</Section>
1312
);
1413
}

src/app/globals.css

+1-9
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,10 @@
44

55
:root {
66
--foreground-rgb: 0, 0, 0;
7-
--background-start-rgb: 214, 219, 220;
7+
--background-start-rgb: 255, 255, 255;
88
--background-end-rgb: 255, 255, 255;
99
}
1010

11-
@media (prefers-color-scheme: dark) {
12-
:root {
13-
--foreground-rgb: 255, 255, 255;
14-
--background-start-rgb: 0, 0, 0;
15-
--background-end-rgb: 0, 0, 0;
16-
}
17-
}
18-
1911
body {
2012
color: rgb(var(--foreground-rgb));
2113
background: linear-gradient(

src/app/layout.tsx

+9-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import type { Metadata } from "next";
22
import { Inter } from "next/font/google";
33
import "./globals.css";
4+
import Header from "./components/Header";
5+
import Footer from "./components/Footer";
46

57
const inter = Inter({ subsets: ["latin"] });
68

@@ -18,7 +20,13 @@ export default function RootLayout({
1820
}>) {
1921
return (
2022
<html lang="en">
21-
<body className={inter.className}>{children}</body>
23+
<body className={`${inter.className} overflow-y-scroll`} >
24+
<Header />
25+
<main className="flex flex-col items-center m-auto w-full">
26+
{children}
27+
</main>
28+
<Footer />
29+
</body>
2230
</html>
2331
);
2432
}

src/app/page.tsx

+54-102
Original file line numberDiff line numberDiff line change
@@ -1,108 +1,60 @@
1-
import Image from "next/image";
1+
import Section from "./components/Section";
2+
import Markdown from 'react-markdown';
3+
24

35
export default function Home() {
6+
7+
const markdown = `
8+
## Introduction
9+
10+
Suno.ai v3 is an amazing AI music service. Although the official API is not yet available, we couldn't wait to integrate its capabilities somewhere.
11+
12+
We discovered that some users have similar needs, so we decided to open-source this project, hoping you'll like it.
13+
14+
## Features
15+
16+
- Perfectly implements the creation API from \`app.suno.ai\`
17+
- Supports \`Custom Mode\`
18+
- One-click deployment to Vercel
19+
- In addition to the standard API, it also adapts to the API Schema of Agent platforms like GPTs and Coze, so you can use it as a tool/plugin/Action for LLMs and integrate it into any AI Agent.
20+
- Permissive open-source license, allowing you to freely integrate and modify.
21+
22+
## Getting Started
23+
24+
### 1. Obtain the cookie of your app.suno.ai account
25+
26+
### 2. Clone and deploy this project
27+
28+
### 3. Configure suno-api
29+
30+
### 4. Run suno api
31+
32+
### 5. Create more freely
33+
34+
`;
435
return (
5-
<main className="flex min-h-screen flex-col items-center justify-between p-24">
6-
<div className="z-10 max-w-5xl w-full items-center justify-between font-mono text-sm lg:flex">
7-
<p className="fixed left-0 top-0 flex w-full justify-center border-b border-gray-300 bg-gradient-to-b from-zinc-200 pb-6 pt-8 backdrop-blur-2xl dark:border-neutral-800 dark:bg-zinc-800/30 dark:from-inherit lg:static lg:w-auto lg:rounded-xl lg:border lg:bg-gray-200 lg:p-4 lg:dark:bg-zinc-800/30">
8-
Suno API
9-
</p>
10-
<div className="fixed bottom-0 left-0 flex h-48 w-full items-end justify-center bg-gradient-to-t from-white via-white dark:from-black dark:via-black lg:static lg:h-auto lg:w-auto lg:bg-none">
11-
<a
12-
className="pointer-events-none flex place-items-center gap-2 p-8 lg:pointer-events-auto lg:p-0"
13-
href="https://vercel.com?utm_source=create-next-app&utm_medium=appdir-template&utm_campaign=create-next-app"
14-
target="_blank"
15-
rel="noopener noreferrer"
16-
>
17-
By{" "}
18-
<a href="https://github.com/gcui-art/">
19-
gcui.art
20-
</a>
21-
</a>
22-
</div>
23-
</div>
24-
25-
<div className="relative flex place-items-center
26-
before:absolute before:h-[300px] before:w-full sm:before:w-[480px] before:-translate-x-1/2 before:rounded-full
27-
before:bg-gradient-radial before:from-white before:to-transparent
28-
before:blur-2xl before:content-[''] after:absolute after:-z-20 after:h-[180px] after:w-full sm:after:w-[240px] after:translate-x-1/3
29-
after:bg-gradient-conic after:from-sky-200 after:via-blue-200 after:blur-2xl
30-
after:content-[''] before:dark:bg-gradient-to-br before:dark:from-transparent before:dark:to-blue-700 before:dark:opacity-10 after:dark:from-sky-900 after:dark:via-[#0141ff] after:dark:opacity-40 before:lg:h-[360px] z-[-1]">
31-
<h1 className=" font-bold text-2xl">
32-
Easily integrate Suno AI into your GPTs and other agents.
33-
</h1>
34-
35-
</div>
36-
37-
<div className="mb-32 grid text-center lg:max-w-5xl lg:w-full lg:mb-0 lg:grid-cols-4 lg:text-left">
38-
<a
39-
href="https://nextjs.org/docs?utm_source=create-next-app&utm_medium=appdir-template&utm_campaign=create-next-app"
40-
className="group rounded-lg border border-transparent px-5 py-4 transition-colors hover:border-gray-300 hover:bg-gray-100 hover:dark:border-neutral-700 hover:dark:bg-neutral-800/30"
41-
target="_blank"
42-
rel="noopener noreferrer"
43-
>
44-
<h2 className={`mb-3 text-2xl font-semibold`}>
45-
Docs{" "}
46-
<span className="inline-block transition-transform group-hover:translate-x-1 motion-reduce:transform-none">
47-
-&gt;
48-
</span>
49-
</h2>
50-
<p className={`m-0 max-w-[30ch] text-sm opacity-50`}>
51-
Find in-depth information about Next.js features and API.
52-
</p>
53-
</a>
54-
55-
<a
56-
href="https://nextjs.org/learn?utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"
57-
className="group rounded-lg border border-transparent px-5 py-4 transition-colors hover:border-gray-300 hover:bg-gray-100 hover:dark:border-neutral-700 hover:dark:bg-neutral-800/30"
58-
target="_blank"
59-
rel="noopener noreferrer"
60-
>
61-
<h2 className={`mb-3 text-2xl font-semibold`}>
62-
Learn{" "}
63-
<span className="inline-block transition-transform group-hover:translate-x-1 motion-reduce:transform-none">
64-
-&gt;
65-
</span>
66-
</h2>
67-
<p className={`m-0 max-w-[30ch] text-sm opacity-50`}>
68-
Learn about Next.js in an interactive course with&nbsp;quizzes!
69-
</p>
70-
</a>
71-
72-
<a
73-
href="https://vercel.com/templates?framework=next.js&utm_source=create-next-app&utm_medium=appdir-template&utm_campaign=create-next-app"
74-
className="group rounded-lg border border-transparent px-5 py-4 transition-colors hover:border-gray-300 hover:bg-gray-100 hover:dark:border-neutral-700 hover:dark:bg-neutral-800/30"
75-
target="_blank"
76-
rel="noopener noreferrer"
77-
>
78-
<h2 className={`mb-3 text-2xl font-semibold`}>
79-
Templates{" "}
80-
<span className="inline-block transition-transform group-hover:translate-x-1 motion-reduce:transform-none">
81-
-&gt;
82-
</span>
83-
</h2>
84-
<p className={`m-0 max-w-[30ch] text-sm opacity-50`}>
85-
Explore starter templates for Next.js.
36+
<>
37+
<Section className="">
38+
<div className="flex flex-col m-auto py-20 text-center items-center justify-center gap-4 bg-indigo-900/10 my-8 rounded-2xl border">
39+
<span className=" px-5 py-1 text-xs font-light border rounded-full border-indigo-900 uppercase">Unofficial</span>
40+
<h1 className="font-bold text-7xl flex text-indigo-900">
41+
Suno AI API
42+
</h1>
43+
<p className="text-indigo-900/80 text-lg">
44+
Deploy your own Suno AI API with just one click.
8645
</p>
87-
</a>
88-
89-
<a
90-
href="https://vercel.com/new?utm_source=create-next-app&utm_medium=appdir-template&utm_campaign=create-next-app"
91-
className="group rounded-lg border border-transparent px-5 py-4 transition-colors hover:border-gray-300 hover:bg-gray-100 hover:dark:border-neutral-700 hover:dark:bg-neutral-800/30"
92-
target="_blank"
93-
rel="noopener noreferrer"
94-
>
95-
<h2 className={`mb-3 text-2xl font-semibold`}>
96-
Deploy{" "}
97-
<span className="inline-block transition-transform group-hover:translate-x-1 motion-reduce:transform-none">
98-
-&gt;
99-
</span>
100-
</h2>
101-
<p className={`m-0 max-w-[30ch] text-sm opacity-50 text-balance`}>
102-
Instantly deploy your Next.js site to a shareable URL with Vercel.
103-
</p>
104-
</a>
105-
</div>
106-
</main>
46+
</div>
47+
48+
</Section>
49+
<Section className="my-10">
50+
<article className="prose lg:prose-lg max-w-3xl border-t pt-10">
51+
<Markdown>
52+
{markdown}
53+
</Markdown>
54+
</article>
55+
</Section>
56+
57+
58+
</>
10759
);
10860
}

tailwind.config.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ const config: Config = {
1515
},
1616
},
1717
},
18-
plugins: [],
18+
plugins: [
19+
require('@tailwindcss/typography'),
20+
],
1921
};
2022
export default config;

0 commit comments

Comments
 (0)