From ad40e867965cd4d73cf086f27e2074c150eb8cad Mon Sep 17 00:00:00 2001 From: Robert Sese Date: Wed, 3 Nov 2021 17:47:55 -0500 Subject: [PATCH] Add release notes label and heading colors (#22585) --- components/release-notes/PatchNotes.tsx | 37 +++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/components/release-notes/PatchNotes.tsx b/components/release-notes/PatchNotes.tsx index 08175f5099..4a311c986e 100644 --- a/components/release-notes/PatchNotes.tsx +++ b/components/release-notes/PatchNotes.tsx @@ -16,6 +16,26 @@ const SectionToLabelMap: Record = { backups: 'Backups', } +const LabelColorMap = { + features: 'color-bg-success-emphasis', + bugs: 'color-bg-attention-emphasis', + known_issues: 'color-bg-accent-emphasis', + security_fixes: 'color-bg-sponsors-emphasis', + changes: 'color-bg-success-emphasis', + deprecations: 'color-bg-done-emphasis', + backups: 'color-bg-severe-emphasis', +} + +const HeadingColorMap = { + features: 'color-fg-success', + bugs: 'color-fg-attention', + known_issues: 'color-fg-accent', + security_fixes: 'color-fg-sponsors', + changes: 'color-fg-success', + deprecations: 'color-fg-done', + backups: 'color-fg-severe', +} + type Props = { patch: ReleaseNotePatch withReleaseNoteLabel?: boolean @@ -25,6 +45,10 @@ export function PatchNotes({ patch, withReleaseNoteLabel }: Props) { <> {Object.entries(patch.sections).map(([key, sectionItems], i, arr) => { const isLast = i === arr.length - 1 + const primaryLabelColor = + LabelColorMap[key as keyof typeof LabelColorMap] || LabelColorMap.features + const primaryHeadingColor = + HeadingColorMap[key as keyof typeof HeadingColorMap] || HeadingColorMap.features return (
{withReleaseNoteLabel && (
- + {SectionToLabelMap[key] || 'INVALID SECTION'}
@@ -52,7 +81,11 @@ export function PatchNotes({ patch, withReleaseNoteLabel }: Props) {

{item.heading}