Browse Source

JFKKNG002V

Ivar 2 years ago
parent
commit
8913667e04
15 changed files with 37185 additions and 1568 deletions
  1. 35391 0
      package-lock.json
  2. 1 0
      package.json
  3. BIN
      public/calc_gd.png
  4. BIN
      public/favicon.ico
  5. 2 12
      public/index.html
  6. BIN
      public/logo192.png
  7. BIN
      public/logo512.png
  8. 0 38
      src/App.css
  9. 119 22
      src/App.js
  10. 144 0
      src/App.scss
  11. 0 13
      src/index.css
  12. 1 1
      src/index.js
  13. 9 0
      src/index.scss
  14. 0 1
      src/logo.svg
  15. 1518 1481
      yarn.lock

File diff suppressed because it is too large
+ 35391 - 0
package-lock.json


+ 1 - 0
package.json

@@ -9,6 +9,7 @@
     "react": "^17.0.2",
     "react-dom": "^17.0.2",
     "react-scripts": "4.0.3",
+    "sass": "^1.43.3",
     "web-vitals": "^1.0.1"
   },
   "scripts": {

BIN
public/calc_gd.png


BIN
public/favicon.ico


+ 2 - 12
public/index.html

@@ -4,7 +4,6 @@
     <meta charset="utf-8" />
     <link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
     <meta name="viewport" content="width=device-width, initial-scale=1" />
-    <meta name="theme-color" content="#000000" />
     <meta
       name="description"
       content="Web site created using create-react-app"
@@ -24,20 +23,11 @@
       work correctly both with client-side routing and a non-root public URL.
       Learn how to configure a non-root public URL by running `npm run build`.
     -->
-    <title>React App</title>
+    <title>Калькулятор</title>
   </head>
+
   <body>
     <noscript>You need to enable JavaScript to run this app.</noscript>
     <div id="root"></div>
-    <!--
-      This HTML file is a template.
-      If you open it directly in the browser, you will see an empty page.
-
-      You can add webfonts, meta tags, or analytics to this file.
-      The build step will place the bundled scripts into the <body> tag.
-
-      To begin the development, run `npm start` or `yarn start`.
-      To create a production bundle, use `npm run build` or `yarn build`.
-    -->
   </body>
 </html>

BIN
public/logo192.png


BIN
public/logo512.png


+ 0 - 38
src/App.css

@@ -1,38 +0,0 @@
-.App {
-  text-align: center;
-}
-
-.App-logo {
-  height: 40vmin;
-  pointer-events: none;
-}
-
-@media (prefers-reduced-motion: no-preference) {
-  .App-logo {
-    animation: App-logo-spin infinite 20s linear;
-  }
-}
-
-.App-header {
-  background-color: #282c34;
-  min-height: 100vh;
-  display: flex;
-  flex-direction: column;
-  align-items: center;
-  justify-content: center;
-  font-size: calc(10px + 2vmin);
-  color: white;
-}
-
-.App-link {
-  color: #61dafb;
-}
-
-@keyframes App-logo-spin {
-  from {
-    transform: rotate(0deg);
-  }
-  to {
-    transform: rotate(360deg);
-  }
-}

+ 119 - 22
src/App.js

@@ -1,25 +1,122 @@
-import logo from './logo.svg';
-import './App.css';
-
-function App() {
-  return (
-    <div className="App">
-      <header className="App-header">
-        <img src={logo} className="App-logo" alt="logo" />
-        <p>
-          Edit <code>src/App.js</code> and save to reload.
-        </p>
-        <a
-          className="App-link"
-          href="https://reactjs.org"
-          target="_blank"
-          rel="noopener noreferrer"
-        >
-          Learn React
-        </a>
-      </header>
+import './App.scss';
+
+const VerticalTilda = () => (<span className="tilda">~</span>)
+const Upperline = ({children}) => (<span className="upperline">{children}</span>)
+const Underline = ({children}) => (<span className="underline">{children}</span>)
+
+const ActionButton = ({className, children}) => (<div className={`button ${className}`} >{children}</div>)
+const ValueButton = ({className, children}) => (<div className={`button ${className}`} >{children}</div>)
+
+const Operator = ({className, children}) => (<ActionButton className={`operator ${className}`}>{children}</ActionButton>)
+const ScreenOperator = ({children}) => (<ActionButton className='screen_operator'>{children}</ActionButton>)
+const Bitwise = ({children}) => (<ActionButton className='bitwise'>{children}</ActionButton>)
+const NumeralSystem = ({children}) => (<ActionButton className='numeral_system'>{children}</ActionButton>)
+const Number = ({dataValue, children}) => (<ValueButton className='number'>{children}</ValueButton>)
+
+
+const Column = ({children}) => (
+  <div className="col">
+    {children}
+  </div>
+)
+
+const Keyboard = () => (  
+  <div class="keyboard_field">
+
+    <div className="keyboard_left">
+
+      <Column>
+        <Operator className='double_tilda' dataAction="roundUp">  <VerticalTilda/> <VerticalTilda/> </Operator>
+        <Operator dataAction="power"> <span> x<Upperline>y</Upperline> </span> </Operator>
+        <Operator dataAction="log"> <span> log<Underline>x</Underline> </span> </Operator>
+        <Operator dataAction="tenPow"> <span> &#215;10<Upperline>x</Upperline> </span> </Operator>
+        <Operator dataAction="remainder"> .% </Operator>
+      </Column>
+
+    </div>
+
+
+    <div className="keyboard_main">
+
+        <Column>
+          <ScreenOperator dataAction="deleteAll"> С </ScreenOperator>
+          <Number dataValue="7"> 7 </Number>
+          <Number dataValue="4"> 4 </Number>
+          <Number dataValue="1"> 1 </Number>
+          <Number dataValue="0"> 0 </Number>
+        </Column>
+
+        <Column>
+          <ScreenOperator dataAction="deleteChar"> &lt;= </ScreenOperator>
+          <Number dataValue="8"> 8 </Number>
+          <Number dataValue="5"> 5 </Number>
+          <Number dataValue="2"> 2 </Number>
+          <Number dataValue="."> . </Number>
+        </Column>
+        
+        <Column>
+          <Operator dataAction="rad"> &radic; </Operator>
+          <Number dataValue="9"> 9 </Number>
+          <Number dataValue="6"> 6 </Number>
+          <Number dataValue="3"> 3 </Number>
+          <Operator dataAction="sign"> &#177; </Operator>
+        </Column>
+
+        <Column>
+          <Operator dataAction="div"> &#247; </Operator>
+          <Operator dataAction="mul"> &#215; </Operator>
+          <Operator dataAction="sub"> - </Operator>
+          <Operator dataAction="add"> + </Operator>
+          <Operator dataAction="eq"> = </Operator>
+        </Column>
+
     </div>
-  );
-}
+
+
+    <div className="keyboard_right">
+
+      <Column>
+        <NumeralSystem dataAction="toBinary">0b</NumeralSystem>
+        <Bitwise dataAction="bitwiseAnd">&#38;</Bitwise>
+        <Bitwise dataAction="bitwiseOr">|</Bitwise>
+        <Bitwise dataAction="bitwiseXor">^</Bitwise>
+        <Bitwise dataAction="bitwiseNot">~</Bitwise>
+      </Column>
+
+      <Column>
+        <NumeralSystem dataAction="toHexadecimal">0x</NumeralSystem>
+        <NumeralSystem dataAction="toOctal">0o</NumeralSystem>
+        <Bitwise dataAction="leftShift">&lt;&lt;</Bitwise>
+        <Bitwise dataAction="rightShift">&gt;&gt;</Bitwise>
+        <Bitwise dataAction="unsignedRightShift">&gt;&gt;&gt;</Bitwise>
+      </Column>
+
+    </div>
+
+  </div>
+)
+
+
+const Screen = () => (  
+  <div class="screen_field">  
+      <div className="screen"></div>
+  </div>
+)
+
+
+const App = () => (
+  <>
+    <div className="wrapper">
+      <div className="field">
+
+          <Screen/>
+
+          <Keyboard/>
+
+        </div>
+      </div>
+  </>
+)
+
 
 export default App;

+ 144 - 0
src/App.scss

@@ -0,0 +1,144 @@
+.field {
+	margin-top: 20px;
+	margin-left: 50px;
+	height: max-content;
+	width: max-content;
+	display: flex;
+	flex-direction: column;
+
+
+	& .screen_field {
+		background: lightgray;
+		height: 200px;
+		width: 405px;
+		display: flex;
+		align-items: end;
+		justify-content: space-around;
+		margin-left: 110px;
+
+		& .screen {
+			font-size: 30px;
+			background: honeydew;
+			height: 195px;
+			width: 395px;
+			color:black;
+			display: flex;
+			align-items: flex-end;
+			justify-content: flex-end;
+			overflow: auto;
+			-webkit-user-select: none;
+			-ms-user-select: none;
+			-moz-user-select: none;
+			user-select: none;
+		}
+
+	}
+
+	& .keyboard_field {
+		display: flex;		
+
+		& .keyboard_left {
+			display: flex;
+			align-items: end;
+			margin: auto 5px 0 0;
+			width: 105px;
+			background: lightgray;
+	
+			& .col {
+				height: 505px;
+				width: 100px;
+				display: flex;
+				flex-direction: column;
+				align-items: start;
+				justify-content: space-evenly;
+	
+				&:first-child {
+					padding-left: 5px;
+				}
+			}
+		}
+
+		& .keyboard_main  {
+			height: 505px;
+			width: 405px;
+			background: lightgray;
+			display: flex;
+			align-items: center;
+			justify-content: space-evenly;
+	
+				& .col {
+					height: 500px;
+					width: 95px;
+					display: flex;
+					flex-direction: column;
+					align-items: center;
+					justify-content: space-around;
+				}
+		}
+
+		.keyboard_right {
+			background: lightgray;
+			margin: auto 0 0 5px;
+			width: 205px;
+			display: flex;
+			align-items: end;
+	
+			& .col {
+				height: 505px;
+				width: 100px;
+				display: flex;
+				flex-direction: column;
+				align-items: start;
+				justify-content: space-evenly;
+	
+				&:first-child {
+					padding-left: 5px;
+				}
+			}
+		}
+
+	}
+
+}
+
+	.button {
+		font-size: 40px;
+		height: 95px;
+		width: 95px;
+		background: ghostwhite;
+		display: flex;
+		align-items: center;
+		justify-content: center;
+
+		-webkit-user-select: none;
+		-ms-user-select: none;
+		-moz-user-select: none;
+		user-select: none;
+
+		&:hover {
+			background: lavender;
+		}
+		
+		&:active  {
+			background: white;
+		}
+
+		& .upperline {
+			font-size: 20px;
+			vertical-align: top;
+		}
+
+		& .underline {
+			font-size: 20px;
+			vertical-align: bottom;
+		}
+
+		&.double_tilda {
+			display: flex;
+			flex-direction: column;
+			align-items: center;
+			justify-content: center;
+			line-height: 15px;
+		}
+
+	}

+ 0 - 13
src/index.css

@@ -1,13 +0,0 @@
-body {
-  margin: 0;
-  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
-    'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
-    sans-serif;
-  -webkit-font-smoothing: antialiased;
-  -moz-osx-font-smoothing: grayscale;
-}
-
-code {
-  font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
-    monospace;
-}

+ 1 - 1
src/index.js

@@ -1,6 +1,6 @@
 import React from 'react';
 import ReactDOM from 'react-dom';
-import './index.css';
+import './index.scss';
 import App from './App';
 import reportWebVitals from './reportWebVitals';
 

+ 9 - 0
src/index.scss

@@ -0,0 +1,9 @@
+body {
+	font-family: monospace;
+	text-decoration: none;
+	margin: 0;
+	padding: 0;
+  -webkit-font-smoothing: antialiased;
+  -moz-osx-font-smoothing: grayscale;
+}
+

File diff suppressed because it is too large
+ 0 - 1
src/logo.svg


File diff suppressed because it is too large
+ 1518 - 1481
yarn.lock