Skip to content

Commit

Permalink
docs: add next.js docs (#3002)
Browse files Browse the repository at this point in the history
## What

This change adds the next.js sdk's readme to the client-side SDKs
section in the docs.

## Why

Because we have a new and official SDK 馃檶馃徏
  • Loading branch information
thomasheartman committed Jan 27, 2023
1 parent d8a250d commit f198408
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions website/readme-fns.js
Expand Up @@ -14,8 +14,8 @@
//
// type ReadmeData = Readme & { repoUrl: string };

const CLIENT_SIDE_SDK = "client-side"
const SERVER_SIDE_SDK = "server-side"
const CLIENT_SIDE_SDK = 'client-side';
const SERVER_SIDE_SDK = 'server-side';

const serverSideSdks = {
'unleash-client-go': {
Expand Down Expand Up @@ -71,6 +71,10 @@ const clientSideSdks = {
'proxy-client-vue': {
sidebarName: 'Vue',
},
'unleash-client-nextjs': {
sidebarName: 'Next.js',
slugName: 'next-js',
},
};

const allSdks = () => {
Expand Down Expand Up @@ -158,16 +162,14 @@ const modifyContent = (filename, content) => {

const getConnectionTip = (sdkType) => {
switch (sdkType) {
case CLIENT_SIDE_SDK: return `To connect this SDK to Unleash, you'll need to use either
- the [Unleash front-end API](/reference/front-end-api) (released in Unleash 4.16) ([how do I create an API token?](/how-to/how-to-create-api-tokens.mdx))
- the [Unleash proxy](/reference/unleash-proxy) ([how do I create client keys?](/reference/api-tokens-and-client-keys#proxy-client-keys))
This SDK **cannot** connect to the regular (server-side) \`client\` API.`
case CLIENT_SIDE_SDK:
return `To connect to Unleash from a client-side context, you'll need to use the [Unleash front-end API](/reference/front-end-api) ([how do I create an API token?](/how-to/how-to-create-api-tokens.mdx)) or the [Unleash proxy](/reference/unleash-proxy) ([how do I create client keys?](/reference/api-tokens-and-client-keys#proxy-client-keys)).`;

case SERVER_SIDE_SDK:
default: return `To connect to Unleash, you'll need your Unleash API url (e.g. \`https://<your-unleash>/api\`) and a [server-side API token](/reference/api-tokens-and-client-keys.mdx#client-tokens) ([how do I create an API token?](/how-to/how-to-create-api-tokens.mdx)).`
default:
return `To connect to Unleash, you'll need your Unleash API url (e.g. \`https://<your-unleash>/api\`) and a [server-side API token](/reference/api-tokens-and-client-keys.mdx#client-tokens) ([how do I create an API token?](/how-to/how-to-create-api-tokens.mdx)).`;
}
}
};

return {
filename: `${sdk.type}/${sdk.slugName}.md`,
Expand Down

0 comments on commit f198408

Please sign in to comment.