-
Notifications
You must be signed in to change notification settings - Fork 0
Feat/multiplication #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
bfc9d97
c87a359
f1b8e42
83bd390
9d5b25f
dc28b86
ed1e057
4254b89
edb9ef5
5a3a2ce
c3a316f
dc87164
db17fea
173202e
6e0c756
87eb877
20a29ff
16769c5
7c86be5
2e60537
6c6271e
9145e68
176f9a0
6ecf0d7
26a920a
075b838
123b90e
df04cd1
b2a77ed
77a2c27
e7abe44
8c533ca
44a23d4
fa11dec
0843a68
4beae0d
3ef57e3
1bb50f4
1758bd8
ff0af33
113ed95
2264446
7708b99
44db12e
501471f
73305a4
955fa76
245be99
d281a93
ff8e39c
59d0cff
7a157d1
d3ca44e
444e0fa
1598d47
a6a926e
e5b2f7a
5ba5eb4
ad2d75d
ecf7240
cb199b2
9077fa7
4fe3493
d570c3b
cd9f168
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,3 @@ | ||
| node_modules/ | ||
| node_modules/ | ||
| dist/ | ||
| .vscode/ |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,3 @@ | ||
| { | ||
| "liveServer.settings.port": 5501 | ||
| "liveServer.settings.port": 5502 | ||
| } | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok it's done |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1 @@ | ||
| "use strict"; | ||
| const compt = "55"; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| "use strict"; | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. add dist to .gitignore
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it's done |
||
| const inputA = document.getElementById('numberA'); | ||
| const inputB = document.getElementById('numberB'); | ||
| let numberA; | ||
| let numberB; | ||
| const button = document.querySelector('.button-multiplication'); | ||
| const showResult = document.getElementById('resultat'); | ||
| let result = 1; | ||
| const multiplication = (...numbers) => { | ||
| if (numbers.includes(NaN) || numbers.includes(null)) { | ||
| showResult.textContent = "Merci de renseigner uniquement des valeurs numériques"; | ||
| } | ||
| else { | ||
| console.log("ok ce sont des nombres"); | ||
| for (const number of numbers) { | ||
| result *= number; | ||
| } | ||
| console.log(result); | ||
| showResult.textContent = "Résultat : " + result.toFixed(2); | ||
| result = 1; | ||
| } | ||
| }; | ||
| button.addEventListener('click', () => { | ||
| numberA = parseFloat(inputA.value); | ||
| numberB = parseFloat(inputB.value); | ||
| multiplication(numberA, numberB); | ||
| }); | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,16 +1,56 @@ | ||
| <!DOCTYPE html> | ||
| <html lang="en"> | ||
|
|
||
| <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"> | ||
| <title>Document</title> | ||
| <link rel="stylesheet" href="style.css"> | ||
| </head> | ||
|
|
||
| <body> | ||
| <html lang="fr"> | ||
| <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" /> | ||
| <title>Calculator</title> | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice !
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks :) |
||
| <link | ||
| href="https://fonts.googleapis.com/css2?family=Rubik:wght@700&display=swap" | ||
| rel="stylesheet" | ||
| /> | ||
| <link rel="stylesheet" href="style.css" /> | ||
| </head> | ||
| <body> | ||
| <h1>Project<br />Calculator TS</h1> | ||
| <div class="section-calculator"> | ||
| <div class="calculator"> | ||
| <div class="calculator-body"> | ||
| <div class="screen"> | ||
| <div class="result">3+6</div> | ||
| </div> | ||
| <div class="key key-opening-parenthesise key-opt" data-value="("> | ||
| ( | ||
| </div> | ||
| <div class="key key-closing-parenthesise key-opt" data-value=")"> | ||
| ) | ||
| </div> | ||
| <div class="key key-cos key-opt" data-value="cos">COS</div> | ||
| <div class="key key-sin key-opt" data-value="sin">SIN</div> | ||
| <div class="key key-tan key-opt" data-value="tan">TAN</div> | ||
| <div class="key key-7 key-blue" data-value="7">7</div> | ||
| <div class="key key-7 key-blue" data-value="8">8</div> | ||
| <div class="key key-7 key-blue" data-value="9">9</div> | ||
| <div class="key key-division" data-value="/">/</div> | ||
| <div class="key key-C" data-value="c">C</div> | ||
| <div class="key key-4 key-blue" data-value="4">4</div> | ||
| <div class="key key-5 key-blue" data-value="5">5</div> | ||
| <div class="key key-6 key-blue" data-value="6">6</div> | ||
| <div class="key key-multiplication" data-value="*">x</div> | ||
| <div class="key key-equal" data-value="=">=</div> | ||
| <div class="key key-1 key-blue" data-value="1">1</div> | ||
| <div class="key key-2 key-blue" data-value="2">2</div> | ||
| <div class="key key-3 key-blue" data-value="3">3</div> | ||
| <div class="key key-substraction" data-value="-">-</div> | ||
| <div class="key key-plus-or-minus key-blue" data-value="+/-">+/-</div> | ||
| <div class="key key-0 key-blue" data-value="0">0</div> | ||
| <div class="key key-dot key-blue" data-value=".">.</div> | ||
| <div class="key key-addition" data-value="+">+</div> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| <script type="module" src="dist/index.js"></script> | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it's done |
||
| </body> | ||
| </body> | ||
| </html> | ||
|
|
||
|
|
||
| </html> | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| import * as fs from 'fs'; | ||
| import { execSync } from 'child_process'; | ||
| import * as path from 'path'; | ||
|
|
||
| // example file and directory to copy | ||
| //const sourceDirectory = ["./", "./style"]; | ||
| const sourceDirectory = ['./']; | ||
| const destinationDirectory = 'dist/'; | ||
|
|
||
| if (fs.existsSync("./dist")) { | ||
| fs.rmSync(destinationDirectory, { recursive: true }); | ||
| } | ||
|
|
||
| if (!fs.existsSync("./dist")) { | ||
| fs.mkdirSync("./dist"); | ||
| } | ||
|
|
||
| sourceDirectory.forEach((dir) => { | ||
| cpyFile(dir, destinationDirectory); | ||
| }); | ||
|
|
||
| function cpyFile(directory, destination) { | ||
| fs.readdir(directory, (err, files) => { | ||
| if (err) { | ||
| console.error(err); | ||
| return; | ||
| } | ||
|
|
||
| files.forEach((file) => { | ||
| if (path.extname(file) === '.html' || path.extname(file) === '.css') { | ||
| const sourceFile = path.join(directory, file); | ||
| let destinationFile = path.join(destination, directory); | ||
| fs.mkdir(destinationFile, { recursive: true }, (err) => { | ||
| if (err) throw err; | ||
| }); | ||
| destinationFile = path.join(destinationFile, file); | ||
| const readStream = fs.createReadStream(sourceFile); | ||
| const writeStream = fs.createWriteStream(destinationFile); | ||
| readStream.pipe(writeStream); | ||
| } | ||
| }); | ||
| }); | ||
| } | ||
|
|
||
| //compile Ts file | ||
| execSync('npx tsc'); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
|
|
||
| // let varNumb = document.getElementById('ids') | ||
|
|
||
| // varNumb?.addEventListener('click', () => { | ||
| // console.log('ok') | ||
| // }) | ||
|
|
||
| //addition buttons function ===> |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,2 @@ | ||
| const compt:string = "55" | ||
| const compt:string = "55" | ||
| const compt2:string = "5555" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| const inputA = <HTMLInputElement>document.getElementById('numberA') | ||
| const inputB = <HTMLInputElement>document.getElementById('numberB') | ||
| let numberA: number | ||
| let numberB: number | ||
| const button = <HTMLButtonElement>document.querySelector('.button-multiplication') | ||
| const showResult = <HTMLParagraphElement>document.getElementById('resultat') | ||
| let result: number = 1 | ||
|
|
||
|
|
||
| const multiplication = (...numbers: any) => { | ||
|
|
||
| if (numbers.includes(NaN) || numbers.includes(null)) { | ||
| showResult.textContent = "Merci de renseigner uniquement des valeurs numériques" | ||
|
|
||
| } | ||
| else { | ||
| console.log("ok ce sont des nombres") | ||
|
|
||
| for (const number of numbers) { | ||
| result *= number; | ||
| } | ||
| console.log(result) | ||
| showResult.textContent = "Résultat : " + result.toFixed(2); | ||
| result = 1 | ||
| } | ||
|
|
||
| } | ||
|
|
||
|
|
||
| button.addEventListener('click', () => { | ||
| numberA = parseFloat(inputA.value) | ||
| numberB = parseFloat(inputB.value) | ||
| multiplication(numberA, numberB) | ||
| }) | ||
|
|
||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,132 @@ | ||
| /*** Reset CSS ***/ | ||
| * { | ||
| margin: 0; | ||
| padding: 0; | ||
| box-sizing: border-box; | ||
| font-family: 'Rubik', sans-serif; | ||
| } | ||
|
|
||
| body { | ||
| background-color: #e8c055; | ||
| background: linear-gradient(45deg, #e8c055, #e9dab2); | ||
| min-height: 100vh; | ||
| width: 100%; | ||
| display: flex; | ||
| align-items: center; | ||
| justify-content: center; | ||
| flex-direction: column; | ||
| font-size: 1.75rem; | ||
| color: rgb(246, 246, 246); | ||
| text-shadow: 0 3px 3px #00000033; | ||
| } | ||
|
|
||
| h1 { | ||
| text-align: center; | ||
| font-size: 3.6rem; | ||
| margin-bottom: 2.4rem; | ||
| line-height: 1.05; | ||
| text-shadow: 0 6px 6px #00000033; | ||
| } | ||
|
|
||
| /*** Calculator element ***/ | ||
| .calculator { | ||
| width: clamp(23rem, 80vw, 50rem); | ||
| background-color: #404f66; | ||
| border-radius: 9px; | ||
| } | ||
|
|
||
| .calculator-body { | ||
| display: grid; | ||
| border-radius: 9px; | ||
| padding: 3rem; | ||
| grid-template-columns: repeat(5, 1fr); | ||
| grid-template-rows: repeat(6, 1fr); | ||
| column-gap: 1rem; | ||
| row-gap: 1rem; | ||
| box-shadow: 0 16px 16px #00000031; | ||
| } | ||
|
|
||
| .calculator-body > div { | ||
| background-color: #e8c055; | ||
| grid-column-end: span 1; | ||
| min-height: 2rem; | ||
| display: flex; | ||
| align-items: center; | ||
| justify-content: center; | ||
| border-radius: 6px; | ||
| box-shadow: 0 4px 4px #00000033; | ||
| } | ||
|
|
||
| .calculator-body .key-opt { | ||
| height: 2.8rem; | ||
| margin-top: 1.5rem; | ||
| } | ||
|
|
||
| .calculator-body .screen { | ||
| position: relative; | ||
| grid-column-end: span 5; | ||
| justify-content: end; | ||
| padding-right: 1rem; | ||
| overflow: hidden; | ||
| height: 100%; | ||
| width: 100%; | ||
| z-index: 10; | ||
| } | ||
|
|
||
| .calculator-body .screen::after { | ||
| position: absolute; | ||
| z-index: 5; | ||
| content: ''; | ||
| width: 800px; | ||
| height: 100px; | ||
| background: #6699b1; | ||
| transform: skew(-50deg) translateX(50%); | ||
| } | ||
| .calculator-body .result { | ||
| position: relative; | ||
| z-index: 10; | ||
| letter-spacing: 0.25rem; | ||
| } | ||
| .calculator-body .screen, | ||
| .calculator-body .key-blue { | ||
| background-color: #709db0; | ||
| } | ||
|
|
||
| .calculator-body .key-equal { | ||
| grid-row-end: span 3; | ||
| } | ||
|
|
||
| .calculator-body .key { | ||
| cursor: pointer; | ||
| transition: background-color 0.3s ease-out; | ||
| } | ||
| .calculator-body .key:hover { | ||
| background-color: #c7a549; | ||
| } | ||
| .calculator-body .key-blue:hover { | ||
| background-color: #5c8191; | ||
| } | ||
|
|
||
| /*** Media queries ***/ | ||
| @media screen and (max-width: 800px) { | ||
| body { | ||
| font-size: 1.5rem; | ||
| } | ||
| h1 { | ||
| font-size: 2.6rem; | ||
| } | ||
| .calculator { | ||
| min-width: 100%; | ||
| } | ||
| .calculator-body { | ||
| padding: 1.5rem; | ||
| } | ||
| } | ||
| @media screen and (max-width: 500px) { | ||
| body { | ||
| font-size: 1rem; | ||
| } | ||
| .calculator-body { | ||
| padding: 1rem; | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add to .gitignore
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's done