Browse Source

HW react first part jsx

Ivar 2 năm trước cách đây
mục cha
commit
3f59e75e6b
100 tập tin đã thay đổi với 58080 bổ sung53 xóa
  1. 4 4
      js/18_redux-thunk-3/index.html
  2. 1 1
      js/18_redux-thunk-3/index.js
  3. 0 0
      js/22_react_cw/elements/.gitignore
  4. 0 0
      js/22_react_cw/elements/README.md
  5. 0 0
      js/22_react_cw/elements/package-lock.json
  6. 0 0
      js/22_react_cw/elements/package.json
  7. 0 0
      js/22_react_cw/elements/public/favicon.ico
  8. 0 0
      js/22_react_cw/elements/public/index.html
  9. 0 0
      js/22_react_cw/elements/public/logo192.png
  10. 0 0
      js/22_react_cw/elements/public/logo512.png
  11. 0 0
      js/22_react_cw/elements/public/manifest.json
  12. 0 0
      js/22_react_cw/elements/public/robots.txt
  13. 399 0
      js/22_react_cw/elements/src/App.js
  14. 18 0
      js/22_react-1/shop/src/App.scss
  15. 0 0
      js/22_react_cw/elements/src/App.test.js
  16. 0 0
      js/22_react_cw/elements/src/index.js
  17. 0 0
      js/22_react_cw/elements/src/index.scss
  18. 0 0
      js/22_react_cw/elements/src/logo.svg
  19. 0 0
      js/22_react_cw/elements/src/reportWebVitals.js
  20. 0 0
      js/22_react_cw/elements/src/setupTests.js
  21. 0 0
      js/22_react_cw/package-lock.json
  22. 0 0
      js/22_react_cw/package.json
  23. 0 0
      js/22_react_cw/shop-1/.gitignore
  24. 0 0
      js/22_react_cw/shop-1/README.md
  25. 0 0
      js/22_react_cw/shop-1/package-lock.json
  26. 0 0
      js/22_react_cw/shop-1/package.json
  27. 0 0
      js/22_react_cw/shop-1/public/favicon.ico
  28. 0 0
      js/22_react_cw/shop-1/public/index.html
  29. 0 0
      js/22_react_cw/shop-1/public/logo192.png
  30. 0 0
      js/22_react_cw/shop-1/public/logo512.png
  31. 0 0
      js/22_react_cw/shop-1/public/manifest.json
  32. 0 0
      js/22_react_cw/shop-1/public/robots.txt
  33. 0 0
      js/22_react_cw/shop-1/src/App.js
  34. 0 0
      js/22_react_cw/shop-1/src/App.scss
  35. 0 0
      js/22_react_cw/shop-1/src/App.test.js
  36. 0 0
      js/22_react_cw/shop-1/src/index.js
  37. 0 0
      js/22_react_cw/shop-1/src/index.scss
  38. 0 0
      js/22_react_cw/shop-1/src/logo.svg
  39. 0 0
      js/22_react_cw/shop-1/src/reportWebVitals.js
  40. 0 0
      js/22_react_cw/shop-1/src/setupTests.js
  41. 0 0
      js/22_react_cw/shop-2/.gitignore
  42. 0 0
      js/22_react_cw/shop-2/README.md
  43. 27769 0
      js/22_react_cw/shop-2/package-lock.json
  44. 43 0
      js/22_react_cw/shop-2/package.json
  45. 0 0
      js/22_react_cw/shop-2/public/favicon.ico
  46. 0 0
      js/22_react_cw/shop-2/public/index.html
  47. 0 0
      js/22_react_cw/shop-2/public/logo192.png
  48. 0 0
      js/22_react_cw/shop-2/public/logo512.png
  49. 0 0
      js/22_react_cw/shop-2/public/manifest.json
  50. 0 0
      js/22_react_cw/shop-2/public/robots.txt
  51. 7 11
      js/22_react-1/shop-2/src/App.js
  52. 60 0
      js/22_react_cw/shop-2/src/App.scss
  53. 0 0
      js/22_react_cw/shop-2/src/App.test.js
  54. 0 0
      js/22_react_cw/shop-2/src/index.js
  55. 0 0
      js/22_react_cw/shop-2/src/index.scss
  56. 0 0
      js/22_react_cw/shop-2/src/logo.svg
  57. 0 0
      js/22_react_cw/shop-2/src/reportWebVitals.js
  58. 0 0
      js/22_react_cw/shop-2/src/setupTests.js
  59. 0 0
      js/23_react_hw/package-lock.json
  60. 0 0
      js/23_react_hw/package.json
  61. 23 0
      js/23_react_hw/react_hw/.gitignore
  62. 70 0
      js/23_react_hw/react_hw/README.md
  63. 15 0
      js/23_react_hw-2/hw/package-lock.json
  64. 1 0
      js/23_react_hw-2/hw/package.json
  65. BIN
      js/23_react_hw/react_hw/public/favicon.ico
  66. 43 0
      js/23_react_hw/react_hw/public/index.html
  67. BIN
      js/23_react_hw/react_hw/public/logo192.png
  68. BIN
      js/23_react_hw/react_hw/public/logo512.png
  69. 25 0
      js/23_react_hw/react_hw/public/manifest.json
  70. 3 0
      js/23_react_hw/react_hw/public/robots.txt
  71. 124 0
      js/23_react_hw/react_hw/src/App.js
  72. 0 0
      js/23_react_hw/react_hw/src/App.scss
  73. 8 0
      js/23_react_hw/react_hw/src/App.test.js
  74. 17 0
      js/23_react_hw/react_hw/src/index.js
  75. 13 0
      js/23_react_hw/react_hw/src/index.scss
  76. 1 0
      js/23_react_hw/react_hw/src/logo.svg
  77. 13 0
      js/23_react_hw/react_hw/src/reportWebVitals.js
  78. 5 0
      js/23_react_hw/react_hw/src/setupTests.js
  79. 0 13
      js/24_react_shop/index.html
  80. 0 24
      js/24_react_shop/index.js
  81. 1129 0
      js/24_react_shop/package-lock.json
  82. 5 0
      js/24_react_shop/package.json
  83. 23 0
      js/24_react_shop/react_shop/.gitignore
  84. 70 0
      js/24_react_shop/react_shop/README.md
  85. 28019 0
      js/24_react_shop/react_shop/package-lock.json
  86. 43 0
      js/24_react_shop/react_shop/package.json
  87. BIN
      js/24_react_shop/react_shop/public/favicon.ico
  88. 43 0
      js/24_react_shop/react_shop/public/index.html
  89. BIN
      js/24_react_shop/react_shop/public/logo192.png
  90. BIN
      js/24_react_shop/react_shop/public/logo512.png
  91. 25 0
      js/24_react_shop/react_shop/public/manifest.json
  92. 3 0
      js/24_react_shop/react_shop/public/robots.txt
  93. 6 0
      js/23_react_hw-2/hw/src/App.js
  94. 0 0
      js/24_react_shop/react_shop/src/App.scss
  95. 8 0
      js/24_react_shop/react_shop/src/App.test.js
  96. 17 0
      js/24_react_shop/react_shop/src/index.js
  97. 13 0
      js/24_react_shop/react_shop/src/index.scss
  98. 1 0
      js/24_react_shop/react_shop/src/logo.svg
  99. 13 0
      js/24_react_shop/react_shop/src/reportWebVitals.js
  100. 0 0
      js/24_react_shop/react_shop/src/setupTests.js

+ 4 - 4
js/18_redux-thunk-3/index.html

@@ -17,7 +17,9 @@
 
         <header class="bg-light">
 
-          <a class="logo" href="">ГЛАВНАЯ</a>
+          <a class="logo" href="">
+            ГЛАВНАЯ
+          </a>
 
           <div class="head-info">
             <a id="cartIcon" href="#/cart">
@@ -35,11 +37,9 @@
         <div id='mainContainer'>
   
             <aside id='aside'>
-                
             </aside>    
   
-            <main id='main'>              
-                
+            <main id='main'>            
             </main>
   
         </div>

+ 1 - 1
js/18_redux-thunk-3/index.js

@@ -529,12 +529,12 @@ const createCartPage = (parent) => {
     const total  = document.createElement('h5')
     total.classList = 'totalCart'
     total.innerText = `Всего к оплате: ${cartCounter} грн`
-    parent.append(total)
 
     const sendOrder = document.createElement('button')
     sendOrder.classList = 'btn btn-primary cartBtn'
     sendOrder.innerText = "ОФОРМИТЬ ЗАКАЗ"
     if(Object.keys(cart).length !== 0) {
+        parent.append(total)
         parent.append(sendOrder)
     }
     const {auth} = store.getState()

js/22_react-1/shop-2/.gitignore → js/22_react_cw/elements/.gitignore


js/22_react-1/shop-2/README.md → js/22_react_cw/elements/README.md


js/22_react-1/shop-2/package-lock.json → js/22_react_cw/elements/package-lock.json


js/22_react-1/shop-2/package.json → js/22_react_cw/elements/package.json


js/22_react-1/shop-2/public/favicon.ico → js/22_react_cw/elements/public/favicon.ico


js/22_react-1/shop-2/public/index.html → js/22_react_cw/elements/public/index.html


js/22_react-1/shop-2/public/logo192.png → js/22_react_cw/elements/public/logo192.png


js/22_react-1/shop-2/public/logo512.png → js/22_react_cw/elements/public/logo512.png


js/22_react-1/shop-2/public/manifest.json → js/22_react_cw/elements/public/manifest.json


js/22_react-1/shop-2/public/robots.txt → js/22_react_cw/elements/public/robots.txt


+ 399 - 0
js/22_react_cw/elements/src/App.js

@@ -0,0 +1,399 @@
+import React, {useState, useEffect, useRef} from 'react'
+import logoDefault from './logo.svg';
+import './App.scss';
+import {Provider, connect}   from 'react-redux';
+import {createStore, combineReducers, applyMiddleware} from 'redux';
+import thunk from 'redux-thunk';
+
+
+const Dots = ({active, count, onDot}) => {
+    const arr = []
+    for (let i=0; i<count; i++) {
+        arr.push(i)
+    }
+    return (
+        <div className='dotParent'>
+            {arr.map((i) => (i === active) ? <div className='dot red' onClick={() => onDot(i)}></div> : <div className='dot' onClick={() => onDot(i)}></div>)}
+        </div>
+    )
+}  
+
+const Gallery = ({images=[  'https://upload.wikimedia.org/wikipedia/commons/7/70/Cabbage.jpg', 
+                            'https://upload.wikimedia.org/wikipedia/commons/thumb/a/a8/Brassica_%28decorative_cultivar%29_01.jpg/800px-Brassica_%28decorative_cultivar%29_01.jpg', 
+                            'https://upload.wikimedia.org/wikipedia/commons/thumb/5/5c/Brassica_oleracea.jpg/800px-Brassica_oleracea.jpg', 
+                            'https://upload.wikimedia.org/wikipedia/commons/thumb/0/08/Growing_Cauliflower.jpg/800px-Growing_Cauliflower.jpg', 
+                            'https://upload.wikimedia.org/wikipedia/commons/thumb/1/11/Brassica_oleracea0.jpg/800px-Brassica_oleracea0.jpg', 
+                            'https://upload.wikimedia.org/wikipedia/commons/c/c5/Cab-spring.jpg']}) => {
+
+    const [imgNumber, setImgNumber] = useState(0)
+
+    return (
+        <>
+            <button onClick={() => setImgNumber(imgNumber => (imgNumber > 0) ? (imgNumber - 1) : (images.length - 1))}>prev</button>
+            <img  src={images[imgNumber]} onClick={() => setImgNumber(imgNumber => (imgNumber < images.length - 1) ? (imgNumber + 1) : (0))}/>
+            <button onClick={() => setImgNumber(imgNumber => (imgNumber < images.length - 1) ? (imgNumber + 1) : (0))}>next</button>
+
+            <Dots active={imgNumber} count={images.length} onDot={(dotIndex) => setImgNumber(dotIndex)}/>
+        </>
+    )
+}
+
+
+
+
+const countries = {
+    "AF": "Afghanistan",
+    "AX": "Aland Islands",
+    "AL": "Albania",
+    "DZ": "Algeria",
+    "AS": "American Samoa",
+    "AD": "Andorra",
+    "AO": "Angola",
+    "AI": "Anguilla",
+    "AQ": "Antarctica",
+    "AG": "Antigua And Barbuda",
+    "AR": "Argentina",
+    "AM": "Armenia",
+    "AW": "Aruba",
+    "AU": "Australia",
+    "AT": "Austria",
+    "AZ": "Azerbaijan",
+    "BS": "Bahamas",
+    "BH": "Bahrain",
+    "BD": "Bangladesh",
+    "BB": "Barbados",
+    "BY": "Belarus",
+    "BE": "Belgium",
+    "BZ": "Belize",
+    "BJ": "Benin",
+    "BM": "Bermuda",
+    "BT": "Bhutan",
+    "BO": "Bolivia",
+    "BA": "Bosnia And Herzegovina",
+    "BW": "Botswana",
+    "BV": "Bouvet Island",
+    "BR": "Brazil",
+    "IO": "British Indian Ocean Territory",
+    "BN": "Brunei Darussalam",
+    "BG": "Bulgaria",
+    "BF": "Burkina Faso",
+    "BI": "Burundi",
+    "KH": "Cambodia",
+    "CM": "Cameroon",
+    "CA": "Canada",
+    "CV": "Cape Verde",
+    "KY": "Cayman Islands",
+    "CF": "Central African Republic",
+    "TD": "Chad",
+    "CL": "Chile",
+    "CN": "China",
+    "CX": "Christmas Island",
+    "CC": "Cocos (Keeling) Islands",
+    "CO": "Colombia",
+    "KM": "Comoros",
+    "CG": "Congo",
+    "CD": "Congo, Democratic Republic",
+    "CK": "Cook Islands",
+    "CR": "Costa Rica",
+    "CI": "Cote D\"Ivoire",
+    "HR": "Croatia",
+    "CU": "Cuba",
+    "CY": "Cyprus",
+    "CZ": "Czech Republic",
+    "DK": "Denmark",
+    "DJ": "Djibouti",
+    "DM": "Dominica",
+    "DO": "Dominican Republic",
+    "EC": "Ecuador",
+    "EG": "Egypt",
+    "SV": "El Salvador",
+    "GQ": "Equatorial Guinea",
+    "ER": "Eritrea",
+    "EE": "Estonia",
+    "ET": "Ethiopia",
+    "FK": "Falkland Islands (Malvinas)",
+    "FO": "Faroe Islands",
+    "FJ": "Fiji",
+    "FI": "Finland",
+    "FR": "France",
+    "GF": "French Guiana",
+    "PF": "French Polynesia",
+    "TF": "French Southern Territories",
+    "GA": "Gabon",
+    "GM": "Gambia",
+    "GE": "Georgia",
+    "DE": "Germany",
+    "GH": "Ghana",
+    "GI": "Gibraltar",
+    "GR": "Greece",
+    "GL": "Greenland",
+    "GD": "Grenada",
+    "GP": "Guadeloupe",
+    "GU": "Guam",
+    "GT": "Guatemala",
+    "GG": "Guernsey",
+    "GN": "Guinea",
+    "GW": "Guinea-Bissau",
+    "GY": "Guyana",
+    "HT": "Haiti",
+    "HM": "Heard Island & Mcdonald Islands",
+    "VA": "Holy See (Vatican City State)",
+    "HN": "Honduras",
+    "HK": "Hong Kong",
+    "HU": "Hungary",
+    "IS": "Iceland",
+    "IN": "India",
+    "ID": "Indonesia",
+    "IR": "Iran, Islamic Republic Of",
+    "IQ": "Iraq",
+    "IE": "Ireland",
+    "IM": "Isle Of Man",
+    "IL": "Israel",
+    "IT": "Italy",
+    "JM": "Jamaica",
+    "JP": "Japan",
+    "JE": "Jersey",
+    "JO": "Jordan",
+    "KZ": "Kazakhstan",
+    "KE": "Kenya",
+    "KI": "Kiribati",
+    "KR": "Korea",
+    "KP": "North Korea",
+    "KW": "Kuwait",
+    "KG": "Kyrgyzstan",
+    "LA": "Lao People\"s Democratic Republic",
+    "LV": "Latvia",
+    "LB": "Lebanon",
+    "LS": "Lesotho",
+    "LR": "Liberia",
+    "LY": "Libyan Arab Jamahiriya",
+    "LI": "Liechtenstein",
+    "LT": "Lithuania",
+    "LU": "Luxembourg",
+    "MO": "Macao",
+    "MK": "Macedonia",
+    "MG": "Madagascar",
+    "MW": "Malawi",
+    "MY": "Malaysia",
+    "MV": "Maldives",
+    "ML": "Mali",
+    "MT": "Malta",
+    "MH": "Marshall Islands",
+    "MQ": "Martinique",
+    "MR": "Mauritania",
+    "MU": "Mauritius",
+    "YT": "Mayotte",
+    "MX": "Mexico",
+    "FM": "Micronesia, Federated States Of",
+    "MD": "Moldova",
+    "MC": "Monaco",
+    "MN": "Mongolia",
+    "ME": "Montenegro",
+    "MS": "Montserrat",
+    "MA": "Morocco",
+    "MZ": "Mozambique",
+    "MM": "Myanmar",
+    "NA": "Namibia",
+    "NR": "Nauru",
+    "NP": "Nepal",
+    "NL": "Netherlands",
+    "AN": "Netherlands Antilles",
+    "NC": "New Caledonia",
+    "NZ": "New Zealand",
+    "NI": "Nicaragua",
+    "NE": "Niger",
+    "NG": "Nigeria",
+    "NU": "Niue",
+    "NF": "Norfolk Island",
+    "MP": "Northern Mariana Islands",
+    "NO": "Norway",
+    "OM": "Oman",
+    "PK": "Pakistan",
+    "PW": "Palau",
+    "PS": "Palestinian Territory, Occupied",
+    "PA": "Panama",
+    "PG": "Papua New Guinea",
+    "PY": "Paraguay",
+    "PE": "Peru",
+    "PH": "Philippines",
+    "PN": "Pitcairn",
+    "PL": "Poland",
+    "PT": "Portugal",
+    "PR": "Puerto Rico",
+    "QA": "Qatar",
+    "RE": "Reunion",
+    "RO": "Romania",
+    "RU": "Russian Federation",
+    "RW": "Rwanda",
+    "BL": "Saint Barthelemy",
+    "SH": "Saint Helena",
+    "KN": "Saint Kitts And Nevis",
+    "LC": "Saint Lucia",
+    "MF": "Saint Martin",
+    "PM": "Saint Pierre And Miquelon",
+    "VC": "Saint Vincent And Grenadines",
+    "WS": "Samoa",
+    "SM": "San Marino",
+    "ST": "Sao Tome And Principe",
+    "SA": "Saudi Arabia",
+    "SN": "Senegal",
+    "RS": "Serbia",
+    "SC": "Seychelles",
+    "SL": "Sierra Leone",
+    "SG": "Singapore",
+    "SK": "Slovakia",
+    "SI": "Slovenia",
+    "SB": "Solomon Islands",
+    "SO": "Somalia",
+    "ZA": "South Africa",
+    "GS": "South Georgia And Sandwich Isl.",
+    "ES": "Spain",
+    "LK": "Sri Lanka",
+    "SD": "Sudan",
+    "SR": "Suriname",
+    "SJ": "Svalbard And Jan Mayen",
+    "SZ": "Swaziland",
+    "SE": "Sweden",
+    "CH": "Switzerland",
+    "SY": "Syrian Arab Republic",
+    "TW": "Taiwan",
+    "TJ": "Tajikistan",
+    "TZ": "Tanzania",
+    "TH": "Thailand",
+    "TL": "Timor-Leste",
+    "TG": "Togo",
+    "TK": "Tokelau",
+    "TO": "Tonga",
+    "TT": "Trinidad And Tobago",
+    "TN": "Tunisia",
+    "TR": "Turkey",
+    "TM": "Turkmenistan",
+    "TC": "Turks And Caicos Islands",
+    "TV": "Tuvalu",
+    "UG": "Uganda",
+    "UA": "Ukraine",
+    "AE": "United Arab Emirates",
+    "GB": "United Kingdom",
+    "US": "United States",
+    "UM": "United States Outlying Islands",
+    "UY": "Uruguay",
+    "UZ": "Uzbekistan",
+    "VU": "Vanuatu",
+    "VE": "Venezuela",
+    "VN": "Vietnam",
+    "VG": "Virgin Islands, British",
+    "VI": "Virgin Islands, U.S.",
+    "WF": "Wallis And Futuna",
+    "EH": "Western Sahara",
+    "YE": "Yemen",
+    "ZM": "Zambia",
+    "ZW": "Zimbabwe"
+}
+
+const MySelect = ({options=countries, value='ZW', onChange}) => (
+    <select defaultValue={value} onChange={(e) => onChange(e.target.value)}>
+        {Object.entries(options).map(([key, cont]) => <option value={key}>{key}: {cont}</option> )}
+    </select>
+)
+
+
+
+
+const PhoneBookEntry = ({data={name:'',phone:''}, index,    onChange, 
+                                                            onMoveUp, 
+                                                            onMoveDown, 
+                                                            onDelete, 
+                                                            onAdd}) => (
+    <div>        
+        <input type="text" value={data.name} onChange={(e) => onChange({name: e.target.value, phone: data.phone}, index)} />
+        <input type="number" value={data.phone} onChange={(e) => onChange({name: data.name, phone: e.target.value}, index)} />
+        <button onClick={onMoveUp}>^</button>
+        <button onClick={onMoveDown}>v</button>
+        <button onClick={onDelete}>x</button>
+        <button onClick={onAdd}>+</button>
+    </div>
+)
+
+const defaultPeople =  [{name: 'Vasya', phone: '101'}, {name: 'Jhon', phone: '102'}, {name: 'Paul', phone: '103'}]
+
+const PhoneBook = ({people=defaultPeople, onSave}) => {
+    const [ppl, setPpl] = useState(people)
+    const [keys, setKeys] = useState(people.map(() => Math.random()))
+    //const {current: keys}  = useRef(people.map(() => Math.random()))
+
+    useEffect(() => {
+        setPpl(people)
+        setKeys(people.map(() => Math.random()))
+    }, [people])
+
+    const onChange = (newData, i) => {
+        ppl[i] = newData
+        setPpl([...ppl])
+    }
+    const onMoveUp = (i) => {
+        if (i > 0) {
+            [ppl[i-1], ppl[i]] = [ppl[i], ppl[i-1]];
+            [keys[i-1], keys[i]] = [keys[i], keys[i-1]]
+        }     
+        setPpl([...ppl])
+        setKeys([...keys])
+    }
+    const onMoveDown = (i) => {
+        if (i < ppl.length - 1) {
+            [ppl[i], ppl[i+1]] = [ppl[i+1], ppl[i]];
+            [keys[i], keys[i+1]] = [keys[i+1], keys[i]]
+        }
+        setPpl([...ppl])
+        setKeys([...keys])
+    }
+    const onDelete = (i) => {
+        setPpl(ppl.filter((el, index) => index !== i)) 
+        setKeys(keys.filter((el, index) => index !== i)) 
+    }
+    const onAdd = (i) => {
+        ppl.splice(i+1, 0, {name:'',phone:''})
+        keys.splice(i+1, 0, Math.random())
+        setPpl([...ppl])
+        setKeys([...keys])
+    }
+    return (
+        <>
+            <button onClick={() => {    setPpl([{name:'',phone:''}, ...ppl])
+                                        setKeys([Math.random(), ...keys])   
+                                    } }>+</button>
+            <div className='PhoneBook'>
+                {ppl.map((data, i) => (
+                    <PhoneBookEntry data={data} index={i}
+                        onChange={onChange}
+                        onMoveUp={() => onMoveUp(i)}
+                        onMoveDown={() => onMoveDown(i)}
+                        onDelete={() => onDelete(i)}
+                        onAdd={() => onAdd(i)}
+                                                />)
+                                                    )}
+            </div>
+            <button onClick={() => onSave(ppl, keys)}>Save</button>
+        </>
+    )
+}
+
+
+
+function App() {
+    const [country, setCountry] = useState('UA')
+    console.log(country)
+
+  return (
+    <div className="App">
+
+        <Gallery />     
+
+        <MySelect value={country} onChange={newCountry => setCountry(newCountry)}/>  
+
+        <PhoneBook onSave={(ppl, keys) => console.log(ppl, keys)}/> 
+
+    </div>
+  )
+}
+
+export default App;

+ 18 - 0
js/22_react-1/shop/src/App.scss

@@ -1,4 +1,22 @@
 
+.dotParent {
+  display: flex;
+}
+
+.dot {
+  border-radius: 50%;
+  background-color: #000000;
+  width: 20px;
+  height: 20px;
+  margin: 0 10px;
+}
+
+.red {
+  background-color: #ff0000;
+}
+
+
+
 .Logo {
   img {
     max-height: 100px;

js/22_react-1/shop-2/src/App.test.js → js/22_react_cw/elements/src/App.test.js


js/22_react-1/shop-2/src/index.js → js/22_react_cw/elements/src/index.js


js/22_react-1/shop-2/src/index.scss → js/22_react_cw/elements/src/index.scss


js/22_react-1/shop-2/src/logo.svg → js/22_react_cw/elements/src/logo.svg


js/22_react-1/shop-2/src/reportWebVitals.js → js/22_react_cw/elements/src/reportWebVitals.js


js/22_react-1/shop-2/src/setupTests.js → js/22_react_cw/elements/src/setupTests.js


js/22_react-1/package-lock.json → js/22_react_cw/package-lock.json


js/22_react-1/package.json → js/22_react_cw/package.json


js/22_react-1/shop/.gitignore → js/22_react_cw/shop-1/.gitignore


js/22_react-1/shop/README.md → js/22_react_cw/shop-1/README.md


js/22_react-1/shop/package-lock.json → js/22_react_cw/shop-1/package-lock.json


js/22_react-1/shop/package.json → js/22_react_cw/shop-1/package.json


js/22_react-1/shop/public/favicon.ico → js/22_react_cw/shop-1/public/favicon.ico


js/22_react-1/shop/public/index.html → js/22_react_cw/shop-1/public/index.html


js/22_react-1/shop/public/logo192.png → js/22_react_cw/shop-1/public/logo192.png


js/22_react-1/shop/public/logo512.png → js/22_react_cw/shop-1/public/logo512.png


js/22_react-1/shop/public/manifest.json → js/22_react_cw/shop-1/public/manifest.json


js/22_react-1/shop/public/robots.txt → js/22_react_cw/shop-1/public/robots.txt


js/22_react-1/shop/src/App.js → js/22_react_cw/shop-1/src/App.js


js/22_react-1/shop-2/src/App.scss → js/22_react_cw/shop-1/src/App.scss


js/22_react-1/shop/src/App.test.js → js/22_react_cw/shop-1/src/App.test.js


js/22_react-1/shop/src/index.js → js/22_react_cw/shop-1/src/index.js


js/22_react-1/shop/src/index.scss → js/22_react_cw/shop-1/src/index.scss


js/22_react-1/shop/src/logo.svg → js/22_react_cw/shop-1/src/logo.svg


js/22_react-1/shop/src/reportWebVitals.js → js/22_react_cw/shop-1/src/reportWebVitals.js


js/22_react-1/shop/src/setupTests.js → js/22_react_cw/shop-1/src/setupTests.js


js/23_react_hw-2/hw/.gitignore → js/22_react_cw/shop-2/.gitignore


js/23_react_hw-2/hw/README.md → js/22_react_cw/shop-2/README.md


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 27769 - 0
js/22_react_cw/shop-2/package-lock.json


+ 43 - 0
js/22_react_cw/shop-2/package.json

@@ -0,0 +1,43 @@
+{
+  "name": "shop",
+  "version": "0.1.0",
+  "private": true,
+  "dependencies": {
+    "@testing-library/jest-dom": "^5.16.1",
+    "@testing-library/react": "^12.1.2",
+    "@testing-library/user-event": "^13.5.0",
+    "react": "^17.0.2",
+    "react-dom": "^17.0.2",
+    "react-redux": "^7.2.6",
+    "react-router-dom": "^6.1.1",
+    "react-scripts": "5.0.0",
+    "redux": "^4.1.2",
+    "redux-thunk": "^2.4.1",
+    "sass": "^1.45.0",
+    "web-vitals": "^2.1.2"
+  },
+  "scripts": {
+    "start": "react-scripts start",
+    "build": "react-scripts build",
+    "test": "react-scripts test",
+    "eject": "react-scripts eject"
+  },
+  "eslintConfig": {
+    "extends": [
+      "react-app",
+      "react-app/jest"
+    ]
+  },
+  "browserslist": {
+    "production": [
+      ">0.2%",
+      "not dead",
+      "not op_mini all"
+    ],
+    "development": [
+      "last 1 chrome version",
+      "last 1 firefox version",
+      "last 1 safari version"
+    ]
+  }
+}

js/23_react_hw-2/hw/public/favicon.ico → js/22_react_cw/shop-2/public/favicon.ico


js/23_react_hw-2/hw/public/index.html → js/22_react_cw/shop-2/public/index.html


js/23_react_hw-2/hw/public/logo192.png → js/22_react_cw/shop-2/public/logo192.png


js/23_react_hw-2/hw/public/logo512.png → js/22_react_cw/shop-2/public/logo512.png


js/23_react_hw-2/hw/public/manifest.json → js/22_react_cw/shop-2/public/manifest.json


js/23_react_hw-2/hw/public/robots.txt → js/22_react_cw/shop-2/public/robots.txt


+ 7 - 11
js/22_react-1/shop-2/src/App.js

@@ -470,25 +470,21 @@ const CLoginForm = connect(null, {onLogin: actionFullLogin})(LoginForm)
 
 
 
-
-
-
-
-
 function App() {
     const worstka = <h1>{Math.random()}</h1>
     const worstkaNative = React.createElement("h1", null, Math.random())
     const worstkaNative2 = React.createElement("h1", {children: [Math.random()]})
-    console.log(worstkaNative2)
+    // console.log(worstkaNative2)
     const listQQQ = React.createElement(List2, {data:["aaaa", "uuuuuuu", "сиги"]})
 
-  return (
+    return (
     <Provider store={store}>
         <div className="App">
-            {/* <LoginForm onLogin={(l,p) => console.log(l,p)}/>
+          
+            <LoginForm onLogin={(l,p) => console.log(l,p)}/>
             <CLoginForm/>
 
-            <Input />
+            {/* <Input />
             
             {worstka}
             {worstkaNative}
@@ -497,9 +493,9 @@ function App() {
 
             <Timers/>
 
-            {/* <Spoiler> 
+            <Spoiler> 
                 <Timer/>
-            </Spoiler> */}
+            </Spoiler>
 
             <Spoiler> 
                 <RGBInput/>

+ 60 - 0
js/22_react_cw/shop-2/src/App.scss

@@ -0,0 +1,60 @@
+
+.dotParent {
+  display: flex;
+}
+
+.dot {
+  border-radius: 50%;
+  background-color: #000000;
+  width: 20px;
+  height: 20px;
+  margin: 0 10px;
+}
+
+.red {
+  background-color: #ff0000;
+}
+
+
+
+.Logo {
+  img {
+    max-height: 100px;
+  }
+}
+
+.GoodCard {
+  border: 1px solid black;
+  border-radius: 15px;
+  margin: 15px;
+  img {
+    max-width: 300px;
+  }
+}
+
+.App {
+  text-align: center;
+  header {
+    .Logo {
+      img {
+        max-height: 100px;
+      }
+    }
+  }
+  main {
+    display: flex;
+    flex-direction: row;
+    aside {
+      width: 30%;
+      background-color: cyan;
+    }
+  }
+  footer {
+    background-color: #303030;
+    .Logo {
+      img {
+        max-height: 200px;
+      }
+    }
+  }
+}

js/23_react_hw-2/hw/src/App.test.js → js/22_react_cw/shop-2/src/App.test.js


js/23_react_hw-2/hw/src/index.js → js/22_react_cw/shop-2/src/index.js


js/23_react_hw-2/hw/src/index.scss → js/22_react_cw/shop-2/src/index.scss


js/23_react_hw-2/hw/src/logo.svg → js/22_react_cw/shop-2/src/logo.svg


js/23_react_hw-2/hw/src/reportWebVitals.js → js/22_react_cw/shop-2/src/reportWebVitals.js


js/23_react_hw-2/hw/src/setupTests.js → js/22_react_cw/shop-2/src/setupTests.js


js/23_react_hw-2/package-lock.json → js/23_react_hw/package-lock.json


js/23_react_hw-2/package.json → js/23_react_hw/package.json


+ 23 - 0
js/23_react_hw/react_hw/.gitignore

@@ -0,0 +1,23 @@
+# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
+
+# dependencies
+/node_modules
+/.pnp
+.pnp.js
+
+# testing
+/coverage
+
+# production
+/build
+
+# misc
+.DS_Store
+.env.local
+.env.development.local
+.env.test.local
+.env.production.local
+
+npm-debug.log*
+yarn-debug.log*
+yarn-error.log*

+ 70 - 0
js/23_react_hw/react_hw/README.md

@@ -0,0 +1,70 @@
+# Getting Started with Create React App
+
+This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
+
+## Available Scripts
+
+In the project directory, you can run:
+
+### `npm start`
+
+Runs the app in the development mode.\
+Open [http://localhost:3000](http://localhost:3000) to view it in your browser.
+
+The page will reload when you make changes.\
+You may also see any lint errors in the console.
+
+### `npm test`
+
+Launches the test runner in the interactive watch mode.\
+See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
+
+### `npm run build`
+
+Builds the app for production to the `build` folder.\
+It correctly bundles React in production mode and optimizes the build for the best performance.
+
+The build is minified and the filenames include the hashes.\
+Your app is ready to be deployed!
+
+See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
+
+### `npm run eject`
+
+**Note: this is a one-way operation. Once you `eject`, you can't go back!**
+
+If you aren't satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
+
+Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you're on your own.
+
+You don't have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn't feel obligated to use this feature. However we understand that this tool wouldn't be useful if you couldn't customize it when you are ready for it.
+
+## Learn More
+
+You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
+
+To learn React, check out the [React documentation](https://reactjs.org/).
+
+### Code Splitting
+
+This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting)
+
+### Analyzing the Bundle Size
+
+This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size)
+
+### Making a Progressive Web App
+
+This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app)
+
+### Advanced Configuration
+
+This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration)
+
+### Deployment
+
+This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment)
+
+### `npm run build` fails to minify
+
+This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify)

+ 15 - 0
js/23_react_hw-2/hw/package-lock.json

@@ -16,6 +16,7 @@
         "react-redux": "^7.2.6",
         "react-scripts": "5.0.0",
         "redux": "^4.1.2",
+        "redux-thunk": "^2.4.1",
         "sass": "^1.45.1",
         "thunk": "^0.0.1",
         "web-vitals": "^2.1.2"
@@ -13421,6 +13422,14 @@
         "@babel/runtime": "^7.9.2"
       }
     },
