Skip to content

Commit

Permalink
Merge pull request #4194 from serlo/refactor/article-remove-next-import
Browse files Browse the repository at this point in the history
refactor(article): replace frontend link comp
  • Loading branch information
elbotho authored Oct 16, 2024
2 parents 9a0e055 + be4512f commit 67b6921
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion packages/editor/src/plugin/helpers/editor-renderer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export interface PluginStaticRenderer {
export type MathRenderer = ComponentType<MathElement>
export type LinkRenderer = React.FunctionComponent<{
href: string
children: JSX.Element | null
children: JSX.Element | string | null
}>

export interface InitRenderersArgs {
Expand Down
10 changes: 5 additions & 5 deletions packages/editor/src/plugins/article/static.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { editorRenderers } from '@editor/plugin/helpers/editor-renderer'
import {
EditorArticleDocument,
EditorMultimediaDocument,
} from '@editor/types/editor-plugins'
import { Link } from '@serlo/frontend/src/components/content/link'

import { ArticleRenderer } from './renderer'
import { StaticRenderer } from '../../static-renderer/static-renderer'
Expand Down Expand Up @@ -39,6 +39,8 @@ export function ArticleStaticRenderer({
<StaticRenderer document={{ ...introduction, plugin: 'multimedia' }} />
)

const LinkRenderer = editorRenderers.getLinkRenderer()

return (
<ArticleRenderer
introduction={introductionOrNull}
Expand Down Expand Up @@ -73,9 +75,7 @@ export function ArticleStaticRenderer({
<>
{items.map(({ id, title }) => (
<li key={id}>
<a className="serlo-link" href={`/${id}`}>
{title}
</a>
<LinkRenderer href={`/${id}`}>{title}</LinkRenderer>
</li>
))}
</>
Expand All @@ -100,7 +100,7 @@ export function ArticleStaticRenderer({
{sources.map((source) => (
<li key={source.href} className="!mb-0">
{source.href ? (
<Link href={source.href}>{source.title}</Link>
<LinkRenderer href={source.href}>{source.title}</LinkRenderer>
) : (
source.title
)}
Expand Down
2 changes: 1 addition & 1 deletion packages/editor/src/plugins/solution/static.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export function StaticSolutionRenderer({

const prerequisiteElement = hasPrerequisite ? (
<LinkRenderer href={prerequisite.alias ?? `/${prerequisite.id}`}>
<>{prerequisite.title}</>
{prerequisite.title}
</LinkRenderer>
) : null

Expand Down

0 comments on commit 67b6921

Please sign in to comment.