Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 184df3f113 |
-13
@@ -5,19 +5,6 @@
|
|||||||
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>Vite + React</title>
|
<title>Vite + React</title>
|
||||||
<style>
|
|
||||||
* {
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
box-sizing: border-box;
|
|
||||||
|
|
||||||
font-family: Arial, Helvetica, sans-serif;
|
|
||||||
}
|
|
||||||
|
|
||||||
body {
|
|
||||||
background-color: rgb(249, 249, 249);
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="root"></div>
|
<div id="root"></div>
|
||||||
|
|||||||
Generated
+58
-828
File diff suppressed because it is too large
Load Diff
+1
-2
@@ -12,7 +12,7 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"react": "^19.1.0",
|
"react": "^19.1.0",
|
||||||
"react-dom": "^19.1.0",
|
"react-dom": "^19.1.0",
|
||||||
"react-icons": "^5.5.0"
|
"react-intl": "^10.1.13"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@eslint/js": "^9.25.0",
|
"@eslint/js": "^9.25.0",
|
||||||
@@ -23,7 +23,6 @@
|
|||||||
"eslint-plugin-react-hooks": "^5.2.0",
|
"eslint-plugin-react-hooks": "^5.2.0",
|
||||||
"eslint-plugin-react-refresh": "^0.4.19",
|
"eslint-plugin-react-refresh": "^0.4.19",
|
||||||
"globals": "^16.0.0",
|
"globals": "^16.0.0",
|
||||||
"sass-embedded": "^1.99.0",
|
|
||||||
"vite": "^6.3.5"
|
"vite": "^6.3.5"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+23
-96
@@ -1,103 +1,30 @@
|
|||||||
import styles from './App.module.scss'
|
import { IntlProvider,
|
||||||
import SneakersImage from './assets/images/sneakers-image.jpg'
|
FormattedMessage,
|
||||||
import { FaRegUser } from 'react-icons/fa'
|
FormattedNumber,
|
||||||
import { FaHeart } from "react-icons/fa";
|
FormattedDate,
|
||||||
import { BsCheckSquare } from "react-icons/bs";
|
FormattedTime,
|
||||||
import { useState } from 'react'
|
FormattedDateTimeRange } from 'react-intl'
|
||||||
|
import messageRu from './translations/ru.json'
|
||||||
function Header() {
|
import messageEn from './translations/en.json'
|
||||||
const handleChange = event => {
|
|
||||||
const newValue = event.target.value
|
|
||||||
console.log('Новое значение:', newValue)
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
|
||||||
<header className={styles.header}>
|
|
||||||
<div>
|
|
||||||
<h2>Store</h2>
|
|
||||||
<input type='text ' placeholder='Search...' onChange={handleChange} />
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<FaRegUser size={24} color='#3258e3' />
|
|
||||||
<button>Profile</button>
|
|
||||||
</div>
|
|
||||||
</header>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
function Product() {
|
|
||||||
function LikeCounter() {
|
|
||||||
const [likes,setLikes] = useState(0);
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<h2>Лайков: {likes}</h2>
|
|
||||||
{likes < 10 && <button onClick={() => setLikes(likes + 1)}>👍 Лайк</button>}
|
|
||||||
{likes > 0 && <button onClick={() => setLikes(0)}>🔄 Сбросить</button> }
|
|
||||||
{likes >= 10 && <h3>Вы достигли лимита!</h3>}
|
|
||||||
<div className={styles.progress}>
|
|
||||||
<div className={styles.value} style={{ width: `${likes*10}%`}}></div>
|
|
||||||
</div>
|
|
||||||
</>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
function handleClick() {
|
|
||||||
console.log('Working!')
|
|
||||||
}
|
|
||||||
|
|
||||||
function Counter() {
|
|
||||||
const [isLiked,setIsLiked] = useState(false);
|
|
||||||
|
|
||||||
const toggleLike = () => {
|
|
||||||
setIsLiked(!isLiked);
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<BsCheckSquare
|
|
||||||
onClick={toggleLike}
|
|
||||||
fill={isLiked==true ? 'red' : 'grey'}
|
|
||||||
size={44}
|
|
||||||
/>
|
|
||||||
</>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div className={styles.product}>
|
|
||||||
<img src={SneakersImage} alt='' />
|
|
||||||
<div className={styles.content}>
|
|
||||||
<div className={styles.title}>
|
|
||||||
<h4>Sneakers Red & White 2025</h4>
|
|
||||||
<button onClick={event => handleClick(event)}>+</button>
|
|
||||||
</div>
|
|
||||||
<p className={styles.description}>NIKE</p>
|
|
||||||
<p className={styles.price}>$38.00</p>
|
|
||||||
</div>
|
|
||||||
<LikeCounter />
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
function App() {
|
function App() {
|
||||||
|
const locale = 'ru';
|
||||||
|
const messages = messageEn;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div className={styles.container}>
|
<IntlProvider locale={locale} messages={messages}>
|
||||||
<Header />
|
<h1><FormattedMessage id='app.welcome' /></h1>
|
||||||
</div>
|
<h2><FormattedMessage id='app.userGreeting' values={{ name: <u>Alex</u> }} /></h2>
|
||||||
<div className={styles.container}>
|
<p><FormattedMessage id='app.notifications' values= {{count: 25}} /></p>
|
||||||
<ul className={styles.list}>
|
<p><FormattedMessage id='app.lastLogin' values={{ date: new Date(), time: new Date()}} /></p>
|
||||||
<li>
|
<p><FormattedNumber value={ 999.99 } style='currency' currency='RUB' /></p>
|
||||||
<Product />
|
<p><FormattedNumber value={0.56} style='percent' /></p>
|
||||||
</li>
|
<p><FormattedNumber value={1234.567} minimumFractionDigits={2} maximumFractionDigits={2} /></p>
|
||||||
<li>
|
<p><FormattedDate value={new Date()} weekday='long' /></p>
|
||||||
<Product />
|
<p><FormattedTime value={new Date()} hour='2-digit' minute='2-digit' second='2-digit' /></p>
|
||||||
</li>
|
<p><FormattedDateTimeRange from={new Date(2026,6,1,10,0)} to={new Date(2026,6,10,9,0)} /></p>
|
||||||
<li>
|
</IntlProvider>
|
||||||
<Product />
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,141 +0,0 @@
|
|||||||
@use './assets/styles/variables' as *;
|
|
||||||
|
|
||||||
.progress {
|
|
||||||
width: 100%;
|
|
||||||
height: 10px;
|
|
||||||
border: 1px solid black;
|
|
||||||
|
|
||||||
}
|
|
||||||
.value {
|
|
||||||
/*width:70%;*/
|
|
||||||
height: 100%;
|
|
||||||
background-color: green;
|
|
||||||
}
|
|
||||||
|
|
||||||
.header {
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
align-items: center;
|
|
||||||
|
|
||||||
padding: 20px;
|
|
||||||
background-color: white;
|
|
||||||
|
|
||||||
border-bottom-left-radius: 10px;
|
|
||||||
border-bottom-right-radius: 10px;
|
|
||||||
|
|
||||||
div {
|
|
||||||
&:first-child {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 20px;
|
|
||||||
|
|
||||||
h2 {
|
|
||||||
color: $primary-color;
|
|
||||||
}
|
|
||||||
|
|
||||||
input {
|
|
||||||
border-radius: 5px;
|
|
||||||
outline: none;
|
|
||||||
font-size: 16px;
|
|
||||||
border: 1px solid gainsboro;
|
|
||||||
padding: 5px 10px;
|
|
||||||
|
|
||||||
&:focus {
|
|
||||||
border: 1px solid $primary-color;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
&:last-child {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 10px;
|
|
||||||
|
|
||||||
button {
|
|
||||||
outline: 0;
|
|
||||||
border: 0;
|
|
||||||
border-radius: 5px;
|
|
||||||
padding: 5px 15px;
|
|
||||||
font-size: 16px;
|
|
||||||
background-color: $primary-color;
|
|
||||||
color: $white-color;
|
|
||||||
font-weight: 600;
|
|
||||||
cursor: pointer;
|
|
||||||
|
|
||||||
&:hover {
|
|
||||||
background-color: $seconday-color;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.container {
|
|
||||||
max-width: 1220px;
|
|
||||||
margin: 0 auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
.list {
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
border-radius: 10px;
|
|
||||||
margin-top: 100px; /* временно */
|
|
||||||
padding: 20px;
|
|
||||||
background-color: white;
|
|
||||||
list-style: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.product {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
width: 350px;
|
|
||||||
gap: 20px;
|
|
||||||
border-radius: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.content {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
gap: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.title {
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
align-items: center;
|
|
||||||
|
|
||||||
h4 {
|
|
||||||
font-size: 18px;
|
|
||||||
}
|
|
||||||
|
|
||||||
button {
|
|
||||||
border: 1px solid $primary-color;
|
|
||||||
background-color: $white-color;
|
|
||||||
color: $primary-color;
|
|
||||||
border-radius: 5px;
|
|
||||||
outline: 0;
|
|
||||||
|
|
||||||
font-size: 20px;
|
|
||||||
padding: 5px 10px;
|
|
||||||
|
|
||||||
cursor: pointer;
|
|
||||||
|
|
||||||
&:hover {
|
|
||||||
background-color: $seconday-color;
|
|
||||||
color: $white-color;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
img {
|
|
||||||
border-radius: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.description {
|
|
||||||
color: gray;
|
|
||||||
}
|
|
||||||
|
|
||||||
.price {
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 23 KiB |
@@ -1,5 +0,0 @@
|
|||||||
$white-color: white;
|
|
||||||
$black-color: black;
|
|
||||||
|
|
||||||
$primary-color: #3258e3;
|
|
||||||
$seconday-color: #4432e3;
|
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
import { StrictMode } from 'react'
|
import { StrictMode } from 'react'
|
||||||
import { createRoot } from 'react-dom/client'
|
import { createRoot } from 'react-dom/client'
|
||||||
|
// удаляем import './index.css'
|
||||||
import App from './App.jsx'
|
import App from './App.jsx'
|
||||||
|
|
||||||
createRoot(document.getElementById('root')).render(
|
createRoot(document.getElementById('root')).render(
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"app.welcome": "welcome to React application",
|
||||||
|
"app.userGreeting": "Hello, {name}",
|
||||||
|
"app.notifications": "You have {count, plural, one {# a notification} few {# are notifications} many {# уведомлений} other {# уведомления}}",
|
||||||
|
"app.lastLogin": "Last login was {date,date,long} in {time,time,short}"
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"app.welcome": "добро пожаловать в приложение React",
|
||||||
|
"app.userGreeting": "Здравствуйте, {name}",
|
||||||
|
"app.notifications": "У вас {count, plural, one {# уведомление} few {# уведомления} many {# уведомлений} other {# уведомления}}",
|
||||||
|
"app.lastLogin": "Последний вход был {date,date,long} в {time,time,short}"
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user