+    "node_modules/redux-thunk": {
+      "version": "2.4.1",
+      "resolved": "https://registry.npmjs.org/redux-thunk/-/redux-thunk-2.4.1.tgz",
+      "integrity": "sha512-OOYGNY5Jy2TWvTL1KgAlVy6dcx3siPJ1wTq741EPyUKfn6W6nChdICjZwCd0p8AZBs5kWpZlbkXW2nE/zjUa+Q==",
+      "peerDependencies": {
+        "redux": "^4"
+      }
+    },
     "node_modules/regenerate": {
       "version": "1.4.2",
       "resolved": "https://registry.npmjs.org/regenerate/-/regenerate-1.4.2.tgz",
@@ -25740,6 +25749,12 @@
         "@babel/runtime": "^7.9.2"
       }
     },
+    "redux-thunk": {
+      "version": "2.4.1",
+      "resolved": "https://registry.npmjs.org/redux-thunk/-/redux-thunk-2.4.1.tgz",
+      "integrity": "sha512-OOYGNY5Jy2TWvTL1KgAlVy6dcx3siPJ1wTq741EPyUKfn6W6nChdICjZwCd0p8AZBs5kWpZlbkXW2nE/zjUa+Q==",
+      "requires": {}
+    },
     "regenerate": {
       "version": "1.4.2",
       "resolved": "https://registry.npmjs.org/regenerate/-/regenerate-1.4.2.tgz",

+ 1 - 0
js/23_react_hw-2/hw/package.json

@@ -11,6 +11,7 @@
     "react-redux": "^7.2.6",
     "react-scripts": "5.0.0",
     "redux": "^4.1.2",
+    "redux-thunk": "^2.4.1",
     "sass": "^1.45.1",
     "thunk": "^0.0.1",
     "web-vitals": "^2.1.2"

BIN
js/23_react_hw/react_hw/public/favicon.ico


+ 43 - 0
js/23_react_hw/react_hw/public/index.html

@@ -0,0 +1,43 @@
+<!DOCTYPE html>
+<html lang="en">
+  <head>
+    <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"
+    />
+    <link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
+    <!--
+      manifest.json provides metadata used when your web app is installed on a
+      user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
+    -->
+    <link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
+    <!--
+      Notice the use of %PUBLIC_URL% in the tags above.
+      It will be replaced with the URL of the `public` folder during the build.
+      Only files inside the `public` folder can be referenced from the HTML.
+
+      Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
+      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>
+  </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
js/23_react_hw/react_hw/public/logo192.png


BIN
js/23_react_hw/react_hw/public/logo512.png


+ 25 - 0
js/23_react_hw/react_hw/public/manifest.json

@@ -0,0 +1,25 @@
+{
+  "short_name": "React App",
+  "name": "Create React App Sample",
+  "icons": [
+    {
+      "src": "favicon.ico",
+      "sizes": "64x64 32x32 24x24 16x16",
+      "type": "image/x-icon"
+    },
+    {
+      "src": "logo192.png",
+      "type": "image/png",
+      "sizes": "192x192"
+    },
+    {
+      "src": "logo512.png",
+      "type": "image/png",
+      "sizes": "512x512"
+    }
+  ],
+  "start_url": ".",
+  "display": "standalone",
+  "theme_color": "#000000",
+  "background_color": "#ffffff"
+}

+ 3 - 0
js/23_react_hw/react_hw/public/robots.txt

@@ -0,0 +1,3 @@
+# https://www.robotstxt.org/robotstxt.html
+User-agent: *
+Disallow:

+ 124 - 0
js/23_react_hw/react_hw/src/App.js

@@ -0,0 +1,124 @@
+import React, {useState, useEffect, useRef} from 'react'
+import logoDefault from './logo.svg';
+import './App.scss';
+import {Provider, connect}   from 'react-redux';
+import {createStore, combineReducers, applyMiddleware} from 'redux';
+import thunk from 'redux-thunk';
+
+
+const Spoiler = ({header="+", open=true, children}) => {
+  const [isOpen, setOpen] = useState(open)
+  return (
+    <div>
+        <div  onClick = {e => setOpen(!isOpen)}>{header}</div>
+        {isOpen && children}
+    </div>
+  )
+}
+
+
+const RangeInput = ({min, max}) => {
+  const [text, setText] = useState('')
+  return (
+    <input style={ {backgroundColor: (text.length >= min && text.length <= max) ? '#fff' : '#f00'} }
+    value={text} onChange={(e) => setText(e.target.value)}/>
+  )
+}
+
+
+const PasswordConfirm = ({min, char=false, bigChar=false, number=false}) => {
+  const [pass, setPass] = useState('')
+  const [pass2, setPass2] = useState('')
+
+    const checkPass = (password) => {
+      if ( password.length >= min && 
+          (char ? password.match(/[a-zA-ZА-ЯЁа-яё]/) : true) && 
+          (bigChar ? password.match(/[A-ZА-ЯЁ]/) : true) && 
+          (number ? password.match(/[\d]/) : true) ) {
+        return true
+      } else {
+        return false
+      }
+    }
+
+    const printPassReq = (password) => {
+      let str = ''
+      if (!checkPass(password)) {
+        str += 'Пароль должен содержать: '
+      } else {
+        str += 'Пароль подходит '
+      }
+      if (password.length < min) {        
+        str += ` минимум ${min} символ${((min === 1) ? '' : (min > 1 && min < 5) ? 'а' : 'ов')},`
+      }
+      if (!(char ? password.match(/[a-zA-ZА-ЯЁа-яё]/) : true)) {
+        str += ' буквы,'
+      }
+      if (!(bigChar ? password.match(/[A-ZА-ЯЁ]/) : true)) {
+        str += ' прописные буквы,'
+      }
+      if  (!(number ? password.match(/[\d]/) : true)) {
+        str += ' цифры,'
+      }
+      return str.slice(0, -1)
+    }
+
+  return (
+    <div>
+      <p>        
+        <input type='password' className="p1" value={pass} onChange={(e) => setPass(e.target.value)}
+        style={ {backgroundColor: ( checkPass(pass) && pass === pass2) ? '#fff' : '#f00'} }/>
+
+        <label> 
+          {printPassReq(pass)}
+        </label>
+      </p>
+      <p>
+        <input type='password' className="p2" value={pass2} onChange={(e) => setPass2(e.target.value)}
+        style={ {backgroundColor: ( checkPass(pass2) && pass === pass2) ? '#fff' : '#f00'} }/>
+
+        <label> 
+          {printPassReq(pass2)}
+        </label>
+      </p>
+      <div>{(pass === pass2 ? '' : 'пароли не совпадают')}</div>
+    </div>
+  )
+}
+
+
+
+const Timer = ({seconds=100}) => {
+
+  return (
+    <div>
+      <h6></h6>
+      <button>Пауза</button>
+    </div>
+  )
+}
+
+
+function App() {
+  return (
+    <>
+      <Spoiler header={<h1>Заголовок</h1>} open={false}>
+          Контент 1
+          <p>
+              лорем ипсум траливали и тп.
+          </p>
+      </Spoiler>
+
+      <RangeInput min={2} max={10} />
+
+      <PasswordConfirm min={3} char={true} bigChar={true} number={true}/>
+
+
+      
+
+
+    </>
+  );
+}
+
+export default App;

js/23_react_hw-2/hw/src/App.scss → js/23_react_hw/react_hw/src/App.scss


+ 8 - 0
js/23_react_hw/react_hw/src/App.test.js

@@ -0,0 +1,8 @@
+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();
+});

