diff --git a/generator/templates/ApiTemplate.ts b/generator/templates/ApiTemplate.ts index ad1c6380..cd3d5819 100644 --- a/generator/templates/ApiTemplate.ts +++ b/generator/templates/ApiTemplate.ts @@ -4,7 +4,7 @@ export const title = '<%- tag %>' <% operations.forEach(function(operation){ %> -## <%- operation.summary %> <% if(operation.deprecated) { %> <% } %><% if(operation["x-cloud-only"]) { %> <% } %><% if(operation["x-experimental"]) { %> <% } %> {{ tag: '<%- operation.operation.toUpperCase() %>' , label: '<%- operation.path %>' }} +## <%- operation.summary %> <% if(operation.deprecated) { %> <% } %><% if(operation["x-cloud-only"]) { %> <% } %><% if(operation["x-experimental"]) { %> <% } %> {{ tag: '<%- operation.operation.toUpperCase() %>' , label: '<%- operation.path %>' }} diff --git a/src/components/Badge.jsx b/src/components/Badge.jsx index cc200558..1149feed 100644 --- a/src/components/Badge.jsx +++ b/src/components/Badge.jsx @@ -1,26 +1,81 @@ -export function Badge({ status, text }) { +import { useState } from 'react'; + +export function Badge({ status, text, hoverText }) { + const [isHovered, setIsHovered] = useState(false); + const getStatusStyles = (status) => { switch (status) { case 'info': - // Never tested colors - return 'bg-blue-300/30 text-blue-400 dark:bg-blue-400/10 dark:text-blue-400'; + return 'text-blue-400'; case 'warning': - return 'bg-orange-300/30 text-orange-400 dark:bg-yellow-600/10 dark:text-yellow-600'; + return 'text-yellow-600'; case 'error': - // Never tested colors - return 'bg-red-300/30 text-red-400 dark:bg-red-400/10 dark:text-red-400'; + return 'text-red-400'; case 'cloud-only': - return 'bg-orange-200/50 text-orange-400 dark:bg-orange-600/20 dark:text-orange-400'; + return 'text-orange-400'; case 'experimental': - return 'bg-teal-200/50 text-teal-400 dark:bg-teal-500/15 dark:text-teal-400'; + return 'text-teal-400'; default: - return 'bg-gray-500/30 text-gray-600 dark:bg-gray-400/10 dark:text-gray-400'; + return 'text-gray-400'; } }; - const baseStyle = 'rounded-md py-0.5 px-2 text-sm'; + const getStatusBorder = (status) => { + switch (status) { + case 'info': + return 'border-blue-400'; + case 'warning': + return 'border-yellow-600'; + case 'error': + return 'border-red-400'; + case 'cloud-only': + return 'border-orange-400'; + case 'experimental': + return 'border-teal-400'; + default: + return 'border-gray-400'; + } + }; - const statusStyle = getStatusStyles(status); + const getBadgeBg = (status) => { + switch (status) { + case 'info': + return 'bg-blue-300/30 dark:bg-blue-400/10'; + case 'warning': + return 'bg-orange-300/30 dark:bg-yellow-600/10'; + case 'error': + return 'bg-red-300/30 dark:bg-red-400/10'; + case 'cloud-only': + return 'bg-orange-200/50 dark:bg-orange-600/20'; + case 'experimental': + return 'bg-teal-200/50 dark:bg-teal-500/15'; + default: + return 'bg-gray-500/30 dark:bg-gray-400/10'; + } + }; - return {text}; -} + const baseStyle = 'relative inline-block rounded-md py-0.5 px-2 text-sm'; + const textColor = getStatusStyles(status); + const bgColor = getBadgeBg(status); + const borderStyle = getStatusBorder(status); + + return ( + setIsHovered(true)} + onMouseLeave={() => setIsHovered(false)} + > + {text} + {hoverText && isHovered && ( +
+ {hoverText} +
+ )} +
+ ); +} \ No newline at end of file diff --git a/src/pages/ipa/resources/events.mdx b/src/pages/ipa/resources/events.mdx index 2177d2f6..0c9182e3 100644 --- a/src/pages/ipa/resources/events.mdx +++ b/src/pages/ipa/resources/events.mdx @@ -211,7 +211,7 @@ echo $response; --- -## List all Network Traffic Events {{ tag: 'GET' , label: '/api/events/network-traffic' }} +## List all Network Traffic Events {{ tag: 'GET' , label: '/api/events/network-traffic' }} diff --git a/src/pages/ipa/resources/ingress-ports.mdx b/src/pages/ipa/resources/ingress-ports.mdx index a1687d40..3205bd46 100644 --- a/src/pages/ipa/resources/ingress-ports.mdx +++ b/src/pages/ipa/resources/ingress-ports.mdx @@ -2,7 +2,7 @@ export const title = 'Ingress Ports' -## List all Port Allocations {{ tag: 'GET' , label: '/api/peers/{peerId}/ingress/ports' }} +## List all Port Allocations {{ tag: 'GET' , label: '/api/peers/{peerId}/ingress/ports' }} @@ -226,7 +226,7 @@ echo $response; --- -## Create a Port Allocation {{ tag: 'POST' , label: '/api/peers/{peerId}/ingress/ports' }} +## Create a Port Allocation {{ tag: 'POST' , label: '/api/peers/{peerId}/ingress/ports' }} @@ -614,7 +614,7 @@ echo $response; --- -## Retrieve a Port Allocation {{ tag: 'GET' , label: '/api/peers/{peerId}/ingress/ports/{allocationId}' }} +## Retrieve a Port Allocation {{ tag: 'GET' , label: '/api/peers/{peerId}/ingress/ports/{allocationId}' }} @@ -830,7 +830,7 @@ echo $response; --- -## Update a Port Allocation {{ tag: 'PUT' , label: '/api/peers/{peerId}/ingress/ports/{allocationId}' }} +## Update a Port Allocation {{ tag: 'PUT' , label: '/api/peers/{peerId}/ingress/ports/{allocationId}' }} @@ -1222,7 +1222,7 @@ echo $response; --- -## Delete a Port Allocation {{ tag: 'DELETE' , label: '/api/peers/{peerId}/ingress/ports/{allocationId}' }} +## Delete a Port Allocation {{ tag: 'DELETE' , label: '/api/peers/{peerId}/ingress/ports/{allocationId}' }} @@ -1390,7 +1390,7 @@ echo $response; --- -## List all Ingress Peers {{ tag: 'GET' , label: '/api/ingress/peers' }} +## List all Ingress Peers {{ tag: 'GET' , label: '/api/ingress/peers' }} @@ -1590,7 +1590,7 @@ echo $response; --- -## Create a Ingress Peer {{ tag: 'POST' , label: '/api/ingress/peers' }} +## Create a Ingress Peer {{ tag: 'POST' , label: '/api/ingress/peers' }} @@ -1848,7 +1848,7 @@ echo $response; --- -## Retrieve a Ingress Peer {{ tag: 'GET' , label: '/api/ingress/peers/{ingressPeerId}' }} +## Retrieve a Ingress Peer {{ tag: 'GET' , label: '/api/ingress/peers/{ingressPeerId}' }} @@ -2052,7 +2052,7 @@ echo $response; --- -## Update a Ingress Peer {{ tag: 'PUT' , label: '/api/ingress/peers/{ingressPeerId}' }} +## Update a Ingress Peer {{ tag: 'PUT' , label: '/api/ingress/peers/{ingressPeerId}' }} @@ -2306,7 +2306,7 @@ echo $response; --- -## Delete a Ingress Peer {{ tag: 'DELETE' , label: '/api/ingress/peers/{ingressPeerId}' }} +## Delete a Ingress Peer {{ tag: 'DELETE' , label: '/api/ingress/peers/{ingressPeerId}' }}