'use client'
import React from 'react'
type PropTableValuesProps = {
values: (string | number)[]
addLineBreaks?: boolean
commaSeparated?: boolean
removeApostrophes?: boolean
}
export function PropTableValues({values, addLineBreaks, commaSeparated, removeApostrophes}: PropTableValuesProps) {
const valuesToRender = values.map(value => {
if (typeof value === 'string' && !removeApostrophes) {
return (
'{value}'
)
}
return (
{value}
)
})
if (commaSeparated) {
return (
<>
{valuesToRender.reduce((acc, curr, index) => (
{acc}
{index > 0 && ', '}
{curr}
))}
{addLineBreaks &&
}
>
)
}
return (
<>
{valuesToRender.map(value => {
return (
{value}
{addLineBreaks &&
}
)
})}
>
)
}