fix
This commit is contained in:
parent
a49f48c166
commit
de5bae42f2
27146
package-lock.json
generated
27146
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -3,10 +3,15 @@
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"@capacitor/android": "^3.3.4",
|
||||
"@capacitor/cli": "^3.3.4",
|
||||
"@capacitor/core": "^3.3.4",
|
||||
"@testing-library/jest-dom": "^5.16.1",
|
||||
"@testing-library/react": "^12.1.2",
|
||||
"@testing-library/user-event": "^13.5.0",
|
||||
"cors": "^2.8.5",
|
||||
"react": "^17.0.2",
|
||||
"react-copy-to-clipboard": "^5.0.4",
|
||||
"react-dom": "^17.0.2",
|
||||
"react-scripts": "5.0.0",
|
||||
"web-vitals": "^2.1.3"
|
||||
@ -34,5 +39,8 @@
|
||||
"last 1 firefox version",
|
||||
"last 1 safari version"
|
||||
]
|
||||
},
|
||||
"devDependencies": {
|
||||
"typescript": "^4.5.4"
|
||||
}
|
||||
}
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 3.8 KiB |
69
src/App.css
69
src/App.css
@ -1,38 +1,51 @@
|
||||
.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: 1;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: calc(10px + 2vmin);
|
||||
justify-content: space-between;
|
||||
height: 100vh;
|
||||
}
|
||||
|
||||
.title {
|
||||
font-size: 20px;
|
||||
color: blue;
|
||||
font-family: 'Roboto', sans-serif;
|
||||
text-align: center;
|
||||
flex-wrap: wrap;
|
||||
margin-top: 30px;
|
||||
}
|
||||
.button-avatar {
|
||||
background-color: black;
|
||||
color: white;
|
||||
font-size: 30px;
|
||||
border-radius: 40px;
|
||||
padding: 10px;
|
||||
cursor: pointer;
|
||||
margin: 30px;
|
||||
}
|
||||
|
||||
.App-link {
|
||||
color: #61dafb;
|
||||
.text-copy {
|
||||
font-size: 25px;
|
||||
color: blue;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
@keyframes App-logo-spin {
|
||||
from {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
to {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
.copyImage {
|
||||
width: 45px;
|
||||
height: 51px;
|
||||
margin: 15px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.avatar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.avatarContainer {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
|
62
src/App.js
62
src/App.js
@ -1,25 +1,49 @@
|
||||
import logo from './logo.svg';
|
||||
import './App.css';
|
||||
import React, { useState, useRef } from 'react'
|
||||
import copy from './copy.png'
|
||||
import './App.css'
|
||||
|
||||
function App() {
|
||||
const [avatarLink, setAvatarLink] = useState(null)
|
||||
|
||||
const textAreaRef = useRef(null)
|
||||
|
||||
function copyToClipboard(e) {
|
||||
alert('Текст скопирован в буфер обмена')
|
||||
textAreaRef.current.select()
|
||||
document.execCommand('copy')
|
||||
}
|
||||
|
||||
const getPhoto = () => {
|
||||
fetch('http://192.168.88.31:5002/api/generate')
|
||||
.then((response) => response.json())
|
||||
.then((responseJson) => setAvatarLink(responseJson.url))
|
||||
}
|
||||
|
||||
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>
|
||||
<div className='App'>
|
||||
{!avatarLink ? (
|
||||
<h1 className='title'> Нажмите Сгенерировать аватарку ! </h1>
|
||||
) : (
|
||||
<div>
|
||||
<div className='avatar'>
|
||||
<img src={avatarLink} alt='avatar' />
|
||||
</div>
|
||||
);
|
||||
<div className='avatarContainer'>
|
||||
<textarea ref={textAreaRef} value={avatarLink} readOnly />
|
||||
<img
|
||||
onClick={() => copyToClipboard()}
|
||||
className='copyImage'
|
||||
src={copy}
|
||||
alt=''
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
<button className='button-avatar' onClick={() => getPhoto()}>
|
||||
Сгенерировать аватарку
|
||||
</button>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default App;
|
||||
export default App
|
||||
|
@ -1,8 +0,0 @@
|
||||
import { render, screen } from '@testing-library/react';
|
||||
import App from './App';
|
||||
|
||||
test('renders learn react link', () => {
|
||||
render(<App />);
|
||||
const linkElement = screen.getByText(/learn react/i);
|
||||
expect(linkElement).toBeInTheDocument();
|
||||
});
|
BIN
src/copy.png
Normal file
BIN
src/copy.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.9 KiB |
16
src/index.js
16
src/index.js
@ -1,17 +1,11 @@
|
||||
import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
import './index.css';
|
||||
import App from './App';
|
||||
import reportWebVitals from './reportWebVitals';
|
||||
import React from 'react'
|
||||
import ReactDOM from 'react-dom'
|
||||
import './index.css'
|
||||
import App from './App'
|
||||
|
||||
ReactDOM.render(
|
||||
<React.StrictMode>
|
||||
<App />
|
||||
</React.StrictMode>,
|
||||
document.getElementById('root')
|
||||
);
|
||||
|
||||
// If you want to start measuring performance in your app, pass a function
|
||||
// to log results (for example: reportWebVitals(console.log))
|
||||
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
|
||||
reportWebVitals();
|
||||
)
|
||||
|
@ -1,13 +0,0 @@
|
||||
const reportWebVitals = onPerfEntry => {
|
||||
if (onPerfEntry && onPerfEntry instanceof Function) {
|
||||
import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
|
||||
getCLS(onPerfEntry);
|
||||
getFID(onPerfEntry);
|
||||
getFCP(onPerfEntry);
|
||||
getLCP(onPerfEntry);
|
||||
getTTFB(onPerfEntry);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
export default reportWebVitals;
|
@ -1,5 +0,0 @@
|
||||
// jest-dom adds custom jest matchers for asserting on DOM nodes.
|
||||
// allows you to do things like:
|
||||
// expect(element).toHaveTextContent(/react/i)
|
||||
// learn more: https://github.com/testing-library/jest-dom
|
||||
import '@testing-library/jest-dom';
|
Loading…
Reference in New Issue
Block a user