1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-11 00:08:30 +01:00

New docs menu

This commit is contained in:
Alvin Bryan 2024-12-20 14:22:48 +00:00
parent 45035102f4
commit bc55247e9f
No known key found for this signature in database

View File

@ -42,7 +42,23 @@ const addDocsRoutePrefix = ({ from, ...rest }) => {
};
};
const config: Config = {
const getUnleashRepoStars = async () => {
const response = await fetch(
`https://api.github.com/repos/unleash/unleash`,
);
const data = await response.json();
const unleashRepoStars = data.stargazers_count;
const formattedStars =
unleashRepoStars >= 1000
? `${(unleashRepoStars / 1000).toFixed(1)}k`
: unleashRepoStars.toString();
return formattedStars;
};
export default async function createConfigAsync(): Promise<Config> {
const stars = await getUnleashRepoStars();
return {
title: 'Unleash Documentation',
tagline: 'The enterprise ready feature flag service',
url: 'https://docs.getunleash.io',
@ -69,45 +85,30 @@ const config: Config = {
navbar: {
logo: {
alt: 'Unleash logo',
src: 'img/unleash_logo_white.svg',
src: 'https://getunleash.io/logos/unleash_pos.svg',
srcDark: 'img/unleash_logo_white.svg',
href: 'https://www.getunleash.io',
height: '2rem',
},
items: [
{
type: 'doc',
position: 'right',
docId: 'quickstart',
html: '<span class="hide-when-active">Quickstart</span>',
label: 'Product',
href: 'https://www.getunleash.io/enterprise-feature-management-platform',
position: 'left',
},
{
type: 'doc',
position: 'right',
docId: 'welcome',
html: '<span class="hide-when-active">Docs</span>',
label: 'Plans',
href: 'https://www.getunleash.io/plans',
position: 'left',
},
{
type: 'html',
value: '<a href="https://www.getunleash.io/enterprise-feature-management-platform" class="navbar__item navbar__link">Product</a>',
position: 'right',
},
{
type: 'html',
value: '<a href="https://www.getunleash.io/plans" class="navbar__item navbar__link">Plans</a>',
position: 'right',
},
{
type: 'html',
value: '<a href="https://www.getunleash.io/blog" class="navbar__item navbar__link">Blog</a>',
position: 'right',
},
{
type: 'html',
position: 'right',
value: '<span class="navbar-separator"></span>',
label: 'Blog',
href: 'https://www.getunleash.io/blog',
position: 'left',
},
{
type: 'dropdown',
position: 'right',
position: 'left',
html: '<span class="hide-at-small-sizes">Unleash </span>Academy',
to: 'unleash-academy/introduction',
items: [
@ -128,10 +129,9 @@ const config: Config = {
},
],
},
{
type: 'dropdown',
position: 'right',
position: 'left',
html: '<span class="hide-at-small-sizes">Unleash </span>Certification',
items: [
{
@ -149,25 +149,31 @@ const config: Config = {
],
},
{
type: 'html',
type: 'search',
position: 'right',
value: '<span class="navbar-separator"></span>',
},
{
type: 'html',
value: '<a href="https://app.unleash-hosted.com/sign-in" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">Sign in</a>',
label: 'Sign in',
href: 'https://app.unleash-hosted.com/sign-in',
position: 'right',
},
{
type: 'html',
position: 'right',
value: '<span class="navbar-separator"></span>',
value: `<a
href="https://github.com/Unleash/unleash"
aria-label="Unleash GitHub repository"
class="header-github-link"
>
<svg width="28px" height="28px" viewBox="0 0 21 20"><path fill="currentColor" d="M10.537 1.833c-4.602 0-8.333 3.544-8.333 7.917 0 4.373 3.73 7.917 8.333 7.917s8.334-3.544 8.334-7.917c0-4.373-3.73-7.917-8.334-7.917Zm0 1.584c3.676 0 6.667 2.842 6.667 6.333 0 .371-.039.736-.104 1.089a4.345 4.345 0 0 0-.86-.1 6.375 6.375 0 0 0-.859.075 2.76 2.76 0 0 0 .156-.89c0-.761-.39-1.47-1.015-2.054.172-.61.342-1.655-.104-2.078a2.762 2.762 0 0 0-2.084.94 5.684 5.684 0 0 0-1.276-.149 5.91 5.91 0 0 0-1.64.248l.156-.124s-.733-.965-2.083-.965c-.472.452-.258 1.596-.079 2.177-.638.579-1.041 1.262-1.041 2.004 0 .26.065.507.13.742-.231-.024-1.064-.098-1.406-.098-.303 0-.772.067-1.146.148a5.912 5.912 0 0 1-.078-.965c0-3.491 2.991-6.333 6.666-6.333Zm-5.442 7.347c.329 0 1.328.112 1.458.124.016.043.033.084.052.124-.358-.031-1.051-.078-1.51-.025-.306.034-.697.14-1.042.223-.026-.1-.059-.195-.078-.297.365-.074.843-.149 1.12-.149Zm11.146.174c.332.003.634.055.833.098-.01.053-.04.096-.052.149a5.042 5.042 0 0 0-.964-.124c-.195-.003-.508.007-.781.025.013-.025.016-.05.026-.074.283-.037.645-.078.938-.074Zm-10.625.222c.468.003.908.034 1.093.05.437.773 1.319 1.345 2.683 1.583a2.621 2.621 0 0 0-.86.718c-.195.015-.4.024-.599.024-.58 0-.94-.492-1.25-.915-.312-.424-.696-.47-.911-.495-.218-.025-.293.093-.182.173.634.464.862 1.015 1.12 1.51.23.445.715.692 1.25.692h.103a1.33 1.33 0 0 0-.026.248v.865c-1.923-.739-3.388-2.3-3.932-4.23.342-.08.726-.164 1.016-.198.133-.016.302-.028.495-.025Zm10.442.1c.375.008.707.076.912.123-.46 1.639-1.592 3.003-3.1 3.835v-.47c0-.675-.56-1.54-1.353-1.955 1.318-.229 2.177-.776 2.63-1.51.316-.02.687-.03.911-.024Zm-5.104 3.24a.41.41 0 0 1 .417.396v1.138c-.274.034-.55.05-.834.05v-1.188a.41.41 0 0 1 .417-.396Zm-1.667.792a.41.41 0 0 1 .417.396v.346a7.438 7.438 0 0 1-.833-.148v-.198a.41.41 0 0 1 .416-.396Zm3.334 0c.202 0 .377.139.416.321-.27.106-.546.201-.833.273v-.198a.41.41 0 0 1 .417-.396Z"/></svg>
<span>Stars</span>
<strong>${stars}</strong>
</a>`,
},
{
href: 'https://github.com/Unleash/unleash',
label: 'Get a demo',
href: 'https://www.getunleash.io/plans/enterprise',
position: 'right',
className: 'header-github-link',
'aria-label': 'Unleash GitHub repository',
},
],
},
@ -224,8 +230,48 @@ const config: Config = {
},
],
footer: {
style: 'dark',
links: [
{
title: 'Feature Flag use cases',
items: [
{
label: 'Secure, scalable feature flags',
to: 'https://getunleash.io/TBD',
},
{
label: 'Rollbacks',
to: 'https://getunleash.io/TBD',
},
{
label: 'Fedramp, SOC2, ISO2700 compliance',
to: 'https://getunleash.io/TBD',
},
{
label: 'Progressive or gradual rollouts',
to: 'https://getunleash.io/TBD',
},
{
label: 'Trunk-based development',
to: 'https://getunleash.io/TBD',
},
{
label: 'Software kill switches',
to: 'https://getunleash.io/TBD',
},
{
label: 'A/B testing',
to: 'https://getunleash.io/TBD',
},
{
label: 'Feature Management',
to: 'https://getunleash.io/TBD',
},
{
label: 'Canary releases',
to: 'https://getunleash.io/TBD',
},
],
},
{
title: 'Product',
items: [
@ -269,11 +315,6 @@ const config: Config = {
],
},
],
copyright: `Copyright © ${new Date().getFullYear()} Unleash. Built with Docusaurus.`,
logo: {
src: 'img/logo.svg',
alt: 'Unleash logo',
},
},
image: 'img/logo.png',
imageZoom: {
@ -311,7 +352,8 @@ const config: Config = {
lastmod: 'date',
priority: 0.5,
createSitemapItems: async (params) => {
const { defaultCreateSitemapItems, ...rest } = params;
const { defaultCreateSitemapItems, ...rest } =
params;
const items = await defaultCreateSitemapItems(rest);
return items.filter(
(item) => !item.url.includes('/page/'),
@ -414,7 +456,10 @@ const config: Config = {
to: '/reference/integrations',
},
{
from: ['/addons/datadog', '/reference/addons/datadog'],
from: [
'/addons/datadog',
'/reference/addons/datadog',
],
to: '/reference/integrations/datadog',
},
{
@ -433,7 +478,10 @@ const config: Config = {
to: '/reference/integrations/teams',
},
{
from: ['/addons/webhook', '/reference/addons/webhook'],
from: [
'/addons/webhook',
'/reference/addons/webhook',
],
to: '/reference/integrations/webhook',
},
{
@ -441,7 +489,10 @@ const config: Config = {
to: '/how-to/how-to-send-feature-updates-to-slack-deprecated',
},
{
from: ['/integrations/integrations', '/integrations'],
from: [
'/integrations/integrations',
'/integrations',
],
to: '/reference/integrations',
},
{
@ -666,7 +717,10 @@ const config: Config = {
to: '/',
},
{
from: ['/topics/feature-flags/tutorials', '/tutorials'],
from: [
'/topics/feature-flags/tutorials',
'/tutorials',
],
to: '/feature-flag-tutorials',
},
{
@ -914,10 +968,10 @@ const config: Config = {
'data-project-color': '#1A4049',
'data-project-logo':
'https://cdn.getunleash.io/uploads/2022/05/logo.png',
'data-button-position-bottom': '80px',
defer: true,
},
],
clientModules: ['./global.js'],
};
export default config;
}