JSFiddle - React, Tailwind, and code Playground

HTML

<div id="content">
  <div class="shadow"></div>
  <table>
    <tr>
      <td>
        <div class="small">
          <p>Text1</p>
        </div>
      </td>
      <td>
        <div class="small">
          <p>Text2</p>
        </div>
      </td>
    </tr>
    <tr>
      <td>
        <div class="small">
          <p>Text3</p>
        </div>
      </td>
      <td>
        <div class="small">
          <p>Text4</p>
        </div>
      </td>
    </tr>
  </table>
</div>

CSS

table {
  width: 500px;
  height: 500px;
  background-color: gray;
  border: 2px solid olive;
  margin: 0 auto;
  padding: 0;
}

.shadow {
  position: fixed;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, .3);
  top: 0;
  left: 0;
  visibility: hidden;
  opacity: 0;
  transition: all .2s ease-in-out;
}

.shadow.show {
  visibility: visible;
  opacity: 1;
}

.small {
  width: 240px;
  height: 240px;
  background-color: white;
  border: 2px solid purple;
  border-radius: 15px;
}

.small:hover {
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
}

td {
  text-align: center;
}

.small.opened {
  position: absolute;
  width: 50%;
  height: 50%;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

JavaScript

$(".small").click(function() {
  	$(this).toggleClass("opened");
    $(".shadow").toggleClass("show");
});
$(".shadow").click(function(){
	$(this).removeClass("show");
  $(".small").removeClass("opened");
});