-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
26 changed files
with
954 additions
and
107 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,3 +21,4 @@ | |
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
src/firebase/config.js |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,24 @@ | ||
import logo from './logo.svg'; | ||
import './App.css'; | ||
import { BrowserRouter, Routes, Route } from "react-router-dom" | ||
import Home from "./pages/Home" | ||
import AllMovies from "./pages/AllMovies" | ||
import Movie from "./pages/Movie" | ||
import Form from "./pages/Form" | ||
import SharedLayout from "./pages/SharedLayout" | ||
|
||
function App() { | ||
const 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> | ||
</div> | ||
); | ||
<BrowserRouter> | ||
<Routes> | ||
<Route path="/" element={<SharedLayout/>}> | ||
|
||
<Route index element={<Home/>}/> | ||
<Route path="/all-movies" element={<AllMovies/>}/> | ||
<Route path="/one-movie/:movieId" element={<Movie/>}/> | ||
<Route path="/form" element={<Form/>}/> | ||
</Route> | ||
</Routes> | ||
</BrowserRouter> | ||
) | ||
} | ||
|
||
export default App; | ||
export default App |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
footer { | ||
text-align: center; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import "./Footer.css" | ||
|
||
const Footer = () => { | ||
return ( | ||
<footer> | ||
<p>pätička</p> | ||
</footer> | ||
) | ||
} | ||
|
||
export default Footer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
header { | ||
display: flex; | ||
flex-direction: row; | ||
justify-content: center; | ||
|
||
} | ||
|
||
nav { | ||
margin-top: 20px; | ||
margin-bottom: 20px; | ||
} | ||
|
||
nav a { | ||
margin-right: 10px; | ||
display: inline-block; | ||
text-decoration: none; | ||
color: #e5e5e5; | ||
font-size: 20px; | ||
} | ||
|
||
.active { | ||
text-decoration: underline; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import "./Navbar.css" | ||
import { NavLink } from "react-router-dom" | ||
|
||
const Navbar = () => { | ||
return ( | ||
<header> | ||
<nav> | ||
<NavLink to="/">Domov</NavLink> | ||
<NavLink to="/all-movies">Filmy</NavLink> | ||
<NavLink to="/form">Pridanie filmu</NavLink> | ||
</nav> | ||
</header> | ||
) | ||
} | ||
|
||
export default Navbar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
|
||
import firebase from "firebase/app" | ||
import "firebase/firestore" | ||
|
||
const firebaseConfig = { | ||
apiKey: "", | ||
authDomain: "", | ||
projectId: "", | ||
storageBucket: "", | ||
messagingSenderId: "", | ||
appId: "" | ||
}; | ||
|
||
// počiatočné nastavenie firebase (init) | ||
firebase.initializeApp(firebaseConfig) | ||
|
||
// počiatočné nastavenie služieb (services) | ||
const projectFirestore = firebase.firestore() | ||
|
||
export { projectFirestore } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,6 @@ | ||
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; | ||
} | ||
margin: 0; | ||
padding: 0; | ||
background-color: #141414; | ||
color: #e5e5e5; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
.one-movie { | ||
display: flex; | ||
flex-direction: row; | ||
align-items: center; | ||
border: 2px solid #e50914; | ||
justify-content: space-between; | ||
padding-left: 10px; | ||
padding-right: 10px; | ||
margin: 10px 10px; | ||
width: 500px; | ||
margin: 0 auto; | ||
} | ||
|
||
.one-movie p { | ||
width: 200px; | ||
} | ||
|
||
.one-movie a { | ||
text-decoration: none; | ||
color: #b92930; | ||
} | ||
|
||
.one-movie button { | ||
font-size: 14px; | ||
background-color: #e50914; | ||
border: none; | ||
color: #e5e5e5; | ||
padding: 5px 10px; | ||
cursor: pointer; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import "./AllMovies.css" | ||
import { projectFirestore } from "../firebase/config" | ||
import { useState, useEffect } from "react" | ||
import { Link } from "react-router-dom" | ||
|
||
const AllMovies = () => { | ||
const [data, setData] = useState([]) | ||
const [error, setError] = useState("") | ||
|
||
useEffect(()=>{ | ||
const unsubscribe = projectFirestore.collection("movies").onSnapshot(( snapshot )=>{ | ||
|
||
if (snapshot.empty){ | ||
setError("Žiadne filmy k vypísaniu") | ||
}else{ | ||
let result = [] | ||
snapshot.docs.forEach((movie)=>{ | ||
result.push( {id: movie.id, ...movie.data()} ) | ||
}) | ||
setData(result) | ||
} | ||
|
||
}, (err)=>{setError(err.message)}) | ||
|
||
return () => unsubscribe() | ||
|
||
},[]) | ||
|
||
const deleteMovie = (id) => { | ||
projectFirestore.collection("movies").doc(id).delete() | ||
} | ||
|
||
return ( | ||
<section> | ||
{error && <p>{error}</p>} | ||
{data.map((movie)=>{ | ||
const {id, title} = movie | ||
|
||
return ( | ||
<div key={id} className="one-movie"> | ||
<p>{title}</p> | ||
<Link to={`/one-movie/${id}`}>Viac informácií</Link> | ||
<button onClick={()=>deleteMovie(id)}>zmazať</button> | ||
</div> | ||
) | ||
})} | ||
</section> | ||
) | ||
} | ||
|
||
export default AllMovies |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
.form-section { | ||
text-align: center; | ||
} | ||
|
||
.form-section form { | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
} | ||
|
||
.input { | ||
border: 2px solid #e50914; | ||
background-color: #141414; | ||
margin-bottom: 5px; | ||
outline: none; | ||
color: #e5e5e5; | ||
font-size: 16px; | ||
} | ||
|
||
.input::placeholder { | ||
color: #bbbbbb; | ||
} | ||
|
||
.form-section input[type="submit"] { | ||
background-color: #e50914; | ||
color: #e5e5e5; | ||
padding: 5px 10px; | ||
cursor: pointer; | ||
border: none; | ||
margin-top: 15px; | ||
} |
Oops, something went wrong.