Skip to content

Commit 16c5cf1

Browse files
authored
DEV: commands: graphically tag deprecated commands (redis#2235)
1 parent c1dce94 commit 16c5cf1

File tree

3 files changed

+114
-6
lines changed

3 files changed

+114
-6
lines changed

assets/css/index.css

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1531,6 +1531,100 @@ a[href*="#no-click"], img[src*="#no-click"] {
15311531
@apply bg-redis-pen-200 font-semibold;
15321532
}
15331533

1534+
/* Deprecated Command Styles */
1535+
.deprecated-badge {
1536+
display: inline-flex !important;
1537+
align-items: center !important;
1538+
padding: 0.25rem 0.5rem !important;
1539+
font-size: 0.75rem !important;
1540+
font-weight: 700 !important;
1541+
background-color: rgb(220, 255, 30) !important;
1542+
color: #000000 !important;
1543+
border-radius: 9999px !important;
1544+
border: none !important;
1545+
flex-shrink: 0 !important;
1546+
}
1547+
1548+
.deprecated-tooltip {
1549+
position: absolute !important;
1550+
z-index: 9999 !important;
1551+
padding: 0.5rem 0.75rem !important;
1552+
font-size: 0.875rem !important;
1553+
font-weight: 500 !important;
1554+
color: white !important;
1555+
background-color: #111827 !important;
1556+
border-radius: 0.5rem !important;
1557+
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06) !important;
1558+
opacity: 0 !important;
1559+
visibility: hidden !important;
1560+
transition: opacity 300ms ease-in-out !important;
1561+
pointer-events: none !important;
1562+
white-space: nowrap !important;
1563+
bottom: calc(100% + 8px) !important;
1564+
left: 50% !important;
1565+
transform: translateX(-50%) !important;
1566+
max-width: 250px !important;
1567+
white-space: normal !important;
1568+
word-wrap: break-word !important;
1569+
}
1570+
1571+
/* Adjust tooltip position when near right edge */
1572+
.deprecated-tooltip-trigger:nth-last-child(-n+2) .deprecated-tooltip,
1573+
.deprecated-tooltip-trigger:last-child .deprecated-tooltip {
1574+
left: auto !important;
1575+
right: 0 !important;
1576+
transform: none !important;
1577+
}
1578+
1579+
/* Adjust tooltip position when near left edge */
1580+
.deprecated-tooltip-trigger:nth-child(-n+2) .deprecated-tooltip,
1581+
.deprecated-tooltip-trigger:first-child .deprecated-tooltip {
1582+
left: 0 !important;
1583+
right: auto !important;
1584+
transform: none !important;
1585+
}
1586+
1587+
.deprecated-tooltip::before {
1588+
content: '' !important;
1589+
position: absolute !important;
1590+
top: 100% !important;
1591+
left: 50% !important;
1592+
transform: translateX(-50%) !important;
1593+
width: 0 !important;
1594+
height: 0 !important;
1595+
border-left: 5px solid transparent !important;
1596+
border-right: 5px solid transparent !important;
1597+
border-top: 5px solid #111827 !important;
1598+
}
1599+
1600+
.deprecated-tooltip-trigger {
1601+
position: relative !important;
1602+
display: inline-flex !important;
1603+
z-index: 10 !important;
1604+
}
1605+
1606+
.deprecated-tooltip-trigger:hover .deprecated-tooltip {
1607+
opacity: 1 !important;
1608+
visibility: visible !important;
1609+
}
1610+
1611+
.command-title-deprecated {
1612+
display: flex !important;
1613+
align-items: center !important;
1614+
gap: 0.5rem !important;
1615+
flex-wrap: nowrap !important;
1616+
}
1617+
1618+
.command-title-deprecated .truncate {
1619+
flex: 1 1 0% !important;
1620+
min-width: 0 !important;
1621+
}
1622+
1623+
/* Fix alignment on individual command pages */
1624+
.prose h1.command-name .command-title-deprecated {
1625+
align-items: center !important;
1626+
}
1627+
15341628
/* Utility Classes */
15351629
.agent-builder-hidden {
15361630
display: none !important;

layouts/commands/list.html

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,20 @@ <h1>Commands</h1>
111111
data-version
112112
data-top
113113
>
114-
<h1 class="truncate font-mono font-medium text-lg mb-1.5 px-6">
115-
{{ .Title }}
114+
<h1 class="font-mono font-medium text-lg mb-1.5 px-6">
115+
<div class="command-title-deprecated">
116+
<span class="truncate">{{ .Title }}</span>
117+
{{ if (and (isset .Params "doc_flags") (in .Params.doc_flags "deprecated")) }}
118+
<div class="deprecated-tooltip-trigger">
119+
<span class="deprecated-badge">Deprecated</span>
120+
{{ if (isset .Params "replaced_by") }}
121+
<div class="deprecated-tooltip">
122+
Use {{ .Params.replaced_by | markdownify | plainify }} instead
123+
</div>
124+
{{ end }}
125+
</div>
126+
{{ end }}
127+
</div>
116128
</h1>
117129
<p class="px-6">
118130
{{ .Params.summary }}

layouts/commands/single.html

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,12 @@
1212
{{ partial "breadcrumbs" . }}
1313
<section class="prose w-full py-12">
1414
<h1 class="command-name">
15-
{{- .Title }}
16-
{{- if (isset .Params "deprecated_since") }}
17-
<span class="text-base">(deprecated)</span>
18-
{{- end }}
15+
<div class="command-title-deprecated">
16+
{{- .Title }}
17+
{{- if (and (isset .Params "doc_flags") (in .Params.doc_flags "deprecated")) }}
18+
<span class="deprecated-badge">Deprecated</span>
19+
{{- end }}
20+
</div>
1921
</h1>
2022
{{ if (isset .Params "deprecated_since") }}
2123
<div class="border-l-8 pl-4">

0 commit comments

Comments
 (0)