JSFiddle - React, Tailwind, and code Playground

HTML

<script src="https://dl.dropboxusercontent.com/s/nprvawkml8mav45/phaser.min.js"></script>
<div id="game_div"> </div>

CSS

#game_div {
      width: 400px;
      margin: auto;
      margin-top: 50px;
    }

JavaScript

var game = new Phaser.Game(400, 490, Phaser.AUTO, 'game_div');
var game_state = {};

game_state.main = function() { };  
game_state.main.prototype = {

    preload: function() {
    
    this.stage.backgroundColor = '#B1FD00';
    
      //Load sprites
    this.shopS = this.add.bitmapData(300, 400);
		this.shopS.ctx.beginPath();
		this.shopS.ctx.rect(0, 0, 300, 400);
		this.shopS.ctx.fillStyle = '#000000';
		this.shopS.ctx.fill();
  
    this.btnexS = this.add.bitmapData(150, 150);
		this.btnexS.ctx.beginPath();
		this.btnexS.ctx.rect(0, 0, 150, 150);
		this.btnexS.ctx.fillStyle = '#FFFFFF';
		this.btnexS.ctx.fill();

    },

    create: function() { 
      //Show message
      var message = game.add.text(10,10,"Press E to open shop");
		  message.fill = "#E09F1D";
      this.isShopOpen = false;
    },
    
    update: function() {
      //Open shop when 'E' is pressed
      if (!this.isShopOpen && game.input.keyboard.isDown(Phaser.Keyboard.E)){
				this.openShop();
        this.isShopOpen = true;
			}
    },
    
    openShop: function() {
      //Display shop UI and button
      this.shop = game.add.sprite(0,0,this.shopS);
      this.btnExit = game.add.button(0,0,this.btnexS,this.closeShop,this);
      console.log('openShop');
    },
    
    closeShop: function () {
      //Remove shop items
      this.shop.kill();
      this.btnExit.kill();
      this.isShopOpen = false;
      console.log('closeShop');
    },
};

game.state.add('main', game_state.main);  
game.state.start('main');