mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-12 07:17:34 +00:00
docs: strikethrough deprecated APIs (#9740)
# Which Problems Are Solved The docs overview pages and navs don't visually distinguish between deprecated and GA APIs. This makes it hard to find the right methods for the job already. As we are implementing the resource API and continously deprecate obsolete APIs, this only gets worse. # How the Problems Are Solved The UI items in docs overview pages are striked through and pushed to the bottom of the list. This applies to side navs as well as card lists. For example, [see management user methods](https://docs-git-strikethrough-deprecated-apis-zitadel.vercel.app/docs/apis/resources/mgmt/users):  A method is considered deprecated if it has this option set in the protos rpc definition: ```protobuf option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = { deprecated: true; } ``` # Additional Changes None # Additional Context - Relates to #9680 --------- Co-authored-by: David Skewis <david@zitadel.com>
This commit is contained in:
29
docs/src/utils/deprecated-items.js
Normal file
29
docs/src/utils/deprecated-items.js
Normal file
@@ -0,0 +1,29 @@
|
||||
import React from "react";
|
||||
|
||||
// This function changes a ListComponents input properties.
|
||||
// Deprecated items are pushed to the bottom of the list and its labels are given the CSS class zitadel-lifecycle-deprecated.
|
||||
// They are styled in docs/src/css/custom.css.
|
||||
export default function (props) {
|
||||
const { items = [], ...rest } = props;
|
||||
if (!Array.isArray(items)) {
|
||||
// Do nothing if items is not an array
|
||||
return props;
|
||||
}
|
||||
const withDeprecated = [...items].map(({className, label, ...itemRest}) => {
|
||||
const zitadelLifecycleDeprecated = className?.indexOf('menu__list-item--deprecated') > -1
|
||||
const wrappedLabel = <span className={zitadelLifecycleDeprecated ? "zitadel-lifecycle-deprecated" : undefined}>{label}</span>
|
||||
return {
|
||||
zitadelLifecycleDeprecated: zitadelLifecycleDeprecated,
|
||||
...itemRest,
|
||||
className,
|
||||
label: wrappedLabel,
|
||||
};
|
||||
});
|
||||
const sortedItems = [...withDeprecated].sort((a, b) => {
|
||||
return a.zitadelLifecycleDeprecated - b.zitadelLifecycleDeprecated;
|
||||
});
|
||||
return {
|
||||
...rest,
|
||||
items: sortedItems,
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user