helpwave / web

The official web application of helpwave
https://staging-tasks.helpwave.de
Mozilla Public License 2.0
12 stars 4 forks source link

simplify modals code #1055

Closed DasProffi closed 1 month ago

DasProffi commented 1 month ago

Describe the chore

Remove the objects and use tailwind instead:

return ReactDOM.createPortal(
    <div className={tx('fixed inset-0 overflow-y-auto z-[99]')} id={id}>
      <div
        className={tx('fixed inset-0 h-screen w-screen', backgroundClassName, { 'bg-black/70': isLast && register.length === 1, 'hidden': !isLast })}
        onClick={onBackgroundClick}
      />
      <div
        className={tx('fixed left-1/2 top-1/2 -translate-y-1/2 -translate-x-1/2 flex flex-col p-4 bg-white rounded-xl shadow-xl', modalClassName)}>
        <ModalHeader {...modalHeaderProps} />
        {children}
      </div>
      <div
        className={tx('fixed inset-0 h-screen w-screen', backgroundClassName, { 'bg-black/70': isSecondLast && register.length > 1, 'hidden': isLast })}
      />
    </div>,
    modalRoot,
    id
  )