File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11---
22import SanitizedNode from " ./StrapiBlockNode.astro" ;
3+ import StrapiList from " ../StrapiBlockList.astro" ;
34import type {
45 StrapiBlockListItem ,
6+ StrapiBlockList ,
57 StrapiBlockNode ,
6- StrapiBlockTheme
8+ StrapiBlockTheme ,
79} from " ../../../types" ;
810import { sanitizeStrapiNodeData , StrapiBlockThemeDefault } from " ../../../lib" ;
9-
1011type Props = {
1112 class? : string ;
1213 data: Array <StrapiBlockNode >;
1314 theme: StrapiBlockTheme ;
1415};
1516
16- const { data, class : classes = ' ' , theme = StrapiBlockThemeDefault } = Astro .props ;
17+ const {
18+ data,
19+ class : classes = " " ,
20+ theme = StrapiBlockThemeDefault ,
21+ } = Astro .props ;
1722
1823const sanitizedData = sanitizeStrapiNodeData (data );
24+ const nestedList = data .filter (
25+ (item : StrapiBlockNode ) => item .type === " list" ,
26+ );
1927---
2028
2129{
22- sanitizedData .length && (
30+ ( sanitizedData .length > 0 ) && (
2331 <li class = { classes } >
2432 <SanitizedNode data = { sanitizedData } theme = { theme .paragraph } />
2533 </li >
2634 )
2735}
36+ {
37+ (nestedList .length > 0 ) &&
38+ nestedList .map ((item : StrapiBlockList ) => (
39+ <li class = { classes } >
40+ <StrapiList
41+ data = { item .children }
42+ format = { item .format }
43+ theme = { theme }
44+ />
45+ </li >
46+ ))
47+ }
Original file line number Diff line number Diff line change @@ -42,7 +42,7 @@ export type StrapiBlockListItem = {
4242 children : Array < StrapiBlockNode > ;
4343} ;
4444
45- export type StrapiBlockNode = StrapiBlockTextItem | StrapiBlockLinkItem ;
45+ export type StrapiBlockNode = StrapiBlockTextItem | StrapiBlockLinkItem | StrapiBlockList ;
4646
4747export type StrapiBlockHeading = {
4848 type : 'heading' ;
You can’t perform that action at this time.
0 commit comments