+ 17 - 0
js/23_react_hw/react_hw/src/index.js

@@ -0,0 +1,17 @@
+import React from 'react';
+import ReactDOM from 'react-dom';
+import './index.scss';
+import App from './App';
+import reportWebVitals from './reportWebVitals';
+
+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();

+ 13 - 0
js/23_react_hw/react_hw/src/index.scss

@@ -0,0 +1,13 @@
+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;
+}

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 1 - 0
js/23_react_hw/react_hw/src/logo.svg


+ 13 - 0
js/23_react_hw/react_hw/src/reportWebVitals.js

@@ -0,0 +1,13 @@
+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;

+ 5 - 0
js/23_react_hw/react_hw/src/setupTests.js

@@ -0,0 +1,5 @@
+// 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';

+ 0 - 13
js/24_react_shop/index.html

@@ -1,13 +0,0 @@
-<!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>
-</head>
-<body>
-   
-   <script src="./index.js"></script>
-</body>
-</html>

+ 0 - 24
js/24_react_shop/index.js

@@ -1,24 +0,0 @@
-htmlTree()
-function htmlTree() {
-
-}
-
-htmlTree()
-function htmlTree() {
-
-}
-
-htmlTree()
-function htmlTree() {
-
-}
-
-htmlTree()
-function htmlTree() {
-
-}
-
-htmlTree()
-function htmlTree() {
-
-}

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 1129 - 0
js/24_react_shop/package-lock.json


