import { h, Component } from 'preact'

export default function FolderListView (props) {
  const folders = props.folders.map( (folder, i) => (
    <div key={i} onClick={() => props.openFolder(folder)}>
      <span class='name'>{folder.name}</span>
    </div>
  ))
  
  return (
    <div class='window'>
      <div class='heading'>
        <b>browser</b>
        <div class='buttons'>
          <button onClick={props.initNewFolder}>+ folder</button>
        </div>
      </div>
      <div class='list'>
        {folders}
      </div>
    </div>
  )
}
