Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(app): modify the text style in the software update modal #13628

Merged
merged 1 commit into from
Sep 22, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion app/src/molecules/ReleaseNotes/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,21 @@ import * as React from 'react'
import remark from 'remark'
import reactRenderer from 'remark-react'
import styles from './styles.css'

import { StyledText } from '../../atoms/text'
export interface ReleaseNotesProps {
source?: string | null
}

// ToDo (kk:09/22/2023) This component should be updated in the future
// since the package we use hasn't been updated more than 2 years.
// Also the creator recommends users to replace remark-react with rehype-react.
const renderer = remark().use(reactRenderer, {
remarkReactComponents: {
div: React.Fragment,
h2: HeaderText,
ul: React.Fragment,
li: ParagraphText,
p: ParagraphText,
a: ExternalLink,
},
})
Expand All @@ -19,6 +26,7 @@ const DEFAULT_RELEASE_NOTES = 'We recommend upgrading to the latest version.'
export function ReleaseNotes(props: ReleaseNotesProps): JSX.Element {
const { source } = props

console.log(DEFAULT_RELEASE_NOTES)
return (
<div className={styles.release_notes}>
{source != null ? (
Expand All @@ -33,3 +41,11 @@ export function ReleaseNotes(props: ReleaseNotesProps): JSX.Element {
function ExternalLink(props: JSX.IntrinsicAttributes): JSX.Element {
return <a {...props} target="_blank" rel="noopener noreferrer" />
}

function ParagraphText(props: JSX.IntrinsicAttributes): JSX.Element {
return <StyledText {...props} as="p" />
}

function HeaderText(props: JSX.IntrinsicAttributes): JSX.Element {
return <StyledText {...props} as="h3" />
}