+ 5 - 0
js/24_react_shop/package.json

@@ -0,0 +1,5 @@
+{
+  "dependencies": {
+    "create-react-app": "^5.0.0"
+  }
+}

+ 23 - 0
js/24_react_shop/react_shop/.gitignore

@@ -0,0 +1,23 @@
+# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
+
+# dependencies
+/node_modules
+/.pnp
+.pnp.js
+
+# testing
+/coverage
+
+# production
+/build
+
+# misc
+.DS_Store
+.env.local
+.env.development.local
+.env.test.local
+.env.production.local
+
+npm-debug.log*
+yarn-debug.log*
+yarn-error.log*

+ 70 - 0
js/24_react_shop/react_shop/README.md

@@ -0,0 +1,70 @@
+# Getting Started with Create React App
+
+This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
+
+## Available Scripts
+
+In the project directory, you can run:
+
+### `npm start`
+
+Runs the app in the development mode.\
+Open [http://localhost:3000](http://localhost:3000) to view it in your browser.
+
+The page will reload when you make changes.\
+You may also see any lint errors in the console.
+
+### `npm test`
+
+Launches the test runner in the interactive watch mode.\
+See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
+
+### `npm run build`
+
+Builds the app for production to the `build` folder.\
+It correctly bundles React in production mode and optimizes the build for the best performance.
+
+The build is minified and the filenames include the hashes.\
+Your app is ready to be deployed!
+
+See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
+
+### `npm run eject`
+
+**Note: this is a one-way operation. Once you `eject`, you can't go back!**
+
+If you aren't satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
+
+Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you're on your own.
+
+You don't have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn't feel obligated to use this feature. However we understand that this tool wouldn't be useful if you couldn't customize it when you are ready for it.
+
+## Learn More
+
+You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
+
+To learn React, check out the [React documentation](https://reactjs.org/).
+
+### Code Splitting
+
+This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting)
+
+### Analyzing the Bundle Size
+
+This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size)
+
+### Making a Progressive Web App
+
+This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app)
+
+### Advanced Configuration
+
+This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration)
+
+### Deployment
+
+This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment)
+
+### `npm run build` fails to minify
+
+This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify)

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 28019 - 0
js/24_react_shop/react_shop/package-lock.json


