|
1 | | -import { SyntheticEvent, useState } from 'react' |
| 1 | +import { useState } from 'react' |
2 | 2 | import cx from 'classnames' |
3 | | -import { ChevronDownIcon } from '@primer/octicons-react' |
| 3 | +import dayjs from 'dayjs' |
4 | 4 | import { GHAEReleaseNotePatch } from './GHAEReleaseNotePatch' |
5 | 5 | import { GHAEReleaseNotesContextT } from './types' |
6 | 6 | import { MarkdownContent } from 'components/ui/MarkdownContent' |
@@ -29,6 +29,7 @@ export function GHAEReleaseNotes({ context }: GitHubAEProps) { |
29 | 29 | <GHAEReleaseNotePatch |
30 | 30 | key={patch.version} |
31 | 31 | patch={patch} |
| 32 | + currentVersion={currentVersion} |
32 | 33 | didEnterView={() => setFocusedPatch(patch.version)} |
33 | 34 | /> |
34 | 35 | ) |
@@ -69,50 +70,26 @@ const CollapsibleReleaseSection = ({ |
69 | 70 | release: GHAEReleaseNotesContextT['releases'][0] |
70 | 71 | focusedPatch: string |
71 | 72 | }) => { |
72 | | - const defaultIsOpen = true |
73 | | - const [isOpen, setIsOpen] = useState(defaultIsOpen) |
74 | | - |
75 | | - const onToggle = (e: SyntheticEvent) => { |
76 | | - const newIsOpen = (e.target as HTMLDetailsElement).open |
77 | | - setIsOpen(newIsOpen) |
78 | | - } |
79 | | - |
80 | 73 | return ( |
81 | 74 | <li key={release.version} className="border-bottom"> |
82 | | - <details |
83 | | - className="my-0 details-reset release-notes-version-picker" |
84 | | - aria-current="page" |
85 | | - open={defaultIsOpen} |
86 | | - onToggle={onToggle} |
87 | | - > |
88 | | - <summary className="px-3 py-4 my-0 d-flex flex-items-center flex-justify-between outline-none"> |
89 | | - {release.version} |
90 | | - <div className="d-flex"> |
91 | | - <span className="color-fg-muted text-small text-normal mr-1"> |
92 | | - {release.patches.length} {release.patches.length === 1 ? 'release' : 'releases'} |
93 | | - </span> |
94 | | - <ChevronDownIcon className={isOpen ? 'rotate-180' : ''} /> |
95 | | - </div> |
96 | | - </summary> |
97 | | - <ul className="color-bg-subtle border-top list-style-none py-4 px-0 my-0"> |
98 | | - {release.patches.map((patch) => { |
99 | | - const isActive = patch.version === focusedPatch |
100 | | - return ( |
101 | | - <li |
102 | | - key={patch.version} |
103 | | - className={cx('px-3 my-0 py-1', isActive && 'color-bg-accent')} |
| 75 | + <ul className="list-style-none py-4 px-0 my-0"> |
| 76 | + {release.patches.map((patch) => { |
| 77 | + const isActive = patch.release === focusedPatch |
| 78 | + return ( |
| 79 | + <li key={patch.release} className={cx('px-3 my-0', isActive && 'color-bg-accent')}> |
| 80 | + <a |
| 81 | + href={`#${patch.release}`} |
| 82 | + className="d-flex flex-items-center flex-justify-between" |
104 | 83 | > |
105 | | - <a |
106 | | - href={`#${patch.date}`} |
107 | | - className="d-flex flex-items-center flex-justify-between" |
108 | | - > |
109 | | - {patch.friendlyDate} |
110 | | - </a> |
111 | | - </li> |
112 | | - ) |
113 | | - })} |
114 | | - </ul> |
115 | | - </details> |
| 84 | + {patch.release} |
| 85 | + <span className="color-fg-muted text-mono text-small text-normal"> |
| 86 | + {dayjs(patch.date).format('MMMM DD, YYYY')} |
| 87 | + </span> |
| 88 | + </a> |
| 89 | + </li> |
| 90 | + ) |
| 91 | + })} |
| 92 | + </ul> |
116 | 93 | </li> |
117 | 94 | ) |
118 | 95 | } |
0 commit comments