forked from b00tc4mp/isdi-bootcamp-202409
-
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.
refactor logic; implement header and footer fixed onscreen, like butt…
…on WIP b00tc4mp#168
- Loading branch information
Javier Romera Claros
authored and
Javier Romera Claros
committed
Oct 23, 2024
1 parent
a835dc6
commit ebf95eb
Showing
37 changed files
with
474 additions
and
122 deletions.
There are no files selected for viewing
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
3 changes: 3 additions & 0 deletions
3
staff/javier-romera/unsocial/src/components/functional/CreatePost.css
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 @@ | ||
.CreatePost { | ||
background-color: var(--back-color); | ||
} |
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
13 changes: 13 additions & 0 deletions
13
staff/javier-romera/unsocial/src/components/functional/Footer.css
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,13 @@ | ||
.Footer { | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
height: 5%; | ||
width: 100%; | ||
color: var(--color); | ||
background-color: black; | ||
position: fixed; | ||
bottom: 0; | ||
border-top: 1px solid var(--color); | ||
font-size: 12px; | ||
} |
7 changes: 7 additions & 0 deletions
7
staff/javier-romera/unsocial/src/components/functional/Footer.jsx
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,7 @@ | ||
import './Footer.css' | ||
|
||
function Footer() { | ||
return <div className="Footer">Footer :)</div> | ||
} | ||
|
||
export default Footer |
17 changes: 17 additions & 0 deletions
17
staff/javier-romera/unsocial/src/components/functional/Header.css
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,17 @@ | ||
.Header { | ||
background-color: var(--back-color); | ||
width: 100%; | ||
height: 10%; | ||
box-sizing: border-box; | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
background-color: black; | ||
position: fixed; | ||
top: 0; | ||
|
||
h1 { | ||
margin: 0; | ||
font-size: 1rem; | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
staff/javier-romera/unsocial/src/components/functional/Header.jsx
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,9 @@ | ||
import './Header.css' | ||
|
||
function Header({ }) { | ||
return <header className='Header'> | ||
<h1>laicosnU</h1> | ||
</header> | ||
} | ||
|
||
export default Header |
52 changes: 52 additions & 0 deletions
52
staff/javier-romera/unsocial/src/components/functional/PostList.css
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,52 @@ | ||
.PostList { | ||
background-color: var(--back-color); | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
width: 100%; | ||
|
||
.delete-button { | ||
width: 145px; | ||
margin-top: 0.25rem; | ||
font-size: 12px; | ||
} | ||
|
||
article { | ||
text-align: start; | ||
justify-content: center; | ||
align-items: center; | ||
width: 80%; | ||
border: 1px solid var(--color); | ||
padding-bottom: 1rem; | ||
margin-bottom: 1rem; | ||
padding-right: 0.5rem; | ||
padding-left: 0.5rem; | ||
} | ||
|
||
time { | ||
font-size: 10px; | ||
} | ||
|
||
img { | ||
width: 100%; | ||
margin-bottom: 0.25rem; | ||
} | ||
|
||
h4 { | ||
margin: 0; | ||
padding: 1rem 0 1rem 0; | ||
} | ||
|
||
p { | ||
margin: 0; | ||
padding: 0.5rem 0 0.5rem 0; | ||
} | ||
|
||
.comments-p { | ||
font-size: 10px; | ||
} | ||
|
||
span { | ||
font-size: 14px; | ||
} | ||
} |
26 changes: 17 additions & 9 deletions
26
staff/javier-romera/unsocial/src/components/functional/PostList.jsx
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,31 +1,39 @@ | ||
import getPosts from '../../logic/getPosts' | ||
import deletePost from '../../logic/deletePost' | ||
import './PostList.css' | ||
|
||
import logic from '../../logic' | ||
|
||
import LikeButton from '../library/LikeButton' | ||
import Button from '../library/Button' | ||
|
||
function PostList(props) { | ||
let posts | ||
|
||
try { | ||
posts = getPosts() | ||
posts = logic.getPosts() | ||
} catch (error) { | ||
alert(error.message) | ||
console.error(error) | ||
} | ||
|
||
return <div> | ||
return <section className="PostList"> | ||
<h3>Posts</h3> | ||
|
||
{posts.map(post => <article> | ||
<h4>{post.author.username}</h4> | ||
<img src={post.image} style={{ width: '100%' }} /> | ||
<img src={post.image} /> | ||
<div> | ||
<LikeButton id={sessionStorage.loggedInUserId} post={post} /> | ||
</div> | ||
<p>{post.text}</p> | ||
<time>{post.date}</time> | ||
{sessionStorage.loggedInUserId === post.author.id && <button type="button" onClick={() => { | ||
deletePost(post) | ||
<p className="comments-p">View comments..</p> | ||
{sessionStorage.loggedInUserId === post.author.id && <Button type="button" classname="delete-button" onClick={() => { | ||
logic.deletePost(post) | ||
|
||
props.onDeletedPost() | ||
}}>Delete Post</button>} | ||
}}>Delete Post</Button>} | ||
</article>)} | ||
</div> | ||
</section> | ||
} | ||
|
||
export default PostList |
7 changes: 7 additions & 0 deletions
7
staff/javier-romera/unsocial/src/components/library/Anchor.css
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,7 @@ | ||
.Anchor { | ||
margin-top: 0.25rem; | ||
} | ||
|
||
.Anchor:visited { | ||
color: var(--color); | ||
} |
7 changes: 7 additions & 0 deletions
7
staff/javier-romera/unsocial/src/components/library/Anchor.jsx
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,7 @@ | ||
import './Anchor.css' | ||
|
||
function Anchor({ href, onClick, children }) { | ||
return <a className="Anchor" href={href} onClick={onClick}>{children}</a> | ||
} | ||
|
||
export default Anchor |
9 changes: 9 additions & 0 deletions
9
staff/javier-romera/unsocial/src/components/library/Button.css
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,9 @@ | ||
.Button { | ||
color: var(--color); | ||
font-family: var(--font); | ||
background-color: var(--back-color); | ||
border-bottom: 1px solid #545454; | ||
border-right: 1px solid #545454; | ||
padding: 5px; | ||
width: 125px; | ||
} |
7 changes: 7 additions & 0 deletions
7
staff/javier-romera/unsocial/src/components/library/Button.jsx
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,7 @@ | ||
import './Button.css' | ||
|
||
function Button({ type, children, onClick, classname }) { | ||
return <button type={type} onClick={onClick} className={"Button " + classname}> {children}</button > | ||
} | ||
|
||
export default Button |
5 changes: 5 additions & 0 deletions
5
staff/javier-romera/unsocial/src/components/library/Field.css
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,5 @@ | ||
.Field { | ||
display: flex; | ||
flex-direction: column; | ||
gap: .5rem; | ||
} |
7 changes: 7 additions & 0 deletions
7
staff/javier-romera/unsocial/src/components/library/Field.jsx
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,7 @@ | ||
import './Field.css' | ||
|
||
function Field({ children }) { | ||
return <div className="Field">{children}</div> | ||
} | ||
|
||
export default Field |
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,7 @@ | ||
.Form { | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
gap: 1rem; | ||
margin: 1rem; | ||
} |
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,7 @@ | ||
import './Form.css' | ||
|
||
function Form({ children, onSubmit }) { | ||
return <form className="Form" onSubmit={onSubmit}>{children}</form> | ||
} | ||
|
||
export default Form |
5 changes: 5 additions & 0 deletions
5
staff/javier-romera/unsocial/src/components/library/Input.css
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,5 @@ | ||
.Input { | ||
color: var(--color); | ||
background-color: var(--back-color); | ||
font-family: inherit; | ||
} |
7 changes: 7 additions & 0 deletions
7
staff/javier-romera/unsocial/src/components/library/Input.jsx
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,7 @@ | ||
import './Input.css' | ||
|
||
function Input({ type, id }) { | ||
return <input className="Input" id={id} type={type}></input> | ||
} | ||
|
||
export default Input |
9 changes: 9 additions & 0 deletions
9
staff/javier-romera/unsocial/src/components/library/Label.css
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,9 @@ | ||
.Label { | ||
&::before { | ||
content: '['; | ||
} | ||
|
||
&::after { | ||
content: ']'; | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
staff/javier-romera/unsocial/src/components/library/Label.jsx
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,7 @@ | ||
import './Label.css' | ||
|
||
function Label({ htmlFor, children }) { | ||
return <label className="Label" htmlFor={htmlFor}>{children}</label> | ||
} | ||
|
||
export default Label |
9 changes: 9 additions & 0 deletions
9
staff/javier-romera/unsocial/src/components/library/LikeButton.css
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,9 @@ | ||
.LikeButton { | ||
background-color: var(--back-color); | ||
border: 0; | ||
width: 20px; | ||
height: 20px; | ||
font-size: 14px; | ||
padding: 0; | ||
margin-right: .25rem; | ||
} |
Oops, something went wrong.