explorata/src/App.vue

138 lines
2.5 KiB
Vue
Raw Normal View History

2022-01-08 13:12:15 +01:00
<template>
<div id="main">
<h1 id="main-title">
<span id="burger-toggle" @click="toggleMainMenu">{{
mainMenu == true ? "▼" : "☰"
}}</span>
Cellular Automata Explorer
</h1>
<div id="container">
<MainMenu v-if="mainMenu || windowWidth >= 800" />
<CanvasBoard />
</div>
2022-12-04 17:24:45 +01:00
<MenuReset row-title="" />
2022-01-08 13:12:15 +01:00
</div>
</template>
<script>
2022-12-02 15:53:49 +01:00
import MainMenu from "./components/MainMenu.vue";
import CanvasBoard from "./components/CanvasBoard.vue";
2022-12-04 17:24:45 +01:00
import MenuReset from "./components/MenuReset.vue";
2022-01-08 13:12:15 +01:00
2022-12-02 15:53:49 +01:00
export default {
name: "App",
components: {
MainMenu,
2022-12-04 17:24:45 +01:00
MenuReset,
2022-12-02 15:53:49 +01:00
CanvasBoard,
},
data() {
return {
mainMenu: false,
windowWidth: window.innerWidth,
};
},
methods: {
toggleMainMenu() {
this.mainMenu = !this.mainMenu;
},
onResize() {
this.windowWidth = window.innerWidth;
},
},
mounted() {
this.$nextTick(() => {
window.addEventListener("resize", this.onResize);
});
},
beforeDestroy() {
window.removeEventListener("resize", this.onResize);
},
2022-12-02 15:53:49 +01:00
};
2022-01-08 13:12:15 +01:00
</script>
<style scope>
2022-12-04 16:08:56 +01:00
:root {
--dark1: #000000;
--dark2: #333333;
--dark3: #666666;
--light1: #999999;
--light2: #cccccc;
--light3: #eeeeee;
}
2022-12-02 15:53:49 +01:00
#app {
font-family: Avenir, Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-align: center;
/* color: #2c3e50; */
}
2022-01-08 13:12:15 +01:00
2022-12-02 15:53:49 +01:00
* {
margin: 0;
padding: 0;
}
2022-01-08 13:12:15 +01:00
2022-12-02 15:53:49 +01:00
body {
2022-12-04 16:08:56 +01:00
background: var(--dark1);
color: var(--light3);
2022-12-02 15:53:49 +01:00
font-family: Courier New;
}
2022-01-08 13:12:15 +01:00
2022-12-02 15:53:49 +01:00
canvas {
flex: auto;
2022-12-04 16:08:56 +01:00
background: rgb(0, 0, 0);
background: linear-gradient(
90deg,
rgba(0, 0, 0, 1) 0%,
rgba(131, 131, 131, 1) 52%,
rgba(0, 0, 0, 1) 100%
);
2022-12-02 15:53:49 +01:00
}
2022-01-08 13:12:15 +01:00
2022-12-02 15:53:49 +01:00
h1,
h2 {
font-weight: bold;
}
2022-01-08 13:12:15 +01:00
2022-12-02 15:53:49 +01:00
h1 {
margin: 10px auto;
font-size: larger;
text-transform: uppercase;
2022-12-02 15:53:49 +01:00
}
2022-01-08 13:12:15 +01:00
2022-12-02 15:53:49 +01:00
#container {
display: flex;
height: calc(100vh - 100px);
overflow: hidden;
flex-direction: column;
}
#burger-toggle {
display: none;
cursor: pointer;
font-size: 1.5em;
vertical-align: middle;
2022-12-04 16:08:56 +01:00
color: var(--light2);
}
@media screen and (max-width: 800px) {
h1 {
font-size: medium;
display: flex;
justify-content: space-around;
align-items: center;
}
#burger-toggle {
display: inline;
}
#main-menu {
2022-12-04 16:08:56 +01:00
background: var(--dark2);
margin: 0 auto;
}
2022-12-02 15:53:49 +01:00
}
2022-01-08 13:12:15 +01:00
</style>