-
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
1 parent
6effd41
commit 7a53edb
Showing
15 changed files
with
178 additions
and
42 deletions.
There are no files selected for viewing
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
.blogPage{ | ||
/*display: flex;*/ | ||
/*justify-content: center;*/ | ||
width: 100%; | ||
margin-left: 30%; | ||
|
||
} | ||
.blogInput{ | ||
border: 3px solid white; | ||
border-radius: 5px; | ||
padding: 10px; | ||
width: 50%; | ||
margin-right: 10px; | ||
} | ||
.postsDiv{ | ||
margin: 5px; | ||
margin-top: 20px; | ||
width: 60%; | ||
font-size: 18px; | ||
} | ||
.postItemDiv div{ | ||
margin-bottom: 10px; | ||
display: flex; | ||
justify-content: space-between; | ||
align-items: center; | ||
border: 2px solid #5b5ab8; | ||
border-radius: 5px; | ||
padding: 3px; | ||
background-color: rgba(255,255,255,1); | ||
|
||
} | ||
.postsDiv a{ | ||
color: black; | ||
text-decoration: none; | ||
} |
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 @@ | ||
import React from 'react'; | ||
import './Post.css' | ||
import MyButton from "./UI/button/MyButton"; | ||
const PostForm: React.FC = () => { | ||
return ( | ||
<div> | ||
<input className={'blogInput'} type="text" placeholder={"Type your post..."}/> | ||
<MyButton >Add Post</MyButton> | ||
</div> | ||
); | ||
}; | ||
|
||
export default PostForm; |
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,25 @@ | ||
import React from 'react'; | ||
import {Link} from "react-router-dom"; | ||
import MyButton from "./UI/button/MyButton"; | ||
|
||
|
||
interface PostItemProps{ | ||
post: any | ||
} | ||
const PostItem: React.FC<PostItemProps> = ({post}) => { | ||
return ( | ||
<div className={'postItemDiv'}> | ||
<div> | ||
<strong> | ||
<Link to={`/blog/${post.id}`}>{ post.id + ' ' + post.title}</Link> | ||
</strong> | ||
|
||
<p>{post.body}</p> | ||
<MyButton>Удалить</MyButton> | ||
</div> | ||
|
||
</div> | ||
); | ||
}; | ||
|
||
export default PostItem; |
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,18 @@ | ||
import React from 'react'; | ||
import PostItem from "./PostItem"; | ||
|
||
interface PostListProps{ | ||
posts: Array<any> | ||
setPosts: Function | ||
} | ||
const PostList: React.FC<PostListProps> = ({posts, setPosts}) => { | ||
return ( | ||
<div className={'postsDiv'}> | ||
{posts.map(post => { | ||
return <PostItem key={post.id} post={post}/> | ||
})} | ||
</div> | ||
); | ||
}; | ||
|
||
export default PostList; |
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,10 @@ | ||
/*COMMON*/ | ||
.buttonUse{ | ||
border: none; | ||
color: white; | ||
background-color: #5b5ab8; | ||
|
||
padding: 10px; | ||
border-radius: 5px; | ||
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,16 @@ | ||
import React, {PropsWithChildren} from 'react'; | ||
import cl from './MyButton.module.css' | ||
|
||
interface IButton { | ||
props?: PropsWithChildren | ||
children?: React.ReactNode | ||
} | ||
const MyButton: React.FC<IButton> = ({props, children}) => { | ||
return ( | ||
<button className={cl.buttonUse} {...props}> | ||
{children} | ||
</button> | ||
); | ||
}; | ||
|
||
export default MyButton; |
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,29 @@ | ||
import React, {useState} from 'react'; | ||
import PostForm from "../components/PostForm"; | ||
import '../components/Post.css' | ||
import PostList from "../components/PostList"; | ||
const BlogPage: React.FC = () => { | ||
|
||
const [posts, setPosts] = useState([ | ||
{id: 1, title: 'About me', body: 'My name is Alex, i`m a frontend developer!'}, | ||
{id: 2, title: 'My skills', body: 'Using html, css, js, react, redux'}, | ||
{id: 3, title: 'Stage', body: '2 years'}, | ||
]) | ||
|
||
return ( | ||
<> | ||
<div className={'blogPage'}> | ||
|
||
<PostForm/> | ||
|
||
{/*<hr style={{margin: '15px 0'}}/>*/} | ||
|
||
<PostList posts={posts} setPosts={setPosts}/> | ||
|
||
</div> | ||
</> | ||
|
||
); | ||
}; | ||
|
||
export default BlogPage; |
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.