import '../styles/Row.sass'
import { Show, type JSXElement } from 'solid-js'

interface Props {
  children: JSXElement
  content?: 'left' | 'center' | 'right' | 'split' | 'spaced' | 'even'
  gap?: number
  wrap?: boolean
}

export default (props: Props) => {
  return (
    <>
      <Show when={props.gap}>
        <section class={`dasig-row-${props.content || 'center'}`} style={`gap: ${props.gap}rem; flex-wrap: ${props.wrap ? 'wrap' : 'nowrap'}`}>
          {props.children}
        </section>
      </Show>

      <Show when={!props.gap}>
        <section class={`dasig-row-${props.content || 'center'}`} style={`flex-wrap: ${props.wrap ? 'wrap' : 'nowrap'}`}>{props.children}</section>
      </Show>
    </>
  )
}
