-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathfootnoteDefinition.tsx
More file actions
43 lines (39 loc) · 1.26 KB
/
footnoteDefinition.tsx
File metadata and controls
43 lines (39 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import { BlockContent, DefinitionContent, FootnoteDefinition } from "mdast";
import { Fragment, ReactNode } from "react";
import { Text, View } from "react-native";
import { useMarkdownContext } from "../context";
import { mergeStyles } from "../themes/themes";
import { RendererArgs } from "./renderers";
export const FootnoteDefinitionRenderer = ({
node,
}: RendererArgs<FootnoteDefinition>): ReactNode => {
const { renderers, styles } = useMarkdownContext();
const { BlockContentRenderer, DefinitionContentRenderer } = renderers;
const mergedStyles = mergeStyles(styles.paragraph, {
fontWeight: "500",
textDecorationLine: "underline",
});
return (
<View style={{ flexDirection: "row" }}>
<View>
<Text style={mergedStyles}>[{node.identifier}]: </Text>
</View>
<View style={{ flex: 1 }}>
{node.children.map((child, idx) => (
<Fragment key={idx}>
<BlockContentRenderer
node={child as BlockContent}
index={idx}
parent={node}
/>
<DefinitionContentRenderer
node={child as DefinitionContent}
index={idx}
parent={node}
/>
</Fragment>
))}
</View>
</View>
);
};