+ 43 - 0
js/24_react_shop/react_shop/package.json

@@ -0,0 +1,43 @@
+{
+  "name": "hw",
+  "version": "0.1.0",
+  "private": true,
+  "dependencies": {
+    "@testing-library/jest-dom": "^5.16.1",
+    "@testing-library/react": "^12.1.2",
+    "@testing-library/user-event": "^13.5.0",
+    "react": "^17.0.2",
+    "react-dom": "^17.0.2",
+    "react-redux": "^7.2.6",
+    "react-router-dom": "^5.3.0",
+    "react-scripts": "5.0.0",
+    "redux": "^4.1.2",
+    "redux-thunk": "^2.4.1",
+    "sass": "^1.45.1",
+    "web-vitals": "^2.1.2"
+  },
+  "scripts": {
+    "start": "react-scripts start",
+    "build": "react-scripts build",
+    "test": "react-scripts test",
+    "eject": "react-scripts eject"
+  },
+  "eslintConfig": {
+    "extends": [
+      "react-app",
+      "react-app/jest"
+    ]
+  },
+  "browserslist": {
+    "production": [
+      ">0.2%",
+      "not dead",
+      "not op_mini all"
+    ],
+    "development": [
+      "last 1 chrome version",
+      "last 1 firefox version",
+      "last 1 safari version"
+    ]
+  }
+}

