created component for one post

parent f4228b68
......@@ -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>
......
import IPost from "../../interfaces/IPost";
export default interface IPostProps {
post: IPost
}
\ No newline at end of file
import { FunctionComponent, ReactElement } from "react";
import IPostProps from "./IPostProps";
import defaultImage from '../../assets/default-image.jpg'
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
import React, { FunctionComponent, ReactElement } from "react";
const HomePage: FunctionComponent = (): ReactElement => {
return (
<div className="homepage">
<div className="container">
</div>
</div>
)
}
export default HomePage
\ No newline at end of file
......@@ -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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment