-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- make the text list a `ul` based list with bullets - and fix the accordion style overrieds (via `sx` prop)
- Loading branch information
1 parent
4021dd5
commit 7757d00
Showing
3 changed files
with
24 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,29 @@ | ||
import { List, ListItemText, ListItemTextProps, ListProps } from '@mui/material' | ||
import { Typography, styled } from '@mui/material' | ||
import { SpanFromMd } from './SpanFromMd' | ||
import { mergeSxProps } from '../utils' | ||
import { ComponentProps } from 'react' | ||
|
||
|
||
const UonrderedList = styled('ul')({ | ||
|
||
}) | ||
|
||
type ListFromMdProps = { | ||
/** list of strings with markdown */ | ||
items: string[] | ||
ItemProps?: ListItemTextProps | ||
} & Omit<ListProps, 'children'> | ||
ItemProps?: ComponentProps<typeof Typography<'li'>> | ||
} & Omit<ComponentProps<typeof UonrderedList>, 'children'> | ||
|
||
/** | ||
* Displays a list of text items, converting any markdown to html. | ||
* Note: *no sanitization* | ||
*/ | ||
export const ListFromMd = ({ items, ItemProps, ...rest }: ListFromMdProps) => ( | ||
<List {...rest}> | ||
export const ListFromMd = ({ items, ItemProps, sx, ...rest }: ListFromMdProps) => ( | ||
<UonrderedList {...rest} sx={mergeSxProps(sx, { pl: '1em', mt: 3, mb: 1 })}> | ||
{items.map((item, i) => ( | ||
<ListItemText {...ItemProps} key={i}> | ||
<Typography component="li" {...ItemProps} key={i}> | ||
<SpanFromMd markdown={item} /> | ||
</ListItemText> | ||
</Typography> | ||
))} | ||
</List> | ||
</UonrderedList> | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters