├── .gitignore ├── README.md ├── package-lock.json ├── package.json ├── public ├── favicon.ico ├── index.html ├── logo192.png ├── logo512.png ├── manifest.json └── robots.txt └── src ├── App.js ├── api.js ├── components ├── SilModal.js ├── YaziDetayi.js ├── YaziDuzenle.js ├── YaziEkle.js ├── YaziFormu.js ├── YaziListesi.js ├── YaziYorumlari.js ├── YorumFormu.js └── YorumListesi.js └── index.js /.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | # testing 9 | /coverage 10 | 11 | # production 12 | /build 13 | 14 | # misc 15 | .DS_Store 16 | .env.local 17 | .env.development.local 18 | .env.test.local 19 | .env.production.local 20 | 21 | npm-debug.log* 22 | yarn-debug.log* 23 | yarn-error.log* 24 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Bu repo Redux'a cevirilmek uzere hazirlanmistir. 2 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "react-yazi-yorum-frontend", 3 | "version": "0.1.0", 4 | "private": true, 5 | "dependencies": { 6 | "@testing-library/jest-dom": "^4.2.4", 7 | "@testing-library/react": "^9.5.0", 8 | "@testing-library/user-event": "^7.2.1", 9 | "axios": "^0.21.1", 10 | "react": "^16.13.1", 11 | "react-dom": "^16.13.1", 12 | "react-router-dom": "^5.2.0", 13 | "react-scripts": "3.4.1", 14 | "semantic-ui-react": "^0.88.2" 15 | }, 16 | "scripts": { 17 | "start": "react-scripts start", 18 | "build": "react-scripts build", 19 | "test": "react-scripts test", 20 | "eject": "react-scripts eject" 21 | }, 22 | "eslintConfig": { 23 | "extends": "react-app" 24 | }, 25 | "browserslist": { 26 | "production": [ 27 | ">0.2%", 28 | "not dead", 29 | "not op_mini all" 30 | ], 31 | "development": [ 32 | "last 1 chrome version", 33 | "last 1 firefox version", 34 | "last 1 safari version" 35 | ] 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reactdersleri/react-yazi-yorum-redux-base-repo/a9746bc58e98aca861c1b375ce75af37ceda7bab/public/favicon.ico -------------------------------------------------------------------------------- /public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 12 | 16 | 17 | 21 | 22 | 31 | React App 32 | 33 | 34 | 35 |
36 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /public/logo192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reactdersleri/react-yazi-yorum-redux-base-repo/a9746bc58e98aca861c1b375ce75af37ceda7bab/public/logo192.png -------------------------------------------------------------------------------- /public/logo512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reactdersleri/react-yazi-yorum-redux-base-repo/a9746bc58e98aca861c1b375ce75af37ceda7bab/public/logo512.png -------------------------------------------------------------------------------- /public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "short_name": "React App", 3 | "name": "Create React App Sample", 4 | "icons": [ 5 | { 6 | "src": "favicon.ico", 7 | "sizes": "64x64 32x32 24x24 16x16", 8 | "type": "image/x-icon" 9 | }, 10 | { 11 | "src": "logo192.png", 12 | "type": "image/png", 13 | "sizes": "192x192" 14 | }, 15 | { 16 | "src": "logo512.png", 17 | "type": "image/png", 18 | "sizes": "512x512" 19 | } 20 | ], 21 | "start_url": ".", 22 | "display": "standalone", 23 | "theme_color": "#000000", 24 | "background_color": "#ffffff" 25 | } 26 | -------------------------------------------------------------------------------- /public/robots.txt: -------------------------------------------------------------------------------- 1 | # https://www.robotstxt.org/robotstxt.html 2 | User-agent: * 3 | Disallow: 4 | -------------------------------------------------------------------------------- /src/App.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import { BrowserRouter as Router, Route } from "react-router-dom"; 3 | 4 | import YaziListesi from "./components/YaziListesi"; 5 | import YaziDetayi from "./components/YaziDetayi"; 6 | import YaziEkle from "./components/YaziEkle"; 7 | import YaziDuzenle from "./components/YaziDuzenle"; 8 | 9 | function App() { 10 | return ( 11 | 12 |
13 |
14 |
15 | 16 | 17 | 18 | 19 |
20 |
21 |
22 | ); 23 | } 24 | 25 | export default App; 26 | -------------------------------------------------------------------------------- /src/api.js: -------------------------------------------------------------------------------- 1 | import axios from "axios"; 2 | 3 | export function api() { 4 | return axios.create({ 5 | baseURL: "https://react-yazi-yorum.herokuapp.com", 6 | }); 7 | } 8 | -------------------------------------------------------------------------------- /src/components/SilModal.js: -------------------------------------------------------------------------------- 1 | import React, { useState } from "react"; 2 | import { Button, Modal } from "semantic-ui-react"; 3 | import { api } from "../api"; 4 | 5 | const SilModal = ({ yazi, push }) => { 6 | const [open, setOpen] = useState(false); 7 | const [hata, setHata] = useState(""); 8 | const show = () => setOpen(true); 9 | const close = () => setOpen(false); 10 | 11 | const handleDelete = (id) => { 12 | api() 13 | .delete(`/posts/${id}`) 14 | .then(() => { 15 | setHata(""); 16 | close(); 17 | push(`/`); 18 | }) 19 | .catch(() => { 20 | setHata("Yazıyı silerken hata oluştu."); 21 | }); 22 | }; 23 | 24 | return ( 25 | 26 | 29 | 30 | Yazıyı Sil 31 | 32 |

33 | {yazi.title} başlıklı yazıyı silmek istediğinizden emin 34 | misiniz? 35 |

36 | {hata &&

{hata}

} 37 |
38 | 39 | 42 | 79 | 80 | 81 |
82 | ); 83 | }; 84 | 85 | export default YaziFormu; 86 | -------------------------------------------------------------------------------- /src/components/YaziListesi.js: -------------------------------------------------------------------------------- 1 | import React, { useEffect, useState } from "react"; 2 | import { api } from "../api"; 3 | import { Link } from "react-router-dom"; 4 | 5 | const YaziListesi = (props) => { 6 | const [yaziListesi, setYaziListesi] = useState([]); 7 | 8 | useEffect(() => { 9 | api() 10 | .get("/posts") 11 | .then((response) => { 12 | setYaziListesi(response.data); 13 | }); 14 | }, []); 15 | 16 | return ( 17 |
18 | 19 | Yazı Ekle 20 | 21 | {yaziListesi.map((yazi) => { 22 | return ( 23 |
24 | 25 |
26 | 27 | {yazi.title} 28 | 29 |
{yazi.created_at}
30 |
31 |
32 | ); 33 | })}{" "} 34 |
35 | ); 36 | }; 37 | 38 | export default YaziListesi; 39 | -------------------------------------------------------------------------------- /src/components/YaziYorumlari.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import YorumListesi from "./YorumListesi"; 3 | import YorumFormu from "./YorumFormu"; 4 | 5 | const YaziYorumlari = (props) => { 6 | return ( 7 | 8 | 9 | 10 | 11 | ); 12 | }; 13 | 14 | export default YaziYorumlari; 15 | -------------------------------------------------------------------------------- /src/components/YorumFormu.js: -------------------------------------------------------------------------------- 1 | import React, { useState } from "react"; 2 | 3 | const YORUM_BASLANGIC = { 4 | display_name: "", 5 | body: "", 6 | }; 7 | 8 | const YorumFormu = (props) => { 9 | const [yorum, setYorum] = useState(YORUM_BASLANGIC); 10 | 11 | const handleOnChange = (event) => { 12 | setYorum({ ...yorum, [event.target.name]: event.target.value }); 13 | }; 14 | 15 | return ( 16 | 17 |

Yorum Yaz

18 |
{ 21 | props.handleSubmit(event, yorum); 22 | setYorum(YORUM_BASLANGIC); 23 | }} 24 | > 25 |
26 | 33 |
34 | 41 | 44 |
45 |
46 | ); 47 | }; 48 | 49 | export default YorumFormu; 50 | -------------------------------------------------------------------------------- /src/components/YorumListesi.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | 3 | const YorumListesi = (props) => { 4 | return ( 5 | 6 |

Yorumlar

7 | {props.yorumlar.map((yorum) => { 8 | return ( 9 |
10 |
11 | {/* */} 15 |
16 | {yorum.display_name} 17 |
{yorum.body}
18 |
19 |
20 |
21 | ); 22 | })} 23 |
24 | ); 25 | }; 26 | 27 | export default YorumListesi; 28 | -------------------------------------------------------------------------------- /src/index.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import ReactDOM from "react-dom"; 3 | import App from "./App"; 4 | 5 | ReactDOM.render( 6 | 7 | 8 | , 9 | document.getElementById("root") 10 | ); 11 | --------------------------------------------------------------------------------