BIN
js/24_react_shop/react_shop/public/favicon.ico


+ 43 - 0
js/24_react_shop/react_shop/public/index.html

@@ -0,0 +1,43 @@
+<!DOCTYPE html>
+<html lang="en">
+  <head>
+    <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"
+    />
+    <link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
+    <!--
+      manifest.json provides metadata used when your web app is installed on a
+      user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
+    -->
+    <link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
+    <!--
+      Notice the use of %PUBLIC_URL% in the tags above.
+      It will be replaced with the URL of the `public` folder during the build.
+      Only files inside the `public` folder can be referenced from the HTML.
+
+      Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
+      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>
+  </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
js/24_react_shop/react_shop/public/logo192.png


BIN
js/24_react_shop/react_shop/public/logo512.png


+ 25 - 0
js/24_react_shop/react_shop/public/manifest.json

@@ -0,0 +1,25 @@
+{
+  "short_name": "React App",
+  "name": "Create React App Sample",
+  "icons": [
+    {
+      "src": "favicon.ico",
+      "sizes": "64x64 32x32 24x24 16x16",
+      "type": "image/x-icon"
+    },
+    {
+      "src": "logo192.png",
+      "type": "image/png",
+      "sizes": "192x192"
+    },
+    {
+      "src": "logo512.png",
+      "type": "image/png",
+      "sizes": "512x512"
+    }
+  ],
+  "start_url": ".",
+  "display": "standalone",
+  "theme_color": "#000000",
+  "background_color": "#ffffff"
+}

