calculator

This commit is contained in:
Lukáš 2024-02-21 09:14:42 +01:00
parent 5cc5a74cb9
commit 659777af3b
19 changed files with 12078 additions and 14 deletions

View File

@ -11,8 +11,14 @@
<body>
<div id="app">
{{ message }}
<button @click="changeMessage">Change the message!</button>
<p>
{{ message }}
<button @click="changeMessage">Change the message!</button>
</p>
<!-- Vypíše počet sudých čísel v numbers -->
{{ evenNumbersCount }}
</div>
<script>
@ -20,12 +26,20 @@
el: "#app",
data: {
message: "Hello Vue!",
numbers: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
},
methods: {
changeMessage() {
this.message = "Hello World!";
},
},
computed: {
evenNumbersCount() {
return this.numbers.filter((i) => i % 2 === 0).length;
},
},
});
</script>
</body>

View File

@ -0,0 +1,4 @@
> 1%
last 2 versions
not dead
not ie 11

View File

@ -0,0 +1,17 @@
module.exports = {
root: true,
env: {
node: true
},
'extends': [
'plugin:vue/vue3-essential',
'eslint:recommended'
],
parserOptions: {
parser: '@babel/eslint-parser'
},
rules: {
'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off'
}
}

23
itn/calculator/.gitignore vendored Normal file
View File

@ -0,0 +1,23 @@
.DS_Store
node_modules
/dist
# local env files
.env.local
.env.*.local
# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

24
itn/calculator/README.md Normal file
View File

@ -0,0 +1,24 @@
# calculator
## Project setup
```
npm install
```
### Compiles and hot-reloads for development
```
npm run serve
```
### Compiles and minifies for production
```
npm run build
```
### Lints and fixes files
```
npm run lint
```
### Customize configuration
See [Configuration Reference](https://cli.vuejs.org/config/).

View File

@ -0,0 +1,5 @@
module.exports = {
presets: [
'@vue/cli-plugin-babel/preset'
]
}

View File

@ -0,0 +1,19 @@
{
"compilerOptions": {
"target": "es5",
"module": "esnext",
"baseUrl": "./",
"moduleResolution": "node",
"paths": {
"@/*": [
"src/*"
]
},
"lib": [
"esnext",
"dom",
"dom.iterable",
"scripthost"
]
}
}

11795
itn/calculator/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,23 @@
{
"name": "calculator",
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint"
},
"dependencies": {
"core-js": "^3.8.3",
"vue": "^3.2.13"
},
"devDependencies": {
"@babel/core": "^7.12.16",
"@babel/eslint-parser": "^7.12.16",
"@vue/cli-plugin-babel": "~5.0.0",
"@vue/cli-plugin-eslint": "~5.0.0",
"@vue/cli-service": "~5.0.0",
"eslint": "^7.32.0",
"eslint-plugin-vue": "^8.0.3"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

View File

@ -0,0 +1,17 @@
<!DOCTYPE html>
<html lang="">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<title><%= htmlWebpackPlugin.options.title %></title>
</head>
<body>
<noscript>
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
</noscript>
<div id="app"></div>
<!-- built files will be auto injected -->
</body>
</html>

View File

@ -0,0 +1,28 @@
<template>
<the-layout />
</template>
<script>
import TheLayout from "@/components/TheLayout.vue";
export default {
name: "App",
components: { TheLayout },
};
</script>
<style>
body {
margin: 0;
padding: 0;
}
* {
box-sizing: border-box;
}
#app {
font-family: Avenir, Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-align: center;
color: #2c3e50;
}
</style>

View File

@ -0,0 +1,36 @@
<template>
<div class="calculator-button">{{ displayValue }}</div>
</template>
<script>
export default {
name: "CalculatorButton",
props: {
displayValue: {
type: String,
required: true,
},
},
};
</script>
<style scoped>
.calculator-button {
display: flex;
justify-content: center;
align-items: center;
padding: 0.75em;
font-size: 1.5rem;
font-weight: bold;
flex: 0 0 auto;
width: 60px;
cursor: pointer;
transition: all 0.3s ease-in-out;
}
.calculator-button:active {
transform: scale(0.85);
box-shadow: 0px 0px 0px 1px rgba(0, 0, 0, 0.15);
}
.calculator-button:hover {
background: #f2edcf;
}
</style>

View File

@ -0,0 +1,62 @@
<template>
<div class="container">
<div class="calculator">
<div class="calculator-row">
<div class="display">{{ value }}</div>
<calculator-button display-value="F" />
</div>
<div class="calculator-row" />
<div class="calculator-row" />
<div class="calculator-row" />
<div class="calculator-row" />
</div>
</div>
</template>
<script>
import CalculatorButton from "./CalculatorButton.vue";
export default {
components: { CalculatorButton },
name: "TheLayout",
data() {
return {
value: "0",
};
},
};
</script>
<style>
.container {
background: #efefef;
height: 100vh;
width: 100vw;
display: flex;
justify-content: center;
align-items: center;
}
.calculator {
background: #f6f3df;
border: 1px solid #bcbcbc;
border-radius: 4px;
overflow: hidden;
}
.calculator-row {
display: flex;
justify-content: space-between;
height: 60px;
width: 240px;
}
.calculator-row:first-child {
border-bottom: 1px solid #cdcdcd;
}
.display {
flex: 1;
font-size: 1.5rem;
padding: 0.5em;
display: flex;
align-items: center;
background: #def7eb;
justify-content: flex-end;
}
</style>

View File

@ -0,0 +1,5 @@
import { createApp } from "vue";
import App from "./App.vue";
import CalculatorButton from "@/components/CalculatorButton.vue";
createApp(App).component("CalculatorButton", CalculatorButton).mount("#app");

View File

@ -0,0 +1,4 @@
const { defineConfig } = require('@vue/cli-service')
module.exports = defineConfig({
transpileDependencies: true
})

View File

@ -1,12 +0,0 @@
<!DOCTYPE html>
<html lang="">
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<header></header>
<main></main>
<footer></footer>
</body>
</html>

View File

View File