mirror of
https://github.com/getpaseo/paseo.git
synced 2026-11-10 10:25:03 +00:00
refactor(app): render a release's sections from their own component
This commit is contained in:
@@ -189,18 +189,20 @@ const ReleaseView = memo(function ReleaseView({ release, isCurrent }: ReleaseVie
|
||||
{t(showingAllChanges ? "changelog.hideAllChanges" : "changelog.showAllChanges")}
|
||||
</Button>
|
||||
) : null}
|
||||
{showsSections
|
||||
? keyChangelogSections(release.sections).map(({ key, section }) => (
|
||||
<View key={key} style={styles.section}>
|
||||
{section.title ? <Text style={styles.sectionTitle}>{section.title}</Text> : null}
|
||||
{section.body ? <MarkdownRenderer text={section.body} compact /> : null}
|
||||
</View>
|
||||
))
|
||||
: null}
|
||||
{showsSections ? <ReleaseSections sections={release.sections} /> : null}
|
||||
</View>
|
||||
);
|
||||
});
|
||||
|
||||
function ReleaseSections({ sections }: { sections: readonly ChangelogSection[] }) {
|
||||
return keyChangelogSections(sections).map(({ key, section }) => (
|
||||
<View key={key} style={styles.section}>
|
||||
{section.title ? <Text style={styles.sectionTitle}>{section.title}</Text> : null}
|
||||
{section.body ? <MarkdownRenderer text={section.body} compact /> : null}
|
||||
</View>
|
||||
));
|
||||
}
|
||||
|
||||
/** A release can repeat a section title; the occurrence keeps the key stable. */
|
||||
function keyChangelogSections(
|
||||
sections: readonly ChangelogSection[],
|
||||
|
||||
Reference in New Issue
Block a user