-
Notifications
You must be signed in to change notification settings - Fork 31
Open
Labels
Description
I can't find any information on how I can target and style nested lists.
Sanity uses "a series of list item blocks with the same level and listItem properties will be grouped into a virtual one inside of this library." My rich text is inputted as follows
and is seen queried like this:
"2": {
"children": [{ }],
"level": 1,
"listItem": "number",
"markDefs": [],
"style": "normal",
"_key": "2cc0186eb9d3",
"_type": "block"
},
"3": {
"children": [{ }],
"level": 2,
"listItem": "number",
"markDefs": [],
"style": "normal",
"_key": "984f45cfba95",
"_type": "block"
},
"4": {
"children": [{ }],
"level": 2,
"listItem": "number",
"markDefs": [],
"style": "normal",
"_key": "730d9b626b42",
"_type": "block"
}
}
But is rendered without grouping the level 2 items with the same indentation treatment?

export default function RichText({ variant = 'default', richText }) {
let components = {
list: {
// Ex. 1: customizing common list types
bullet: ({ children }) => <ul className="mt-xl">{children}</ul>,
number: ({ children }) => <ol className="mt-lg">{children}</ol>,
// Ex. 2: rendering custom lists
checkmarks: ({ children }) => <ol className="m-auto text-lg">{children}</ol>,
},
listItem: {
number: ({ children }) => <Typography className='boo' paragraph={true} component='li' sx={{ color: 'red' }} >{children}</Typography>,
},
}
return (
<>
{richText.map((block) => {
return (
<PortableText
key={block._key}
value={block}
components={components}
/>
)
})}
</>
)
};
How can we target the second level to style them properly? Am I misunderstanding how the grouping of levels should be operating?