<div id="root"></div>
@import url("https://fonts.googleapis.com/css?family=Gochi+Hand");

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  width: 100vw;
  min-height: 100vh;
  margin: 0;
  background-color: #291642;
  font-family: "Gochi Hand", sans-serif;
  font-size: 100%;
  letter-spacing: 0.1rem;
  color: #fff;
  display: flex;
  justify-content: center;
  align-items: center;

  background: linear-gradient(to right, #44ea76 0%, #39fad7 80%, #39fad7 100%)
      no-repeat,
    url("https://s3-us-west-2.amazonaws.com/s.cdpn.io/142996/slider-2.jpg")
      no-repeat fixed;
  background-size: cover;
  background-blend-mode: hue;
}

#root {
  width: 100vw;
  min-height: 100vh;
}

.app {
  width: 100vw;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  font-weight: 400;
  font-family: "Gochi Hand", sans-serif;
  color: #212529;
  user-select: none;
  background-color: transparent;
  border: 1px solid transparent;
  padding: 0.375rem 0.75rem;
  font-size: 1rem;
  line-height: 1.5;
  border-radius: 0.25rem;
  transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out,
    border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

button:focus {
  outline: 1px dotted;
  outline: 5px auto -webkit-focus-ring-color;
}

button:not(:disabled):not(.disabled) {
  cursor: pointer;
}

button:hover {
  color: #212529;
  text-decoration: none;
}

.btn__primary {
  color: #fff;
  background-color: #007bff;
  border-color: #007bff;
}

.btn__primary:focus {
  color: #fff;
  background-color: #0069d9;
  border-color: #0062cc;
  box-shadow: 0 0 0 0.2rem rgba(38, 143, 255, 0.5);
}

.btn__primary:hover {
  color: #fff;
  background-color: #0069d9;
  border-color: #0062cc;
}

.btn__primary:not(:disabled):not(.disabled):active {
  color: #fff;
  background-color: #0062cc;
  border-color: #005cbf;
}

.btn__primary:not(:disabled):not(.disabled):active:focus {
  box-shadow: 0 0 0 0.2rem rgba(38, 143, 255, 0.5);
}

.btn__secondary {
  color: #fff;
  background-color: #6c757d;
  border-color: #6c757d;
}

.btn__secondary:hover {
  color: #fff;
  background-color: #5a6268;
  border-color: #545b62;
}

.btn__secondary:focus {
  color: #fff;
  background-color: #5a6268;
  border-color: #545b62;
  box-shadow: 0 0 0 0.2rem rgba(130, 138, 145, 0.5);
}

.btn__secondary:not(:disabled):not(.disabled):active {
  color: #fff;
  background-color: #545b62;
  border-color: #4e555b;
}

.btn__secondary:not(:disabled):not(.disabled):active:focus {
  box-shadow: 0 0 0 0.2rem rgba(130, 138, 145, 0.5);
}

.app > .btn__primary {
  margin: auto;
}

// Modal style

.modal__backdrop {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1040;
  width: 100vw;
  height: 100vh;
  background-color: #000;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.modal__backdrop.show {
  opacity: 0.5;
}

.modal {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1050;
  display: none;
  width: 100%;
  height: 100%;
  overflow: hidden;
  outline: 0;
  pointer-events: none;
  justify-content: center;
  align-items: center;
}

.modal.show {
  display: flex;
}

.modal__content {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  pointer-events: auto;
  background-color: #fff;
  color: #212529;
  background-clip: padding-box;
  border: 1px solid rgba(0, 0, 0, 0.2);
  border-radius: 0.3rem;
  outline: 0;
  max-width: 50vw;
}

.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1rem;
  border-bottom: 1px solid #dee2e6;
  border-top-left-radius: calc(0.3rem - 1px);
  border-top-right-radius: calc(0.3rem - 1px);
}

.modal__title {
  font-size: 1.25rem;
}

.modal__header > .close {
  padding: 0;
  margin: 0;
}

.modal__header .icon {
  width: 24px;
  height: 24px;
}

.modal__body {
  position: relative;
  flex: 1 1 auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.modal__footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0.75rem;
  border-top: 1px solid #dee2e6;
  border-bottom-right-radius: calc(0.3rem - 1px);
  border-bottom-left-radius: calc(0.3rem - 1px);
}

.modal__footer button:not(:last-child) {
  margin-right: 5px;
}
View Compiled
const Modal = (props) => {
  const { show, closeModal, modalTitle, a11yId, children } = props;

  return (
    <>
      <div
        className={show ? "modal show" : "modal"}
        tabindex="-1"
        role="dialog"
        aria-labelledby={a11yId}
        aria-hidden={!show}
      >
        <div className="modal__dialog">
          <div className="modal__content">
            <div className="modal__header">
              <h5 className="modal__title" id={a11yId}>
                {modalTitle}
              </h5>
              <button
                type="button"
                className="close"
                aria-label="close"
                tabindex="-1"
                onClick={closeModal}
              >
                <svg
                  className="icon"
                  height="200"
                  width="200"
                  viewBox="0 0 1024 1024"
                  xmlns="http://www.w3.org/2000/svg"
                  aria-hidden="true"
                  focusable="false"
                >
                  <defs />
                  <path d="M925.468404 822.294069 622.19831 512.00614l303.311027-310.331931c34.682917-27.842115 38.299281-75.80243 8.121981-107.216907-30.135344-31.369452-82.733283-34.259268-117.408013-6.463202L512.000512 399.25724 207.776695 87.993077c-34.675754-27.796066-87.272669-24.90625-117.408013 6.463202-30.178323 31.414477-26.560936 79.375815 8.121981 107.216907l303.311027 310.331931L98.531596 822.294069c-34.724873 27.820626-38.341237 75.846432-8.117888 107.195418 30.135344 31.43699 82.72919 34.326806 117.408013 6.485715l304.178791-311.219137 304.177767 311.219137c34.678824 27.841092 87.271646 24.951275 117.408013-6.485715C963.808618 898.140501 960.146205 850.113671 925.468404 822.294069z" />
                </svg>
              </button>
            </div>
            {children}
          </div>
        </div>
      </div>
      {show && (
        <div
          className={show ? "modal__backdrop show" : "modal__backdrop"}
          onClick={closeModal}
        ></div>
      )}
    </>
  );
};

const App = () => {
  const [show, setShow] = React.useState(false);

  const openModal = () => setShow(true);
  const closeModal = () => setShow(false);

  return (
    <div className="app">
      {!show && (
        <button onClick={openModal} className="btn__primary">
          Open Modal
        </button>
      )}
      <Modal
        closeModal={closeModal}
        show={show}
        modalTitle="Modal title"
        a11yId="exampleModalLabel"
      >
        <div className="modal__body">
          <p>
            I will not close if you click outside me. Don't even try to press
            escape key.
          </p>
        </div>
        <div className="modal__footer">
          <button type="button" className="btn__secondary" onClick={closeModal}>
            Close
          </button>
          <button type="button" className="btn__primary">
            Enter
          </button>
        </div>
      </Modal>
    </div>
  );
};

function render() {
  ReactDOM.render(<App />, document.getElementById("root"));
}

render();
View Compiled

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

  1. https://cdnjs.cloudflare.com/ajax/libs/react/16.9.0/umd/react.production.min.js
  2. https://cdnjs.cloudflare.com/ajax/libs/react-dom/16.9.0/umd/react-dom.production.min.js