Skip to content

Commit

Permalink
handle ordered lists in rich text and jup share image
Browse files Browse the repository at this point in the history
  • Loading branch information
saml33 committed Jan 30, 2024
1 parent 8665b48 commit 3411e30
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
8 changes: 7 additions & 1 deletion app/components/rich-text/RichText.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ function RichText({ document, currentPrice }: RichTextProps) {
[BLOCKS.HEADING_3]: (node, children) => <H3>{children}</H3>,
[BLOCKS.HEADING_4]: (node, children) => <H4>{children}</H4>,
[BLOCKS.UL_LIST]: (node, children) => <Ul>{children}</Ul>,
[BLOCKS.OL_LIST]: (node, children) => <Ol>{children}</Ol>,
[BLOCKS.LIST_ITEM]: (node) => {
const transformedChildren = documentToReactComponents(node, {
renderNode: {
Expand All @@ -83,7 +84,7 @@ function RichText({ document, currentPrice }: RichTextProps) {
},
})
return (
<li className="font-body text-th-fgd-4 text-lg mb-4 tracking-wider">
<li className="font-body text-th-fgd-3 text-lg mb-4 tracking-wider">
{transformedChildren}
</li>
)
Expand Down Expand Up @@ -141,6 +142,11 @@ const H4 = ({ children }) => <h3 className="mb-1.5 text-lg">{children}</h3>
const Ul = ({ children }) => (
<ul style={{ listStyle: 'outside disc', marginLeft: '16px' }}>{children}</ul>
)
const Ol = ({ children }) => (
<ol style={{ listStyle: 'outside number', marginLeft: '20px' }}>
{children}
</ol>
)
const mangoUrl = 'https://mango.markets'
const A = ({ node, children }) => {
const { data } = node
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion tsconfig.tsbuildinfo

Large diffs are not rendered by default.

0 comments on commit 3411e30

Please sign in to comment.