Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
H
hw92
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
5
Issues
5
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Болатов Ален
hw92
Commits
4ba578d4
Commit
4ba578d4
authored
Apr 03, 2023
by
Рахметова Альбина
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '
#20
' into 'dev'
#20
See merge request
!21
parents
f4228b68
666d4198
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
100 additions
and
3 deletions
+100
-3
.env
frontend/.env
+1
-1
App.tsx
frontend/src/App.tsx
+2
-1
default-image.jpg
frontend/src/assets/default-image.jpg
+0
-0
logo.jpg
frontend/src/assets/logo.jpg
+0
-0
Layout.css
frontend/src/components/Layout/Layout.css
+1
-0
IPostProps.ts
frontend/src/components/Post/IPostProps.ts
+5
-0
Post.css
frontend/src/components/Post/Post.css
+13
-0
Post.tsx
frontend/src/components/Post/Post.tsx
+24
-0
IPostListProps.ts
frontend/src/components/PostList/IPostListProps.ts
+5
-0
PostList.css
frontend/src/components/PostList/PostList.css
+0
-0
PostList.tsx
frontend/src/components/PostList/PostList.tsx
+20
-0
HomePage.css
frontend/src/containers/HomePage/HomePage.css
+0
-0
HomePage.tsx
frontend/src/containers/HomePage/HomePage.tsx
+28
-0
IPost.ts
frontend/src/interfaces/IPost.ts
+1
-1
No files found.
frontend/.env
View file @
4ba578d4
VITE_BASE_URL=http://localhost:800
0/
VITE_BASE_URL=http://localhost:800
2
frontend/src/App.tsx
View file @
4ba578d4
...
...
@@ -2,13 +2,14 @@ import { Container } from "@mui/material"
import
{
Route
,
Routes
}
from
"react-router-dom"
import
Layout
from
"./components/Layout/Layout"
import
'./App.css'
import
HomePage
from
"./containers/HomePage/HomePage"
const
App
=
()
=>
{
return
(
//@ts-ignore
<
Layout
>
<
Routes
>
<
Route
path=
{
'/'
}
element=
{
<
h1
>
HOME
</
h1
>
}
/>
<
Route
path=
{
'/'
}
element=
{
<
HomePage
/
>
}
/>
</
Routes
>
</
Layout
>
...
...
frontend/src/assets/default-image.jpg
0 → 100644
View file @
4ba578d4
10.2 KB
frontend/src/assets/logo.jpg
deleted
100644 → 0
View file @
f4228b68
32.4 KB
frontend/src/components/Layout/Layout.css
View file @
4ba578d4
.sidebar
{
margin
:
80px
30px
;
margin-right
:
150px
;
}
\ No newline at end of file
frontend/src/components/Post/IPostProps.ts
0 → 100644
View file @
4ba578d4
import
IPost
from
"../../interfaces/IPost"
;
export
default
interface
IPostProps
{
post
:
IPost
}
\ No newline at end of file
frontend/src/components/Post/Post.css
0 → 100644
View file @
4ba578d4
.post_imageframe
{
margin-right
:
100px
;
width
:
100%
;
border-radius
:
10px
;
overflow
:
hidden
;
height
:
300px
;
}
.post_image
{
width
:
100%
;
height
:
100%
;
object-fit
:
cover
;
}
\ No newline at end of file
frontend/src/components/Post/Post.tsx
0 → 100644
View file @
4ba578d4
import
{
FunctionComponent
,
ReactElement
}
from
"react"
;
import
IPostProps
from
"./IPostProps"
;
import
defaultImage
from
'../../assets/default-image.jpg'
import
'./Post.css'
const
Post
:
FunctionComponent
<
IPostProps
>
=
(
props
):
ReactElement
=>
{
return
(
<
div
className=
"post"
>
<
h3
>
user
</
h3
>
<
div
className=
"post_imageframe"
>
<
img
className=
"post_image"
src=
{
`${import.meta.env.VITE_BASE_URL}/uploads/${props.post.image}`
}
alt=
{
props
.
post
.
title
}
onError=
{
(
e
)
=>
{
e
.
currentTarget
.
src
=
defaultImage
}
}
/>
</
div
>
<
p
>
{
props
.
post
.
datetime
}
</
p
>
</
div
>
)
}
export
default
Post
\ No newline at end of file
frontend/src/components/PostList/IPostListProps.ts
0 → 100644
View file @
4ba578d4
import
IPost
from
"../../interfaces/IPost"
;
export
default
interface
IPostListProps
{
posts
:
IPost
[]
}
\ No newline at end of file
frontend/src/components/
index.tsx
→
frontend/src/components/
PostList/PostList.css
View file @
4ba578d4
File moved
frontend/src/components/PostList/PostList.tsx
0 → 100644
View file @
4ba578d4
import
React
,
{
FunctionComponent
,
ReactElement
}
from
"react"
;
import
IPostListProps
from
"./IPostListProps"
;
import
Post
from
"../Post/Post"
;
const
PostList
:
FunctionComponent
<
IPostListProps
>
=
(
props
):
ReactElement
=>
{
return
(
<
div
className=
"PostList"
>
{
props
.
posts
.
length
?
props
.
posts
.
map
(
p
=>
{
return
<
Post
key=
{
p
.
_id
}
post=
{
p
}
/>
}):
<
h1
>
No posts
</
h1
>
}
</
div
>
)
}
export
default
PostList
\ No newline at end of file
frontend/src/containers/Home
.tsx
→
frontend/src/containers/Home
Page/HomePage.css
View file @
4ba578d4
File moved
frontend/src/containers/HomePage/HomePage.tsx
0 → 100644
View file @
4ba578d4
import
React
,
{
FunctionComponent
,
ReactElement
,
useEffect
}
from
"react"
;
import
{
AppDispatch
,
AppState
}
from
"../../store/store"
;
import
{
shallowEqual
,
useDispatch
}
from
"react-redux"
;
import
{
useSelector
}
from
"react-redux"
;
import
{
getPosts
}
from
"../../store/posts/posts.slice"
;
import
PostList
from
"../../components/PostList/PostList"
;
const
HomePage
:
FunctionComponent
=
():
ReactElement
=>
{
const
dispatch
:
AppDispatch
=
useDispatch
()
const
{
posts
}
=
useSelector
((
state
:
AppState
)
=>
state
.
posts
,
shallowEqual
)
useEffect
(()
=>
{
dispatch
(
getPosts
())
},
[])
return
(
<
div
className=
"homepage"
>
<
div
className=
"container"
>
<
PostList
posts=
{
posts
}
/>
</
div
>
</
div
>
)
}
export
default
HomePage
\ No newline at end of file
frontend/src/interfaces/IPost.ts
View file @
4ba578d4
...
...
@@ -4,5 +4,5 @@ export default interface IPost {
title
:
string
description
:
string
image
:
File
|
undefined
|
string
datetime
:
Date
datetime
:
string
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment