import { Fragment } from 'react' import cx from 'classnames' import slugger from 'github-slugger' import { ReleaseNotePatch } from './types' import { Link } from 'components/Link' import styles from './PatchNotes.module.scss' const SectionToLabelMap: Record = { features: 'Features', bugs: 'Bug fixes', known_issues: 'Known issues', security_fixes: 'Security fixes', changes: 'Changes', deprecations: 'Deprecations', backups: 'Backups', } const ColorMap = { features: 'var(--color-auto-green-5)', bugs: 'var(--color-auto-yellow-5)', known_issues: 'var(--color-auto-blue-5)', security_fixes: 'var(--color-auto-pink-5)', changes: 'var(--color-auto-green-5)', deprecations: 'var(--color-auto-purple-5)', backups: 'var(--color-auto-orange-5)', } type Props = { patch: ReleaseNotePatch withReleaseNoteLabel?: boolean } export function PatchNotes({ patch, withReleaseNoteLabel }: Props) { return ( <> {Object.entries(patch.sections).map(([key, sectionItems], i, arr) => { const isLast = i === arr.length - 1 const primaryColor = ColorMap[key as keyof typeof ColorMap] || ColorMap.features return (
{withReleaseNoteLabel && (
{SectionToLabelMap[key] || 'INVALID SECTION'}
)}
) })} ) }