-
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
84 changed files
with
17,789 additions
and
124 deletions.
There are no files selected for viewing
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
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,32 @@ | ||
import React from 'react'; | ||
import { Link } from 'react-router-dom'; | ||
|
||
//mui | ||
import { Container, Grid, Typography } from '@mui/material'; | ||
|
||
//components | ||
import Authors from '../authors/Authors'; | ||
import Blogs from '../blog/Blogs'; | ||
|
||
const HomePage = () => { | ||
return ( | ||
<div> | ||
<Container maxWidth='lg'> | ||
<Grid container spacing={2} padding={3}> | ||
<Grid item xs={12} md={3} mt={4}> | ||
<Typography component='h3' variant='h5' mb={3} fontWeight={700}> | ||
نویسنده ها</Typography> | ||
<Authors/> | ||
</Grid> | ||
<Grid item xs={12} md={9} mt={4}> | ||
<Typography component='h3' variant='h5' mb={3} fontWeight={700}> | ||
<Link to='/blogs' style={{textDecoration:'none' , color:'black',}}>مقالات</Link></Typography> | ||
<Blogs/> | ||
</Grid> | ||
</Grid> | ||
</Container> | ||
</div> | ||
); | ||
}; | ||
|
||
export default HomePage; |
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,65 @@ | ||
import { useQuery } from '@apollo/client'; | ||
import React from 'react'; | ||
import { useParams } from 'react-router-dom'; | ||
import sanitizeHtml from 'sanitize-html'; | ||
|
||
//query | ||
import { GET_AUTHOR_INFO } from '../../graphQL/Queries'; | ||
|
||
//MUI | ||
import { Avatar, Container, Grid, Typography } from '@mui/material'; | ||
|
||
//components | ||
import CardEL from '../shared/CardEL'; | ||
import Loader from '../shared/Loader'; | ||
|
||
const AuthorPage = () => { | ||
|
||
const {slug} = useParams() | ||
|
||
const { loading,data,error} = useQuery(GET_AUTHOR_INFO, { | ||
variables: {slug }, | ||
}); | ||
|
||
if(loading) return <Loader/> | ||
|
||
if(error) return <h2>Somthing Went Wrong!</h2> | ||
|
||
const {author:{name,posts,description,field,avatar}} = data; | ||
|
||
return ( | ||
<Container maxWidth='lg'> | ||
<Grid container mt={10}> | ||
<Grid item xs={12} display='flex' flexDirection='column' alignItems='center'> | ||
<Avatar src={avatar.url} sx={{width:250 , height:250}}/> | ||
<Typography component='h3' variant='h5' fontWeight={700} mt={4}>{name}</Typography> | ||
<Typography component='p' variant='h5' mt={2} color='text.secondary'>{field}</Typography> | ||
</Grid> | ||
<Grid item xs={12} mt={5}> | ||
<div dangerouslySetInnerHTML={{ | ||
__html: sanitizeHtml(description.html)}}> | ||
|
||
</div> | ||
</Grid> | ||
<Grid item xs={12} mt={6}> | ||
<Typography component='h3' variant='h5' fontWeight={700}> | ||
مقالات {name} | ||
</Typography> | ||
<Grid container spacing={2} mt={2}> | ||
{posts.map(post => ( | ||
<Grid item xs={12} sm={6} md={4} key={post.id}> | ||
<CardEL | ||
title={post.title} | ||
slug={post.slug} | ||
coverPhoto={post.coverPhoto} | ||
/> | ||
</Grid> | ||
))} | ||
</Grid> | ||
</Grid> | ||
</Grid> | ||
</Container> | ||
); | ||
}; | ||
|
||
export default AuthorPage; |
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,54 @@ | ||
import { useQuery } from '@apollo/client'; | ||
import React from 'react'; | ||
import { Link } from 'react-router-dom'; | ||
|
||
//query | ||
import { GET_AUTHORS_INFO } from '../../graphQL/Queries'; | ||
|
||
//MUI | ||
import { Avatar, Grid, Typography,Divider } from '@mui/material'; | ||
|
||
//components | ||
import Loader from '../shared/Loader'; | ||
|
||
const Authors = () => { | ||
const {loading,data,error} = useQuery(GET_AUTHORS_INFO) | ||
|
||
if(loading) return <Loader/> | ||
|
||
if(error) return <h2>Somthing Went Wrong!</h2> | ||
|
||
const { authors } = data; | ||
|
||
return ( | ||
|
||
|
||
<Grid container sx={{boxShadow:'rgba(0,0,0,0.1)0px 4px 12px',borderRadius:4}}> | ||
|
||
{ | ||
authors.map((author , index) => ( | ||
<React.Fragment key={author.id}> | ||
<Grid item xs={12} padding={2}> | ||
<Link to={`/authors/${author.slug}`} style={{display:'flex',alignItems:'center',textDecoration:'none'}}> | ||
<Avatar src={author.avatar.url} sx={{marginLeft:2}} /> | ||
<Typography component='p' variant='p' color='text.secondary'> | ||
{author.name} | ||
</Typography> | ||
</Link> | ||
</Grid> | ||
{index !== authors.length - 1 && ( | ||
<Grid item xs={12} > | ||
<Divider variant='middle' sx={{margin:'10px'}}/> | ||
</Grid> | ||
)} | ||
|
||
</React.Fragment> | ||
)) | ||
} | ||
|
||
</Grid> | ||
|
||
); | ||
}; | ||
|
||
export default Authors; |
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,78 @@ | ||
import { useQuery } from '@apollo/client'; | ||
import React from 'react'; | ||
import { useNavigate, useParams } from 'react-router-dom'; | ||
import sanitizeHtml from 'sanitize-html'; | ||
|
||
//query | ||
import { GET_POST_INFO } from '../../graphQL/Queries'; | ||
|
||
//components | ||
import Loader from '../shared/Loader'; | ||
import CommentForm from '../comment/commentForm'; | ||
import Comments from '../comment/Comments'; | ||
|
||
//MUI | ||
import { Avatar, Box, Container, Grid, Typography } from '@mui/material'; | ||
|
||
//Icon | ||
import ArrowBackRoundedIcon from '@mui/icons-material/ArrowBackRounded'; | ||
|
||
|
||
const BlogPage = () => { | ||
|
||
const {slug} = useParams(); | ||
const navigate = useNavigate() | ||
|
||
const{loading,data,error} = useQuery(GET_POST_INFO , { | ||
variables:{slug} | ||
}); | ||
|
||
if(loading) return <Loader/> | ||
|
||
if(error) return <h2>Somthing Went Wrong!</h2> | ||
|
||
|
||
return ( | ||
<Container maxWidth='lg'> | ||
<Grid container > | ||
<Grid item xs={12} mt={9} display='flex' justifyContent='space-between'> | ||
<Typography component='h2' variant='h4' color='primary' fontWeight={700}> | ||
{data?.post?.title} | ||
</Typography> | ||
<ArrowBackRoundedIcon onClick={() => navigate(-1)} sx={{cursor:'pointer'}}/> | ||
</Grid> | ||
<Grid item xs={12} mt={6} > | ||
<img | ||
src={data?.post?.coverPhoto.url} | ||
alt={data?.post?.slug} | ||
width='100%' | ||
style={{borderRadius: 15}} | ||
/> | ||
</Grid> | ||
<Grid item xs={12} mt={7} display='flex' alignItems='center'> | ||
<Avatar | ||
src={data?.post?.author?.avatar.url} | ||
sx={{width:80 , height:80 , marginLeft:4}} | ||
/> | ||
<Box component='div' > | ||
<Typography component='p' variant='h5' fontWeight={700}>{data?.post?.author.name}</Typography> | ||
<Typography component='p' variant='p' color='text.secondary'>{data?.post?.author.field}</Typography> | ||
</Box> | ||
</Grid> | ||
<Grid item xs={12} mt={4}> | ||
<div dangerouslySetInnerHTML={{ | ||
__html: sanitizeHtml(data?.post?.content.html)}}></div> | ||
</Grid> | ||
<Grid item xs={12}> | ||
<CommentForm slug={slug}/> | ||
</Grid> | ||
<Grid item xs={12}> | ||
<Comments slug={slug}/> | ||
</Grid> | ||
</Grid> | ||
|
||
</Container> | ||
); | ||
}; | ||
|
||
export default BlogPage; |
Oops, something went wrong.