diff --git a/src/components/SGLList/SGLList.tsx b/src/components/SGLList/SGLList.tsx new file mode 100644 index 0000000..56450f4 --- /dev/null +++ b/src/components/SGLList/SGLList.tsx @@ -0,0 +1,30 @@ +import type { CSSProperties, Key, ReactNode } from 'react' + +interface SGLListProps { + items: T[] + renderItem: (item: T) => ReactNode + getKey: (item: T) => Key + wrapperStyle?: CSSProperties + itemStyle?: CSSProperties +} + +export const SGLList = ({ + items, + renderItem, + getKey, + wrapperStyle, + itemStyle, +}: SGLListProps) => { + const content = items.map((item) => { + const renderedItem = renderItem(item) + const key = getKey(item) + + return ( +
+ {renderedItem} +
+ ) + }) + + return
{content}
+}