From f1984080a9c21a603eb004262445cf66edee353e Mon Sep 17 00:00:00 2001 From: Thomas Heartman Date: Fri, 27 Jan 2023 08:33:19 +0100 Subject: [PATCH] docs: add next.js docs (#3002) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## 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 🙌🏼 --- website/readme-fns.js | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/website/readme-fns.js b/website/readme-fns.js index 0968a7ae01..df798e58b5 100644 --- a/website/readme-fns.js +++ b/website/readme-fns.js @@ -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': { @@ -71,6 +71,10 @@ const clientSideSdks = { 'proxy-client-vue': { sidebarName: 'Vue', }, + 'unleash-client-nextjs': { + sidebarName: 'Next.js', + slugName: 'next-js', + }, }; const allSdks = () => { @@ -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:///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:///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`,