import h from '../shared/h.js'

export function List ({ _ordered, ...props }) {
  const tag = _ordered ? 'ol' : 'ul'
  const prefix = _ordered ? 'list-decimal' : 'list-disc'
  return h(tag, {
    ...props,
    // Ensure equal space for nested lists.
    _style: id => `li > ${id} { margin-top: 8px }`,
    className: `ps-6 space-y-2 ${prefix}`
  })
}
