<commit_before><commit_msg>Add Overlay component as a base for modals and spinners<commit_after>module Components.Overlay
  ( new
  ) where

import Lambda.Prelude

import React.Basic (JSX)
import React.Basic.DOM as R
import React.Basic.Hooks (Component, component)
import React.Portal as Portal
import React.Basic.Events (handler)
import React.Basic.DOM.Events (stopPropagation)

type Props =
  { dismiss :: Maybe (Effect Unit)
  , children :: Array JSX
  }

new :: Component Props
new = do
  portal <- Portal.new
  component "Overlay" \{ dismiss, children } ->
    pure $ portal
      { children:
        [ R.div
          { className: "overlay"
          , children:
            [ R.div
              { className: "overlay-item"
              , children
              }
            ]
          , onClick: handler stopPropagation $ const $ sequence_ dismiss
          }
        ]
      }
{'fraction_non_alphanumeric': 0.09234234234234234, 'fraction_numerical': 0.0, 'mean_word_length': 2.186379928315412, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5611862', 'n_tokens_mistral': 251, 'n_tokens_neox': 254, 'n_words': 73}