+ 3 - 0
js/24_react_shop/react_shop/public/robots.txt

@@ -0,0 +1,3 @@
+# https://www.robotstxt.org/robotstxt.html
+User-agent: *
+Disallow:

+ 6 - 0
js/23_react_hw-2/hw/src/App.js

@@ -5,9 +5,15 @@ import {Provider, connect}   from 'react-redux';
 import {createStore, combineReducers, applyMiddleware} from 'redux';
 import thunk from 'redux-thunk';
 
+
+
+
+
 function App() {
   return (
     <>
+
+
     </>
   );
 }

+ 0 - 0
js/24_react_shop/react_shop/src/App.scss


+ 8 - 0
js/24_react_shop/react_shop/src/App.test.js

@@ -0,0 +1,8 @@
+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();
+});

+ 17 - 0
js/24_react_shop/react_shop/src/index.js

@@ -0,0 +1,17 @@
+import React from 'react';
+import ReactDOM from 'react-dom';
+import './index.scss';
+import App from './App';
+import reportWebVitals from './reportWebVitals';
+
+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();

+ 13 - 0
js/24_react_shop/react_shop/src/index.scss

@@ -0,0 +1,13 @@
+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;
+}

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 1 - 0
js/24_react_shop/react_shop/src/logo.svg


+ 13 - 0
js/24_react_shop/react_shop/src/reportWebVitals.js

@@ -0,0 +1,13 @@
+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;

+ 0 - 0
js/24_react_shop/react_shop/src/setupTests.js


Một số tệp đã không được hiển thị bởi vì quá nhiều tập tin thay đổi trong này khác